-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21845] [SQL] Make codegen fallback of expressions configurable #19062
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,9 @@ abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging with Serializ | |
| @transient | ||
| final val sqlContext = SparkSession.getActiveSession.map(_.sqlContext).orNull | ||
|
|
||
| // whether we should fallback when hitting compilation errors caused by codegen | ||
| private val codeGenFallBack = sqlContext == null || sqlContext.conf.codegenFallback | ||
|
|
||
| protected def sparkContext = sqlContext.sparkContext | ||
|
|
||
| // sqlContext will be null when we are being deserialized on the slaves. In this instance | ||
|
|
@@ -370,8 +373,7 @@ abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging with Serializ | |
| try { | ||
| GeneratePredicate.generate(expression, inputSchema) | ||
| } catch { | ||
| case e @ (_: JaninoRuntimeException | _: CompileException) | ||
| if sqlContext == null || sqlContext.conf.wholeStageFallback => | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to put this comment in https://github.com/apache/spark/pull/19062/files#diff-b9f96d092fb3fea76bcf75e016799678R57?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing the null check here makes sense although this means existing spark jobs that were previously switching to the non-codegen version even with |
||
| case _ @ (_: JaninoRuntimeException | _: CompileException) if codeGenFallBack => | ||
| genInterpretedPredicate(expression, inputSchema) | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ object TestHive | |
| "TestSQLContext", | ||
| new SparkConf() | ||
| .set("spark.sql.test", "") | ||
| .set(SQLConf.CODEGEN_FALLBACK.key, "false") | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turn it false to ensure it does not hide the actual bugs of our expression codegen that causes compilation falure. |
||
| .set("spark.sql.hive.metastore.barrierPrefixes", | ||
| "org.apache.spark.sql.hive.execution.PairSerDe") | ||
| .set("spark.sql.warehouse.dir", TestHiveContext.makeWarehouseDir().toURI.getPath) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Is it better to add
!Utils.isTesting &&or to drop!Utils.isTesting &&fromWholeStageCodegenExecto make these conditions consistent?Uh oh!
There was an error while loading. Please reload this page.
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.
Originally, I did it like what you said. However, if using that approach, I need to remove the test case. Then, I think we might just keep using the
codegenFallbackfor controlling it.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.
I see