-
Notifications
You must be signed in to change notification settings - Fork 235
feat: Add dynamic enabled
and allowIncompat
configs for all supported expressions
#2329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2329 +/- ##
============================================
+ Coverage 56.12% 57.66% +1.53%
- Complexity 976 1297 +321
============================================
Files 119 147 +28
Lines 11743 13523 +1780
Branches 2251 2390 +139
============================================
+ Hits 6591 7798 +1207
- Misses 4012 4457 +445
- Partials 1140 1268 +128 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
val COMET_EXEC_INITCAP_ENABLED: ConfigEntry[Boolean] = | ||
createExecEnabledConfig("initCap", defaultValue = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InitCap
is an expression, not an exec, so this was always confusing
enabled
and allowIncompat
configs for all supported expressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
def isExprEnabled(name: String, conf: SQLConf = SQLConf.get): Boolean = { | ||
val key = getExprEnabledConfigKey(name) | ||
// all expressions are enabled by default | ||
if (conf.contains(key)) { | ||
conf.getConfString(key) == "true" | ||
} else { | ||
true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def isExprEnabled(name: String, conf: SQLConf = SQLConf.get): Boolean = { | |
val key = getExprEnabledConfigKey(name) | |
// all expressions are enabled by default | |
if (conf.contains(key)) { | |
conf.getConfString(key) == "true" | |
} else { | |
true | |
} | |
} | |
def isExprEnabled(name: String, conf: SQLConf = SQLConf.get): Boolean = { | |
val key = getExprEnabledConfigKey(name) | |
conf.getConfString(key, "true").toLowerCase match { | |
case "false" => false | |
case _ => true | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I incorporated the feedback.
def isExprAllowIncompat(name: String, conf: SQLConf = SQLConf.get): Boolean = { | ||
val key = getExprAllowIncompatConfigKey(name) | ||
conf.contains(key) && conf.getConfString(key) == "true" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def isExprAllowIncompat(name: String, conf: SQLConf = SQLConf.get): Boolean = { | |
val key = getExprAllowIncompatConfigKey(name) | |
conf.contains(key) && conf.getConfString(key) == "true" | |
} | |
def isExprAllowIncompat(name: String, conf: SQLConf = SQLConf.get): Boolean = { | |
isExprEnabled(name) | |
} |
?
I am working on adding more tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but it did make me wonder if we could meaningfully turn off the Literal
expression. There are some cases where we hard-code instantiating them to support other expressions. That one almost doesn't make sense to be allowed to turn off, since you'd probably be turning off Comet at that point.
…rted expressions (apache#2329)
Which issue does this PR close?
Part of #2344
Rationale for this change
There are two motivations for this PR:
length
andto_pretty_string
. We need to give users a way to disable these expressions so that Comet falls back to Spark rather than causing errors or producing incorrect results.spark.comet.expression.allowIncompatible
which enables all incompatible expressions, not just the specific one that they want to enable.What changes are included in this PR?
Look for new configs per expression, such as:
spark.comet.expression.ArrayUnion.enabled
spark.comet.expression.ArrayUnion.allowIncompatible
The expression name is the Spark expression class name, as documented in the supported expressions page.
Note that this mechanis will not work for the following expressions, because they have not yet been moved to the new serde framework:
How are these changes tested?