Skip to content

Commit fc03f7d

Browse files
authored
chore: reenable width_bucket test (#3910)
1 parent 8d3ad57 commit fc03f7d

3 files changed

Lines changed: 12 additions & 22 deletions

File tree

spark/src/main/spark-3.5/org/apache/comet/shims/CometExprShim.scala

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import org.apache.comet.CometSparkSessionExtensions.withInfo
2626
import org.apache.comet.expressions.{CometCast, CometEvalMode}
2727
import org.apache.comet.serde.{CommonStringExprs, Compatible, ExprOuterClass, Incompatible}
2828
import org.apache.comet.serde.ExprOuterClass.{BinaryOutputStyle, Expr}
29-
import org.apache.comet.serde.QueryPlanSerde.exprToProtoInternal
29+
import org.apache.comet.serde.QueryPlanSerde.{exprToProtoInternal, optExprWithInfo, scalarFunctionExprToProto}
3030

3131
/**
3232
* `CometExprShim` acts as a shim for parsing expressions from different Spark versions.
@@ -82,14 +82,9 @@ trait CometExprShim extends CommonStringExprs {
8282
}
8383

8484
case wb: WidthBucket =>
85-
withInfo(
86-
wb,
87-
"WidthBucket not supported, track https://github.com/apache/datafusion-comet/issues/3561")
88-
None
89-
// https://github.com/apache/datafusion-comet/issues/3561
90-
// val childExprs = wb.children.map(exprToProtoInternal(_, inputs, binding))
91-
// val optExpr = scalarFunctionExprToProto("width_bucket", childExprs: _*)
92-
// optExprWithInfo(optExpr, wb, wb.children: _*)
85+
val childExprs = wb.children.map(exprToProtoInternal(_, inputs, binding))
86+
val optExpr = scalarFunctionExprToProto("width_bucket", childExprs: _*)
87+
optExprWithInfo(optExpr, wb, wb.children: _*)
9388

9489
case _ => None
9590
}

spark/src/main/spark-4.0/org/apache/comet/shims/CometExprShim.scala

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import org.apache.comet.CometSparkSessionExtensions.withInfo
2929
import org.apache.comet.expressions.{CometCast, CometEvalMode}
3030
import org.apache.comet.serde.{CommonStringExprs, Compatible, ExprOuterClass, Incompatible}
3131
import org.apache.comet.serde.ExprOuterClass.{BinaryOutputStyle, Expr}
32-
import org.apache.comet.serde.QueryPlanSerde.exprToProtoInternal
32+
import org.apache.comet.serde.QueryPlanSerde.{exprToProtoInternal, optExprWithInfo, scalarFunctionExprToProto}
3333

3434
/**
3535
* `CometExprShim` acts as a shim for parsing expressions from different Spark versions.
@@ -104,14 +104,9 @@ trait CometExprShim extends CommonStringExprs {
104104
}
105105

106106
case wb: WidthBucket =>
107-
withInfo(
108-
wb,
109-
"WidthBucket not supported, track https://github.com/apache/datafusion-comet/issues/3561")
110-
None
111-
// https://github.com/apache/datafusion-comet/issues/3561
112-
// val childExprs = wb.children.map(exprToProtoInternal(_, inputs, binding))
113-
// val optExpr = scalarFunctionExprToProto("width_bucket", childExprs: _*)
114-
// optExprWithInfo(optExpr, wb, wb.children: _*)
107+
val childExprs = wb.children.map(exprToProtoInternal(_, inputs, binding))
108+
val optExpr = scalarFunctionExprToProto("width_bucket", childExprs: _*)
109+
optExprWithInfo(optExpr, wb, wb.children: _*)
115110

116111
// KnownNotContainsNull is a TaggingExpression added in Spark 4.0 that only
117112
// changes schema metadata (containsNull = false). It has no runtime effect,

spark/src/test/resources/sql-tests/expressions/misc/width_bucket.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ CREATE TABLE test_wb(v double) USING parquet
2323
statement
2424
INSERT INTO test_wb VALUES (0.0), (2.5), (5.0), (7.5), (10.0), (-1.0), (11.0), (NULL)
2525

26-
query ignore(https://github.com/apache/datafusion-comet/issues/3331)
26+
query
2727
SELECT v, width_bucket(v, 0, 10, 4) FROM test_wb
2828

29-
query ignore(https://github.com/apache/datafusion-comet/issues/3331)
29+
query
3030
SELECT v, width_bucket(v, 10, 0, 4) FROM test_wb
3131

32-
query ignore(https://github.com/apache/datafusion-comet/issues/3331)
32+
query
3333
SELECT v, width_bucket(v, 0, 10, 1) FROM test_wb
3434

3535
-- literal arguments
36-
query ignore(https://github.com/apache/datafusion-comet/issues/3331)
36+
query
3737
SELECT width_bucket(5.0, 0, 10, 4), width_bucket(0.0, 0, 10, 4), width_bucket(NULL, 0, 10, 4)

0 commit comments

Comments
 (0)