You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2024/06/03 22:13:20 UTC
[PR] chore: Make ANSI fallback more granular [datafusion-comet]
andygrove opened a new pull request, #509:
URL: https://github.com/apache/datafusion-comet/pull/509
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
## How are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "kazuyukitanimura (via GitHub)" <gi...@apache.org>.
kazuyukitanimura commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1630801139
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -701,17 +695,17 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
case UnaryExpression(child) if expr.prettyName == "trycast" =>
val timeZoneId = SQLConf.get.sessionLocalTimeZone
- handleCast(child, inputs, expr.dataType, Some(timeZoneId), "TRY")
+ handleCast(child, inputs, expr.dataType, Some(timeZoneId), CometEvalMode.TRY)
- case Cast(child, dt, timeZoneId, evalMode) =>
- val evalModeStr = if (evalMode.isInstanceOf[Boolean]) {
- // Spark 3.2 & 3.3 has ansiEnabled boolean
- if (evalMode.asInstanceOf[Boolean]) "ANSI" else "LEGACY"
- } else {
- // Spark 3.4+ has EvalMode enum with values LEGACY, ANSI, and TRY
- evalMode.toString
- }
- handleCast(child, inputs, dt, timeZoneId, evalModeStr)
+ case c @ Cast(child, dt, timeZoneId, _) =>
+ handleCast(child, inputs, dt, timeZoneId, evalMode(c))
+
+ case expr if isUnsupportedAnsiExpr(expr) && !CometConf.COMET_ANSI_MODE_ENABLED.get() =>
Review Comment:
I feel `!CometConf.COMET_ANSI_MODE_ENABLED.get()` condition needs to be removed.
When `COMET_ANSI_MODE_ENABLED=true`, we still need to fallback to Spark if the expression is not ANSI compatible
##########
spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala:
##########
@@ -69,7 +69,7 @@ abstract class CometTestBase
conf.set("spark.hadoop.fs.file.impl", classOf[DebugFilesystem].getName)
conf.set("spark.ui.enabled", "false")
conf.set(SQLConf.SHUFFLE_PARTITIONS, 10) // reduce parallelism in tests
- conf.set(SQLConf.ANSI_ENABLED.key, "false")
+ conf.set(CometConf.COMET_ANSI_MODE_ENABLED.key, "true")
Review Comment:
What about leaving `COMET_ANSI_MODE_ENABLED` as default value as well? I.e. false for 3.x, true for 4.0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#issuecomment-2146218883
@kazuyukitanimura I have more work to do in this PR but wanted to make you aware of it since it is related to Spark 4 support.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1629438444
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -701,17 +698,38 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
case UnaryExpression(child) if expr.prettyName == "trycast" =>
val timeZoneId = SQLConf.get.sessionLocalTimeZone
- handleCast(child, inputs, expr.dataType, Some(timeZoneId), "TRY")
+ handleCast(child, inputs, expr.dataType, Some(timeZoneId), CometEvalMode.TRY)
- case Cast(child, dt, timeZoneId, evalMode) =>
- val evalModeStr = if (evalMode.isInstanceOf[Boolean]) {
- // Spark 3.2 & 3.3 has ansiEnabled boolean
- if (evalMode.asInstanceOf[Boolean]) "ANSI" else "LEGACY"
- } else {
- // Spark 3.4+ has EvalMode enum with values LEGACY, ANSI, and TRY
- evalMode.toString
- }
- handleCast(child, inputs, dt, timeZoneId, evalModeStr)
+ case c @ Cast(child, dt, timeZoneId, _) =>
+ handleCast(child, inputs, dt, timeZoneId, evalMode(c))
+
+ case expr: Add if evalMode(expr) == CometEvalMode.ANSI && !cometAnsiEnabled =>
Review Comment:
The code has been refactored significantly since this comment. There is now a single match arm for ANSI fallback and there is an `isUnsupportedAnsiExpr` method which determines if the expression is one where we do not yet have ANSI support.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1629447204
##########
spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala:
##########
@@ -712,17 +712,6 @@ class CometSparkSessionExtensions
}
override def apply(plan: SparkPlan): SparkPlan = {
- // DataFusion doesn't have ANSI mode. For now we just disable CometExec if ANSI mode is
- // enabled.
- if (isANSIEnabled(conf)) {
- if (COMET_ANSI_MODE_ENABLED.get()) {
- logWarning("Using Comet's experimental support for ANSI mode.")
- } else {
- logInfo("Comet extension disabled for ANSI mode")
- return plan
- }
- }
Review Comment:
> If I understand correctly we have not set up CI yet with ANSI enabled.
Well, we have the Spark 4 tests where ANSI is enabled and that is catching issues for sure.
I noticed that we were explicitly disabled ANSI mode in CometTestBase and I have removed that so we use the default ANSI mode for whatever Spark version we are running against. This should mean that all of our unit tests will now run with ANSI enabled when running against Spark 4+. Let's see how many issues this finds 🌑
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1631433344
##########
spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala:
##########
@@ -69,7 +69,7 @@ abstract class CometTestBase
conf.set("spark.hadoop.fs.file.impl", classOf[DebugFilesystem].getName)
conf.set("spark.ui.enabled", "false")
conf.set(SQLConf.SHUFFLE_PARTITIONS, 10) // reduce parallelism in tests
- conf.set(SQLConf.ANSI_ENABLED.key, "false")
+ conf.set(CometConf.COMET_ANSI_MODE_ENABLED.key, "true")
Review Comment:
Yes, good point
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1629447204
##########
spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala:
##########
@@ -712,17 +712,6 @@ class CometSparkSessionExtensions
}
override def apply(plan: SparkPlan): SparkPlan = {
- // DataFusion doesn't have ANSI mode. For now we just disable CometExec if ANSI mode is
- // enabled.
- if (isANSIEnabled(conf)) {
- if (COMET_ANSI_MODE_ENABLED.get()) {
- logWarning("Using Comet's experimental support for ANSI mode.")
- } else {
- logInfo("Comet extension disabled for ANSI mode")
- return plan
- }
- }
Review Comment:
> If I understand correctly we have not set up CI yet with ANSI enabled.
Well, we have the Spark 4 tests where ANSI is enabled and that is catching issues for sure.
I noticed that we were explicitly disabled ANSI mode in CometTestBase and I have removed that so we use the default ANSI mode for whatever Spark version we are running against. This should mean that all of our unit tests will now run with ANSI enabled when running against Spark 4+. Let's see how many issues this finds 😰
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1627789833
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -701,17 +698,38 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
case UnaryExpression(child) if expr.prettyName == "trycast" =>
val timeZoneId = SQLConf.get.sessionLocalTimeZone
- handleCast(child, inputs, expr.dataType, Some(timeZoneId), "TRY")
+ handleCast(child, inputs, expr.dataType, Some(timeZoneId), CometEvalMode.TRY)
- case Cast(child, dt, timeZoneId, evalMode) =>
- val evalModeStr = if (evalMode.isInstanceOf[Boolean]) {
- // Spark 3.2 & 3.3 has ansiEnabled boolean
- if (evalMode.asInstanceOf[Boolean]) "ANSI" else "LEGACY"
- } else {
- // Spark 3.4+ has EvalMode enum with values LEGACY, ANSI, and TRY
- evalMode.toString
- }
- handleCast(child, inputs, dt, timeZoneId, evalModeStr)
+ case c @ Cast(child, dt, timeZoneId, _) =>
+ handleCast(child, inputs, dt, timeZoneId, evalMode(c))
+
+ case expr: Add if evalMode(expr) == CometEvalMode.ANSI && !cometAnsiEnabled =>
+ withInfo(expr, ansiNotSupported)
+ None
+
+ case expr: Subtract if evalMode(expr) == CometEvalMode.ANSI && !cometAnsiEnabled =>
+ withInfo(expr, ansiNotSupported)
+ None
+
+ case expr: Multiply if evalMode(expr) == CometEvalMode.ANSI && !cometAnsiEnabled =>
Review Comment:
Maybe we can add a simple method containing all these checks together, instead of scattering them here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "parthchandra (via GitHub)" <gi...@apache.org>.
parthchandra commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1626789495
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -578,6 +576,14 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
}
}
+ def evalModeToProto(evalMode: CometEvalMode.Value): ExprOuterClass.EvalMode = {
+ evalMode match {
+ case CometEvalMode.LEGACY => ExprOuterClass.EvalMode.LEGACY
+ case CometEvalMode.TRY => ExprOuterClass.EvalMode.TRY
+ case CometEvalMode.ANSI => ExprOuterClass.EvalMode.ANSI
Review Comment:
Add a 'catch all' case for when someone tries to change CometEvalMode and things don't work as planned?
##########
spark/src/main/scala/org/apache/comet/expressions/CometEvalMode.scala:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.comet.expressions
+
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * We cannot reference Spark's EvalMode directly because the package is different between Spark
+ * versions, so we copy it here.
+ *
+ * Expression evaluation modes.
+ * - LEGACY: the default evaluation mode, which is compliant to Hive SQL.
+ * - ANSI: a evaluation mode which is compliant to ANSI SQL standard.
+ * - TRY: a evaluation mode for `try_*` functions. It is identical to ANSI evaluation mode
Review Comment:
Is `conf.ansiEnabled` ignored for `try_*` ? Maybe the comment can clarify.
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -701,17 +698,38 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
case UnaryExpression(child) if expr.prettyName == "trycast" =>
val timeZoneId = SQLConf.get.sessionLocalTimeZone
- handleCast(child, inputs, expr.dataType, Some(timeZoneId), "TRY")
+ handleCast(child, inputs, expr.dataType, Some(timeZoneId), CometEvalMode.TRY)
- case Cast(child, dt, timeZoneId, evalMode) =>
- val evalModeStr = if (evalMode.isInstanceOf[Boolean]) {
- // Spark 3.2 & 3.3 has ansiEnabled boolean
- if (evalMode.asInstanceOf[Boolean]) "ANSI" else "LEGACY"
- } else {
- // Spark 3.4+ has EvalMode enum with values LEGACY, ANSI, and TRY
- evalMode.toString
- }
- handleCast(child, inputs, dt, timeZoneId, evalModeStr)
+ case c @ Cast(child, dt, timeZoneId, _) =>
+ handleCast(child, inputs, dt, timeZoneId, evalMode(c))
+
+ case expr: Add if evalMode(expr) == CometEvalMode.ANSI && !cometAnsiEnabled =>
Review Comment:
Should we move these to be next to the corresponding supported implementations so new developers can discover this case easily?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1629469330
##########
spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala:
##########
@@ -69,7 +69,6 @@ abstract class CometTestBase
conf.set("spark.hadoop.fs.file.impl", classOf[DebugFilesystem].getName)
conf.set("spark.ui.enabled", "false")
conf.set(SQLConf.SHUFFLE_PARTITIONS, 10) // reduce parallelism in tests
- conf.set(SQLConf.ANSI_ENABLED.key, "false")
Review Comment:
We no longer explicitly disable ANSI in our test suites.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1628131201
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -578,6 +576,14 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
}
}
+ def evalModeToProto(evalMode: CometEvalMode.Value): ExprOuterClass.EvalMode = {
+ evalMode match {
+ case CometEvalMode.LEGACY => ExprOuterClass.EvalMode.LEGACY
+ case CometEvalMode.TRY => ExprOuterClass.EvalMode.TRY
+ case CometEvalMode.ANSI => ExprOuterClass.EvalMode.ANSI
Review Comment:
Good point. I have added this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "kazuyukitanimura (via GitHub)" <gi...@apache.org>.
kazuyukitanimura commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1628199998
##########
spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala:
##########
@@ -712,17 +712,6 @@ class CometSparkSessionExtensions
}
override def apply(plan: SparkPlan): SparkPlan = {
- // DataFusion doesn't have ANSI mode. For now we just disable CometExec if ANSI mode is
- // enabled.
- if (isANSIEnabled(conf)) {
- if (COMET_ANSI_MODE_ENABLED.get()) {
- logWarning("Using Comet's experimental support for ANSI mode.")
- } else {
- logInfo("Comet extension disabled for ANSI mode")
- return plan
- }
- }
Review Comment:
For Spark 3.x, I feel we still need this protection in case users enable ANSI mode as well as native execution.
If I understand correctly we have not set up CI yet with ANSI enabled.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1629447204
##########
spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala:
##########
@@ -712,17 +712,6 @@ class CometSparkSessionExtensions
}
override def apply(plan: SparkPlan): SparkPlan = {
- // DataFusion doesn't have ANSI mode. For now we just disable CometExec if ANSI mode is
- // enabled.
- if (isANSIEnabled(conf)) {
- if (COMET_ANSI_MODE_ENABLED.get()) {
- logWarning("Using Comet's experimental support for ANSI mode.")
- } else {
- logInfo("Comet extension disabled for ANSI mode")
- return plan
- }
- }
Review Comment:
> If I understand correctly we have not set up CI yet with ANSI enabled.
Well, we have the Spark 4 tests where ANSI is enabled and that is catching issues for sure.
I noticed that we were explicitly disabling ANSI mode in CometTestBase and I have removed that so we use the default ANSI mode for whatever Spark version we are running against. This should mean that all of our unit tests will now run with ANSI enabled when running against Spark 4+. Let's see how many issues this finds 😰
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove closed pull request #509: chore: Make ANSI fallback more granular
URL: https://github.com/apache/datafusion-comet/pull/509
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1631456108
##########
spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala:
##########
@@ -712,17 +712,6 @@ class CometSparkSessionExtensions
}
override def apply(plan: SparkPlan): SparkPlan = {
- // DataFusion doesn't have ANSI mode. For now we just disable CometExec if ANSI mode is
- // enabled.
- if (isANSIEnabled(conf)) {
- if (COMET_ANSI_MODE_ENABLED.get()) {
- logWarning("Using Comet's experimental support for ANSI mode.")
- } else {
- logInfo("Comet extension disabled for ANSI mode")
- return plan
- }
- }
Review Comment:
Sure. I have moved this to draft for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1628307927
##########
spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala:
##########
@@ -712,17 +712,6 @@ class CometSparkSessionExtensions
}
override def apply(plan: SparkPlan): SparkPlan = {
- // DataFusion doesn't have ANSI mode. For now we just disable CometExec if ANSI mode is
- // enabled.
- if (isANSIEnabled(conf)) {
- if (COMET_ANSI_MODE_ENABLED.get()) {
- logWarning("Using Comet's experimental support for ANSI mode.")
- } else {
- logInfo("Comet extension disabled for ANSI mode")
- return plan
- }
- }
Review Comment:
This current check will make all plans fall back to Spark if ANSI is enabled, so no native plans will run, unless `COMET_ANSI_MODE_ENABLED` is enabled.
The changes in this PR mean that we still have the same check but only if the plan actually contains any expressions that would be affected by enabling ANSI support and we still fall back to Spark by default unless `COMET_ANSI_MODE_ENABLED` is enabled.
The main risk with this PR is if we don't have the complete list of expressions that support ANSI mode.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#issuecomment-2148451594
I am looking into the test failures:
```
2024-06-04T17:46:08.5118601Z [info] - SPARK-39175: Query context of Cast should be serialized to executors when WSCG is off *** FAILED *** (168 milliseconds)
2024-06-04T17:47:32.8159859Z [info] - postgreSQL/float8.sql *** FAILED *** (2 seconds, 108 milliseconds)
2024-06-04T17:47:37.1749187Z [info] - postgreSQL/groupingsets.sql *** FAILED *** (4 seconds, 331 milliseconds)
2024-06-04T18:04:31.0221492Z [info] *** 3 TESTS FAILED ***
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1629506633
##########
spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala:
##########
@@ -712,17 +712,6 @@ class CometSparkSessionExtensions
}
override def apply(plan: SparkPlan): SparkPlan = {
- // DataFusion doesn't have ANSI mode. For now we just disable CometExec if ANSI mode is
- // enabled.
- if (isANSIEnabled(conf)) {
- if (COMET_ANSI_MODE_ENABLED.get()) {
- logWarning("Using Comet's experimental support for ANSI mode.")
- } else {
- logInfo("Comet extension disabled for ANSI mode")
- return plan
- }
- }
Review Comment:
> If I understand correctly we have not set up CI yet with ANSI enabled.
It would be good to add a CI pipeline for Spark 3.4 with ANSI enabled.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#issuecomment-2150842134
This is a pretty interesting test failure:
```
- postgreSQL/groupingsets.sql *** FAILED *** (4 seconds, 331 milliseconds)
postgreSQL/groupingsets.sql
Expected "... 1 128
NULL 1 1 0 1 [1
NULL 1 1 0 1 2
NULL 2 1 0 1 4
NULL 2 1 0 1 8
NULL 2 1 0 1 16
NULL 2 1 0 1 32
NULL 1 1 0 1 64
NULL 1 1 0 1 128]", but got "... 1 128
NULL 1 1 0 1 [-1673396112
NULL 2 1 0 1 -1673198320
NULL 2 1 0 1 -596264016
NULL 1 1 0 1 -596231120
NULL 1 1 0 2 65102
NULL 2 1 0 2 65102]"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "kazuyukitanimura (via GitHub)" <gi...@apache.org>.
kazuyukitanimura commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1630778450
##########
spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala:
##########
@@ -712,17 +712,6 @@ class CometSparkSessionExtensions
}
override def apply(plan: SparkPlan): SparkPlan = {
- // DataFusion doesn't have ANSI mode. For now we just disable CometExec if ANSI mode is
- // enabled.
- if (isANSIEnabled(conf)) {
- if (COMET_ANSI_MODE_ENABLED.get()) {
- logWarning("Using Comet's experimental support for ANSI mode.")
- } else {
- logInfo("Comet extension disabled for ANSI mode")
- return plan
- }
- }
Review Comment:
I am close to finish my PR to enable the spark tests with Spark 4.0 I.e. ANSI enabled, and I am disabling expressions that failed those tests with ANSI enabled.
I would propose to hold this part of change for now. Perhaps after we fix all Spark 4.0 issues, we can backport the learning to Spark 3.4
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Make ANSI fallback more granular [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #509:
URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1631442398
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -701,17 +695,17 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
case UnaryExpression(child) if expr.prettyName == "trycast" =>
val timeZoneId = SQLConf.get.sessionLocalTimeZone
- handleCast(child, inputs, expr.dataType, Some(timeZoneId), "TRY")
+ handleCast(child, inputs, expr.dataType, Some(timeZoneId), CometEvalMode.TRY)
- case Cast(child, dt, timeZoneId, evalMode) =>
- val evalModeStr = if (evalMode.isInstanceOf[Boolean]) {
- // Spark 3.2 & 3.3 has ansiEnabled boolean
- if (evalMode.asInstanceOf[Boolean]) "ANSI" else "LEGACY"
- } else {
- // Spark 3.4+ has EvalMode enum with values LEGACY, ANSI, and TRY
- evalMode.toString
- }
- handleCast(child, inputs, dt, timeZoneId, evalModeStr)
+ case c @ Cast(child, dt, timeZoneId, _) =>
+ handleCast(child, inputs, dt, timeZoneId, evalMode(c))
+
+ case expr if isUnsupportedAnsiExpr(expr) && !CometConf.COMET_ANSI_MODE_ENABLED.get() =>
Review Comment:
Sure, let's remove this. It was intended as as short term workaround but I agree that we don't really need it now that we have this fallback logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org