fix: gate case conversion on standard per-expression allowIncompatible#4853
Open
andygrove wants to merge 1 commit into
Open
fix: gate case conversion on standard per-expression allowIncompatible#4853andygrove wants to merge 1 commit into
andygrove wants to merge 1 commit into
Conversation
CometCaseConversionBase (parent of upper/lower) gated its native opt-in on the bespoke spark.comet.caseConversion.enabled config, while its sibling CometInitCap already uses the standard per-expression allowIncompatible flow. This asymmetry meant users who set spark.comet.expression.Upper.allowIncompatible=true saw no effect. Switch upper/lower to isExprAllowIncompat/getExprAllowIncompatConfigKey and remove the now-redundant COMET_CASE_CONVERSION_ENABLED config, so both paths report support level and gate opt-in the same way. Regenerate the affected COMET-INFO plan hints in the tpcds plan-stability goldens. Closes apache#4467
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #4467.
Rationale for this change
CometCaseConversionBase(the parent ofCometUpperandCometLower) gated its native opt-in on the bespokespark.comet.caseConversion.enabledconfig, while its siblingCometInitCapalready uses the standard per-expressionallowIncompatibleflow. This asymmetry was confusing: a user who set the standardspark.comet.expression.Upper.allowIncompatible=true(orLower) saw no effect, because upper/lower were reading a different, bespoke flag.Since #4721, the default path for upper/lower is already Spark-compatible via the JVM codegen dispatcher, with the native scalar function offered as a faster opt-in. The only remaining inconsistency was which config key drives that opt-in. This PR aligns upper/lower with initcap so both report support level and gate the opt-in through the same standard per-expression mechanism.
What changes are included in this PR?
CometCaseConversionBasenow gates onCometConf.isExprAllowIncompat(getExprConfigName(expr))and surfaces the opt-in viagetExprAllowIncompatConfigKey(...), matchingCometInitCap. ThenativeOptInConfigKeyOverrideoverride is dropped, so upper/lower usespark.comet.expression.Upper.allowIncompatibleandspark.comet.expression.Lower.allowIncompatible.COMET_CASE_CONVERSION_ENABLED(spark.comet.caseConversion.enabled) config, whose original premise (disabling upper/lower by default) no longer holds now that the default path is Spark-compatible.Upper[COMET-INFO]opt-in hint in the affected tpcds plan-stability goldens (q24a, q24b, q24) to reference the new config key.How are these changes tested?
upper/lowerSQL file tests (upper.sql,upper_enabled.sql,lower.sql,lower_enabled.sql). The_enabledfixtures were already written against the standardspark.comet.expression.{Upper,Lower}.allowIncompatiblekey and now actually exercise the native opt-in path.CometExpressionSuitetest asserting the EXPLAIN opt-in hint referencesspark.comet.expression.Upper.allowIncompatible.