Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ object CHExpressionUtil {
MAKE_DATE -> DefaultValidator(),
ARRAY_APPEND -> DefaultValidator(),
JSON_OBJECT_KEYS -> DefaultValidator(),
LUHN_CHECK -> DefaultValidator()
LUHN_CHECK -> DefaultValidator(),
DIV -> DefaultValidator()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,15 @@ class ArithmeticAnsiValidateSuite extends FunctionsValidateSuite {
}
}

test("div") {
runQueryAndCompare("SELECT int_field1 div 2 FROM datatab WHERE int_field1 IS NOT NULL") {
checkGlutenOperatorMatch[ProjectExecTransformer]
}
if (isSparkVersionGE("3.4")) {
intercept[SparkException] {
sql("SELECT 1 div 0 ").collect()
}
}
}

}
2 changes: 1 addition & 1 deletion ep/build-velox/src/get_velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

set -exu

VELOX_REPO=https://github.com/oap-project/velox.git
VELOX_REPO=https://github.com/zhli1142015/velox.git
VELOX_BRANCH=2025_09_23
VELOX_HOME=""
RUN_SETUP_SCRIPT=ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,14 @@ object ExpressionConverter extends SQLConfHelper with Logging {
a,
ExpressionNames.CHECKED_DIVIDE
)
case i: IntegralDivide =>
BackendsApiManager.getSparkPlanExecApiInstance.genArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformer0(i.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformer0(i.right, attributeSeq, expressionsMap),
i,
ExpressionNames.CHECKED_DIV
)
case tryEval: TryEval =>
// This is a placeholder to handle try_eval(other expressions).
BackendsApiManager.getSparkPlanExecApiInstance.genTryEvalTransformer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ object ExpressionMappings {
Sig[Subtract](SUBTRACT),
Sig[Multiply](MULTIPLY),
Sig[Divide](DIVIDE),
Sig[IntegralDivide](DIV),
Sig[UnaryPositive](POSITIVE),
Sig[UnaryMinus](NEGATIVE),
Sig[And](AND),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ object ExpressionNames {
final val ADD = "add"
final val SUBTRACT = "subtract"
final val MULTIPLY = "multiply"
final val DIV = "div"
final val DIVIDE = "divide"
final val POSITIVE = "positive"
final val NEGATIVE = "negative"
Expand Down Expand Up @@ -91,6 +92,7 @@ object ExpressionNames {
final val CHECKED_SUBTRACT = "checked_subtract"
final val CHECKED_DIVIDE = "checked_divide"
final val CHECKED_MULTIPLY = "checked_multiply"
final val CHECKED_DIV = "checked_div"

// SparkSQL String functions
final val ASCII = "ascii"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ class Spark34Shims extends SparkShims {
case s: Subtract => s.evalMode == EvalMode.ANSI
case d: Divide => d.evalMode == EvalMode.ANSI
case m: Multiply => m.evalMode == EvalMode.ANSI
case i: IntegralDivide => i.evalMode == EvalMode.ANSI
case _ => false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ class Spark35Shims extends SparkShims {
case s: Subtract => s.evalMode == EvalMode.ANSI
case d: Divide => d.evalMode == EvalMode.ANSI
case m: Multiply => m.evalMode == EvalMode.ANSI
case i: IntegralDivide => i.evalMode == EvalMode.ANSI
case _ => false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ class Spark40Shims extends SparkShims {
case s: Subtract => s.evalMode == EvalMode.ANSI
case d: Divide => d.evalMode == EvalMode.ANSI
case m: Multiply => m.evalMode == EvalMode.ANSI
case i: IntegralDivide => i.evalMode == EvalMode.ANSI
case _ => false
}
}
Expand Down
Loading