Skip to content

Commit b45789d

Browse files
committed
feat: support concat
1 parent fa963bf commit b45789d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ object QueryPlanSerde extends Logging with CometExprShim {
164164
classOf[BitLength] -> CometScalarFunction("bit_length"),
165165
classOf[Chr] -> CometScalarFunction("char"),
166166
classOf[ConcatWs] -> CometScalarFunction("concat_ws"),
167+
classOf[Concat] -> CometScalarFunction("concat"),
167168
classOf[Contains] -> CometScalarFunction("contains"),
168169
classOf[EndsWith] -> CometScalarFunction("ends_with"),
169170
classOf[InitCap] -> CometInitCap,

spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3144,4 +3144,15 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
31443144
}
31453145
}
31463146

3147+
test("test concat function - strings") {
3148+
withTable("t1") {
3149+
sql(
3150+
"create table t1 using parquet as select uuid() c1, uuid() c2, uuid() c3, uuid() c4, cast(null as string) c5 from range(10)")
3151+
checkSparkAnswerAndOperator("select concat(c1, c2) AS x FROM t1")
3152+
checkSparkAnswerAndOperator("select concat(c1, c2, c3) AS x FROM t1")
3153+
checkSparkAnswerAndOperator("select concat(c1, c2, c3, c5) AS x FROM t1")
3154+
//checkSparkAnswerAndOperator("select concat(concat(c1, c2, c3), concat(c1, c3)) AS x FROM t1")
3155+
}
3156+
}
3157+
31473158
}

0 commit comments

Comments
 (0)