Skip to content

Commit

Permalink
lint and spark 4 shim
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Jun 3, 2024
1 parent 54032df commit 97959a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ trait CometExprShim {
}

object CometEvalModeUtil {
def fromSparkEvalMode(evalMode: EvalMode.Value) = evalMode match {
def fromSparkEvalMode(evalMode: EvalMode.Value): CometEvalMode.Value = evalMode match {
case EvalMode.LEGACY => CometEvalMode.LEGACY
case EvalMode.TRY => CometEvalMode.TRY
case EvalMode.ANSI => CometEvalMode.ANSI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.comet.shims

import org.apache.comet.expressions.CometEvalMode
import org.apache.spark.sql.catalyst.expressions._

/**
Expand All @@ -30,4 +31,18 @@ trait CometExprShim {
protected def unhexSerde(unhex: Unhex): (Expression, Expression) = {
(unhex.child, Literal(unhex.failOnError))
}

def evalMode(c: Cast): CometEvalMode.Value =
CometEvalModeUtil.fromSparkEvalMode(c.evalMode)

def evalMode(r: Round): CometEvalMode.Value = CometEvalMode.fromBoolean(r.ansiEnabled)

}

object CometEvalModeUtil {
def fromSparkEvalMode(evalMode: EvalMode.Value) = evalMode match {
case EvalMode.LEGACY => CometEvalMode.LEGACY
case EvalMode.TRY => CometEvalMode.TRY
case EvalMode.ANSI => CometEvalMode.ANSI
}
}

0 comments on commit 97959a9

Please sign in to comment.