-
Notifications
You must be signed in to change notification settings - Fork 236
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
Fix Cloudera 3.3.2 shim for handling CheckOverflowInTableInsert and orc zstd support #9463
Conversation
zstd with orc on cdh Signed-off-by: Thomas Graves <[email protected]>
build |
override def getDataWriteCmds: Map[Class[_ <: DataWritingCommand], | ||
DataWritingCommandRule[_ <: DataWritingCommand]] = { | ||
Seq(GpuOverrides.dataWriteCmd[CreateDataSourceTableAsSelectCommand]( | ||
"Create table with select command", | ||
(a, conf, p, r) => new CreateDataSourceTableAsSelectCommandMeta(a, conf, p, r)) | ||
).map(r => (r.getClassFor.asSubclass(classOf[DataWritingCommand]), r)).toMap | ||
} | ||
|
||
override def getRunnableCmds: Map[Class[_ <: RunnableCommand], | ||
RunnableCommandRule[_ <: RunnableCommand]] = { | ||
Map.empty | ||
} | ||
|
||
override def getExecs: Map[Class[_ <: SparkPlan], ExecRule[_ <: SparkPlan]] = { | ||
|
||
val newRule = org.apache.spark.sql.hive.cdh.HiveOverrides.getHiveTableExecRule() | ||
// scala compiler gets confused if we don't give an explicit type to the class here. | ||
// ... perhaps there is a cleaner way to do this | ||
val ruleClass: Class[_ <: SparkPlan] = newRule.getClassFor.asSubclass(classOf[SparkPlan]) | ||
super.getExecs ++ Seq(ruleClass -> newRule).toMap | ||
} |
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.
The three methods in the body of SparkShimImpl for 330cdh and 332cdh are identical.
We could have another trait
/*** spark-rapids-shim-json-lines
{"spark": "330cdh"}
{"spark": "332cdh"}
spark-rapids-shim-json-lines ***/
package com.nvidia.spark.rapids.shims
trait Spark33cdhShims extends AnsiCastRuleShims {
override def getDataWriteCmds: Map[Class[_ <: DataWritingCommand],
DataWritingCommandRule[_ <: DataWritingCommand]] = {
Seq(GpuOverrides.dataWriteCmd[CreateDataSourceTableAsSelectCommand](
"Create table with select command",
(a, conf, p, r) => new CreateDataSourceTableAsSelectCommandMeta(a, conf, p, r))
).map(r => (r.getClassFor.asSubclass(classOf[DataWritingCommand]), r)).toMap
}
override def getRunnableCmds: Map[Class[_ <: RunnableCommand],
RunnableCommandRule[_ <: RunnableCommand]] = {
Map.empty
}
override def getExecs: Map[Class[_ <: SparkPlan], ExecRule[_ <: SparkPlan]] = {
val newRule = org.apache.spark.sql.hive.cdh.HiveOverrides.getHiveTableExecRule()
// scala compiler gets confused if we don't give an explicit type to the class here.
// ... perhaps there is a cleaner way to do this
val ruleClass: Class[_ <: SparkPlan] = newRule.getClassFor.asSubclass(classOf[SparkPlan])
super.getExecs ++ Seq(ruleClass -> newRule).toMap
}
}
for 330cdh object SparkShimImpl extends Spark330PlusNonDBShims with Spark33cdhShims
for 332cdh object SparkShimImpl extends Spark331PlusShims with Spark33cdhShims
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.
updated but slightly differently to deal with calling super.getExecs from trait
build |
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
fixes #9457
We had some unit tests failing on 3.3.2 CDH. It looks like there are 2 issues: