Skip to content
Merged
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 @@ -26,7 +26,7 @@ import org.apache.comet.CometSparkSessionExtensions.withInfo
import org.apache.comet.expressions.{CometCast, CometEvalMode}
import org.apache.comet.serde.{CommonStringExprs, Compatible, ExprOuterClass, Incompatible}
import org.apache.comet.serde.ExprOuterClass.{BinaryOutputStyle, Expr}
import org.apache.comet.serde.QueryPlanSerde.{exprToProtoInternal, optExprWithInfo, scalarFunctionExprToProto}
import org.apache.comet.serde.QueryPlanSerde.exprToProtoInternal

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

case wb: WidthBucket =>
val childExprs = wb.children.map(exprToProtoInternal(_, inputs, binding))
val optExpr = scalarFunctionExprToProto("width_bucket", childExprs: _*)
optExprWithInfo(optExpr, wb, wb.children: _*)
withInfo(
wb,
"WidthBucket not supported, track https://github.com/apache/datafusion/issues/20320")
None
// https://github.com/apache/datafusion/issues/20320
// val childExprs = wb.children.map(exprToProtoInternal(_, inputs, binding))
// val optExpr = scalarFunctionExprToProto("width_bucket", childExprs: _*)
// optExprWithInfo(optExpr, wb, wb.children: _*)

case _ => None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@ trait CometExprShim extends CommonStringExprs {
}

case wb: WidthBucket =>
val childExprs = wb.children.map(exprToProtoInternal(_, inputs, binding))
val optExpr = scalarFunctionExprToProto("width_bucket", childExprs: _*)
optExprWithInfo(optExpr, wb, wb.children: _*)
withInfo(
wb,
"WidthBucket not supported, track https://github.com/apache/datafusion/issues/20320")
None
// https://github.com/apache/datafusion/issues/20320
// val childExprs = wb.children.map(exprToProtoInternal(_, inputs, binding))
// val optExpr = scalarFunctionExprToProto("width_bucket", childExprs: _*)
// optExprWithInfo(optExpr, wb, wb.children: _*)

case _ => None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class CometMathExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelpe
DataGenOptions(generateNegativeZero = generateNegativeZero))
}

test("width_bucket") {
// https://github.com/apache/datafusion/issues/20320
ignore("width_bucket") {
assume(isSpark35Plus, "width_bucket was added in Spark 3.5")
withSQLConf("spark.comet.exec.localTableScan.enabled" -> "true") {
spark
Expand All @@ -105,7 +106,8 @@ class CometMathExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelpe
}
}

test("width_bucket - edge cases") {
// https://github.com/apache/datafusion/issues/20320
ignore("width_bucket - edge cases") {
assume(isSpark35Plus, "width_bucket was added in Spark 3.5")
withSQLConf("spark.comet.exec.localTableScan.enabled" -> "true") {
spark
Expand All @@ -122,7 +124,8 @@ class CometMathExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelpe
}
}

test("width_bucket - NaN values") {
// https://github.com/apache/datafusion/issues/20320
ignore("width_bucket - NaN values") {
assume(isSpark35Plus, "width_bucket was added in Spark 3.5")
withSQLConf("spark.comet.exec.localTableScan.enabled" -> "true") {
spark
Expand All @@ -134,7 +137,8 @@ class CometMathExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelpe
}
}

test("width_bucket - with range data") {
// https://github.com/apache/datafusion/issues/20320
ignore("width_bucket - with range data") {
assume(isSpark35Plus, "width_bucket was added in Spark 3.5")
withSQLConf("spark.comet.exec.localTableScan.enabled" -> "true") {
spark
Expand Down
Loading