squito commented on a change in pull request #27872: [SPARK-31115][SQL] Provide
config to avoid using switch statement in generated code to avoid Janino bug
URL: https://github.com/apache/spark/pull/27872#discussion_r391133288
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
##########
@@ -454,7 +454,9 @@ case class InSet(child: Expression, hset: Set[Any])
extends UnaryExpression with
}
override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
- if (canBeComputedUsingSwitch && hset.size <=
SQLConf.get.optimizerInSetSwitchThreshold) {
+ val sqlConf = SQLConf.get
+ if (canBeComputedUsingSwitch && hset.size <=
sqlConf.optimizerInSetSwitchThreshold &&
+ sqlConf.codegenUseSwitchStatement) {
Review comment:
instead of an added configuration, could this be a `try / catch`? first try
with switch, if it fails, then log an error and use if-else? avoids the users
having to set a config, and then unset it again when we have the right fix from
janino
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]