Skip to content
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

[CORE] Enable bit_length Spark function #5069

Merged
merged 4 commits into from
Mar 22, 2024
Merged
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 @@ -177,6 +177,7 @@ object CHExpressionUtil {
DATE_FROM_UNIX_DATE -> DefaultValidator(),
MONOTONICALLY_INCREASING_ID -> DefaultValidator(),
SPARK_PARTITION_ID -> DefaultValidator(),
SKEWNESS -> DefaultValidator()
SKEWNESS -> DefaultValidator(),
BIT_LENGTH -> DefaultValidator()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -515,27 +515,35 @@ class VeloxFunctionsValidateSuite extends VeloxWholeStageTransformerSuite {

test("regexp_replace") {
runQueryAndCompare(
"SELECT regexp_replace(l_partkey, '\\w', 'something') FROM lineitem limit 100") {
"SELECT regexp_replace(c_comment, '\\w', 'something') FROM customer limit 50") {
checkOperatorMatch[ProjectExecTransformer]
}
runQueryAndCompare(
"SELECT regexp_replace(l_partkey, '\\w', 'something', 3) FROM lineitem limit 100") {
"SELECT regexp_replace(c_comment, '\\w', 'something', 3) FROM customer limit 50") {
checkOperatorMatch[ProjectExecTransformer]
}
}

test("lag/lead window function with negative input offset") {
runQueryAndCompare(
"select lag(l_orderkey, -2) over" +
" (partition by l_suppkey order by l_orderkey) from lineitem ") {
" (partition by l_suppkey order by l_orderkey) from lineitem") {
checkOperatorMatch[WindowExecTransformer]
}

runQueryAndCompare(
"select lead(l_orderkey, -2) over" +
" (partition by l_suppkey order by l_orderkey) from lineitem ") {
" (partition by l_suppkey order by l_orderkey) from lineitem") {
checkOperatorMatch[WindowExecTransformer]
}
}

test("bit_length") {
runQueryAndCompare(
"select bit_length(c_comment), bit_length(cast(c_comment as binary))" +
" from customer limit 50") {
checkOperatorMatch[ProjectExecTransformer]
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ object ExpressionMappings {
Sig[StringDecode](DECODE),
Sig[Encode](ENCODE),
Sig[Uuid](UUID),
Sig[BitLength](BIT_LENGTH),

// URL functions
Sig[ParseUrl](PARSE_URL),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ object ExpressionNames {
final val DECODE = "decode"
final val ENCODE = "encode"
final val UUID = "uuid"
final val BIT_LENGTH = "bit_length"

// URL functions
final val PARSE_URL = "parse_url"
Expand Down
Loading