Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.gluten.execution.enhanced

import org.apache.gluten.config.VeloxConfig
import org.apache.gluten.execution._
import org.apache.gluten.tags.EnhancedFeaturesTest

Expand Down Expand Up @@ -383,4 +384,139 @@ class VeloxIcebergSuite extends IcebergSuite {
}
}
}
test("iceberg max aggregate with nulls enhanced true") {
withSQLConf(VeloxConfig.ENABLE_ENHANCED_FEATURES.key -> "true") {
withTable("store_sales_test_nulls_enhanced_true") {
spark.sql("""
|create table store_sales_test_nulls_enhanced_true (
| ss_item_sk int,
| ss_sales_price decimal(7,2)
|) using iceberg
|""".stripMargin)

spark.sql("""
|insert into store_sales_test_nulls_enhanced_true values
|(1, 200.00),
|(2, 200.00),
|(3, null),
|(4, 199.98),
|(5, 199.96)
|""".stripMargin)

val result = spark
.sql("select max(ss_sales_price) from store_sales_test_nulls_enhanced_true")
.collect()

assert(result.length == 1, "Should return 1 row")
assert(result(0).get(0) != null, "MAX should not return NULL")
assert(
result(0).getDecimal(0).doubleValue() == 200.00,
s"MAX should return 200.00, but got ${result(0).get(0)}"
)
}
}
}

test("iceberg max aggregate without nulls enhanced true") {
withSQLConf(VeloxConfig.ENABLE_ENHANCED_FEATURES.key -> "true") {
withTable("store_sales_test_no_nulls_enhanced_true") {
spark.sql("""
|create table store_sales_test_no_nulls_enhanced_true (
| ss_item_sk int,
| ss_sales_price decimal(7,2)
|) using iceberg
|""".stripMargin)

spark.sql("""
|insert into store_sales_test_no_nulls_enhanced_true values
|(1, 200.00),
|(2, 200.00),
|(3, 200.00),
|(4, 199.98),
|(5, 199.96),
|(6, 199.96),
|(7, 199.92),
|(8, 199.92),
|(9, 199.92),
|(10, 199.90),
|(11, null)
|""".stripMargin)

val result = spark
.sql("select max(ss_sales_price) from store_sales_test_no_nulls_enhanced_true where ss_sales_price is not null")
.collect()

assert(result.length == 1, "Should return 1 row")
assert(result(0).get(0) != null, "MAX should not return NULL")
assert(
result(0).getDecimal(0).doubleValue() == 200.00,
s"MAX should return 200.00, but got ${result(0).get(0)}"
)
}
}
}

test("iceberg max aggregate with nulls enhanced false") {
withSQLConf(VeloxConfig.ENABLE_ENHANCED_FEATURES.key -> "false") {
withTable("store_sales_test_nulls_enhanced_false") {
spark.sql("""
|create table store_sales_test_nulls_enhanced_false (
| ss_item_sk int,
| ss_sales_price decimal(7,2)
|) using iceberg
|""".stripMargin)

spark.sql("""
|insert into store_sales_test_nulls_enhanced_false values
|(1, 200.00),
|(2, 199.98),
|(3, null),
|(4, 199.96)
|""".stripMargin)

val result = spark
.sql("select max(ss_sales_price) from store_sales_test_nulls_enhanced_false")
.collect()

assert(result.length == 1, "Should return 1 row")
assert(result(0).get(0) != null, "MAX should not return NULL")
assert(
result(0).getDecimal(0).doubleValue() == 200.00,
s"MAX should return 200.00, but got ${result(0).get(0)}"
)
}
}
}

test("iceberg max aggregate without nulls enhanced false") {
withSQLConf(VeloxConfig.ENABLE_ENHANCED_FEATURES.key -> "false") {
withTable("store_sales_test_no_nulls_enhanced_false") {
spark.sql("""
|create table store_sales_test_no_nulls_enhanced_false (
| ss_item_sk int,
| ss_sales_price decimal(7,2)
|) using iceberg
|""".stripMargin)

spark.sql("""
|insert into store_sales_test_no_nulls_enhanced_false values
|(1, 200.00),
|(2, 199.98),
|(3, 199.96),
|(4, null)
|""".stripMargin)

val result = spark
.sql("select max(ss_sales_price) from store_sales_test_no_nulls_enhanced_false where ss_sales_price is not null")
.collect()

assert(result.length == 1, "Should return 1 row")
assert(result(0).get(0) != null, "MAX should not return NULL")
assert(
result(0).getDecimal(0).doubleValue() == 200.00,
s"MAX should return 200.00, but got ${result(0).get(0)}"
)
}
}
}
}
2 changes: 1 addition & 1 deletion ep/build-velox/src/get-velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set -exu
CURRENT_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
VELOX_REPO=https://github.com/IBM/velox.git
VELOX_BRANCH=dft-2026_03_13-iceberg
VELOX_ENHANCED_BRANCH=ibm-2026_03_13
VELOX_ENHANCED_BRANCH=temp-fix
VELOX_HOME=""
RUN_SETUP_SCRIPT=ON
ENABLE_ENHANCED_FEATURES=OFF
Expand Down
Loading