Skip to content

Commit

Permalink
refactor: rename to CometExprShim and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tshauck committed May 3, 2024
1 parent 97eae4b commit a378f74
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ import org.apache.comet.CometSparkSessionExtensions.{isCometOperatorEnabled, isC
import org.apache.comet.serde.ExprOuterClass.{AggExpr, DataType => ProtoDataType, Expr, ScalarFunc}
import org.apache.comet.serde.ExprOuterClass.DataType.{DataTypeInfo, DecimalInfo, ListInfo, MapInfo, StructInfo}
import org.apache.comet.serde.OperatorOuterClass.{AggregateMode => CometAggregateMode, JoinType, Operator}
import org.apache.comet.shims.ShimCometExpr
import org.apache.comet.shims.CometExprShim
import org.apache.comet.shims.ShimQueryPlanSerde

/**
* An utility object for query plan and expression serialization.
*/
object QueryPlanSerde extends Logging with ShimQueryPlanSerde with ShimCometExpr {
object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim {
def emitWarning(reason: String): Unit = {
logWarning(s"Comet native execution is disabled due to: $reason")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ package org.apache.comet.shims
import org.apache.spark.sql.catalyst.expressions._

/**
* `ShimCometExpr` parses the `Unhex` expression assuming that the catalyst version is 3.2.x.
* `CometExprShim` acts as a shim for for parsing expressions from different Spark versions.
*/
trait ShimCometExpr {
trait CometExprShim {
/**
* Returns a tuple of expressions for the `unhex` function.
*/
def unhexSerde(unhex: Unhex): (Expression, Expression) = {
(unhex.child, Literal(false))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ package org.apache.comet.shims
import org.apache.spark.sql.catalyst.expressions._

/**
* `ShimCometExpr` parses the `Unhex` expression assuming that the catalyst version is 3.3.x.
* `CometExprShim` acts as a shim for for parsing expressions from different Spark versions.
*/
trait ShimCometExpr {
trait CometExprShim {
/**
* Returns a tuple of expressions for the `unhex` function.
*/
def unhexSerde(unhex: Unhex): (Expression, Expression) = {
(unhex.child, Literal(false))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ package org.apache.comet.shims
import org.apache.spark.sql.catalyst.expressions._

/**
* `ShimCometExpr` parses the `Unhex` expression assuming that the catalyst version is 3.4.x.
* `CometExprShim` acts as a shim for for parsing expressions from different Spark versions.
*/
trait ShimCometExpr {
trait CometExprShim {
/**
* Returns a tuple of expressions for the `unhex` function.
*/
def unhexSerde(unhex: Unhex): (Expression, Expression) = {
(unhex.child, Literal(unhex.failOnError))
}
Expand Down

0 comments on commit a378f74

Please sign in to comment.