Skip to content

Commit

Permalink
[VL] Add support for spark_partition_id function (#4969)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyangxiaozhu authored Mar 19, 2024
1 parent 81b023e commit 91fb95d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ object CHExpressionUtil {
ARRAY_REPEAT -> DefaultValidator(),
DATE_FROM_UNIX_DATE -> DefaultValidator(),
MONOTONICALLY_INCREASING_ID -> DefaultValidator(),
SPARK_PARTITION_ID -> DefaultValidator(),
SKEWNESS -> DefaultValidator()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,14 @@ class VeloxFunctionsValidateSuite extends VeloxWholeStageTransformerSuite {

test("Test monotonically_increasing_id function") {
runQueryAndCompare("""SELECT monotonically_increasing_id(), l_orderkey
| from lineitem limit 1""".stripMargin) {
| from lineitem limit 100""".stripMargin) {
checkOperatorMatch[ProjectExecTransformer]
}
}

test("Test spark_partition_id function") {
runQueryAndCompare("""SELECT spark_partition_id(), l_orderkey
| from lineitem limit 100""".stripMargin) {
checkOperatorMatch[ProjectExecTransformer]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ object ExpressionMappings {
Sig[MakeDecimal](MAKE_DECIMAL),
Sig[PromotePrecision](PROMOTE_PRECISION),
Sig[MonotonicallyIncreasingID](MONOTONICALLY_INCREASING_ID),
Sig[SparkPartitionID](SPARK_PARTITION_ID),
// Decimal
Sig[UnscaledValue](UNSCALED_VALUE)
) ++ SparkShimLoader.getSparkShims.expressionMappings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ object ExpressionNames {
final val CHECK_OVERFLOW = "check_overflow"
final val MAKE_DECIMAL = "make_decimal"
final val PROMOTE_PRECISION = "promote_precision"
final val SPARK_PARTITION_ID = "spark_partition_id"
final val MONOTONICALLY_INCREASING_ID = "monotonically_increasing_id"

// Directly use child expression transformer
Expand Down

0 comments on commit 91fb95d

Please sign in to comment.