JNSimba commented on code in PR #299:
URL: 
https://github.com/apache/doris-spark-connector/pull/299#discussion_r2018242766


##########
spark-doris-connector/spark-doris-connector-it/src/test/java/org/apache/doris/spark/sql/DorisReaderITCase.scala:
##########
@@ -424,4 +424,43 @@ class DorisReaderITCase(readMode: String, flightSqlPort: 
Int) extends AbstractCo
     assert("List([3])".equals(likeFilter.toList.toString()))
     session.stop()
   }
+
+
+  @Test
+  def buildCaseWhenTest(): Unit = {
+    val sourceInitSql: Array[String] = 
ContainerUtils.parseFileContentSQL("container/ddl/read_all_type.sql")
+    ContainerUtils.executeSQLStatement(getDorisQueryConnection(DATABASE), LOG, 
sourceInitSql: _*)
+
+    val session = SparkSession.builder().master("local[*]").getOrCreate()
+
+    session.sql(
+      s"""
+         |CREATE TEMPORARY VIEW test_source
+         |USING doris
+         |OPTIONS(
+         | "table.identifier"="${DATABASE + "." + TABLE_READ_TBL_ALL_TYPES}",
+         | "fenodes"="${getFenodes}",
+         | "user"="${getDorisUsername}",
+         | "password"="${getDorisPassword}",
+         | "doris.read.mode"="${readMode}",
+         | "doris.read.arrow-flight-sql.port"="${flightSqlPort}"
+         |)
+         |""".stripMargin)
+
+    val resultData = session.sql(
+      """
+        |select * from (
+        |   select
+        |    id,
+        |    (case when c5 > 10 then c2 else null end) as cc1,
+        |    (case when c4 < 5 then c3 else null end) as cc2
+        |   from test_source where c2 is not null
+        |) where !(cc1 is null and cc2 is null)
+        |""".stripMargin)

Review Comment:
   It is recommended to add an orderby



##########
spark-doris-connector/spark-doris-connector-it/src/test/java/org/apache/doris/spark/sql/DorisReaderITCase.scala:
##########
@@ -424,4 +424,43 @@ class DorisReaderITCase(readMode: String, flightSqlPort: 
Int) extends AbstractCo
     assert("List([3])".equals(likeFilter.toList.toString()))
     session.stop()
   }
+
+
+  @Test
+  def buildCaseWhenTest(): Unit = {
+    val sourceInitSql: Array[String] = 
ContainerUtils.parseFileContentSQL("container/ddl/read_all_type.sql")
+    ContainerUtils.executeSQLStatement(getDorisQueryConnection(DATABASE), LOG, 
sourceInitSql: _*)
+
+    val session = SparkSession.builder().master("local[*]").getOrCreate()
+
+    session.sql(
+      s"""
+         |CREATE TEMPORARY VIEW test_source
+         |USING doris
+         |OPTIONS(
+         | "table.identifier"="${DATABASE + "." + TABLE_READ_TBL_ALL_TYPES}",
+         | "fenodes"="${getFenodes}",
+         | "user"="${getDorisUsername}",
+         | "password"="${getDorisPassword}",
+         | "doris.read.mode"="${readMode}",
+         | "doris.read.arrow-flight-sql.port"="${flightSqlPort}"
+         |)
+         |""".stripMargin)
+
+    val resultData = session.sql(
+      """
+        |select * from (
+        |   select
+        |    id,
+        |    (case when c5 > 10 then c2 else null end) as cc1,
+        |    (case when c4 < 5 then c3 else null end) as cc2
+        |   from test_source where c2 is not null
+        |) where !(cc1 is null and cc2 is null)
+        |""".stripMargin)

Review Comment:
   It is recommended to add an order by id



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to