JNSimba commented on code in PR #284:
URL:
https://github.com/apache/doris-spark-connector/pull/284#discussion_r2006906063
##########
spark-doris-connector/spark-doris-connector-spark-3.5/src/main/scala/org/apache/doris/spark/read/expression/V2ExpressionBuilder.scala:
##########
@@ -55,6 +55,21 @@ class V2ExpressionBuilder(inValueLengthLimit: Int) {
case "<=" => s"`${build(e.children()(0))}` <=
${build(e.children()(1))}"
case ">" => s"`${build(e.children()(0))}` >
${build(e.children()(1))}"
case ">=" => s"`${build(e.children()(0))}` >=
${build(e.children()(1))}"
+ case "CASE_WHEN" =>
+ val fragment = new StringBuilder("CASE ")
+ val expressions = e.children()
+
+ for(i<- 0 until expressions.size - 1 by 2){
+ fragment.append(s" WHEN ${build(expressions(i))} THEN
${build(expressions(i+1))} ")
+ }
+
+ if (expressions.length % 2 != 0) {
+ val last = expressions(expressions.length - 1)
+ fragment.append(s" ELSE ${build(last)} ")
+ }
+ fragment.append(" END")
+
+ fragment.mkString
Review Comment:
Can you add a test for this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]