diff --git a/backends-velox/src-iceberg/test/scala/org/apache/gluten/execution/enhanced/VeloxIcebergSuite.scala b/backends-velox/src-iceberg/test/scala/org/apache/gluten/execution/enhanced/VeloxIcebergSuite.scala index c3d3c8edc658..53ac42ef2801 100644 --- a/backends-velox/src-iceberg/test/scala/org/apache/gluten/execution/enhanced/VeloxIcebergSuite.scala +++ b/backends-velox/src-iceberg/test/scala/org/apache/gluten/execution/enhanced/VeloxIcebergSuite.scala @@ -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 @@ -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)}" + ) + } + } + } } diff --git a/ep/build-velox/src/get-velox.sh b/ep/build-velox/src/get-velox.sh index ef7301934b6f..b9b8c9f3d9ed 100755 --- a/ep/build-velox/src/get-velox.sh +++ b/ep/build-velox/src/get-velox.sh @@ -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