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


##########
spark-doris-connector/spark-doris-connector-it/src/test/java/org/apache/doris/spark/sql/DorisReaderITCase.scala:
##########
@@ -601,4 +601,42 @@ class DorisReaderITCase(readMode: String, flightSqlPort: 
Int) extends AbstractCo
       session.stop()
     }
   }
+
+  @Test
+  def testDataFrameExpressionNotPushDown(): Unit = {
+    val sourceInitSql: Array[String] = 
ContainerUtils.parseFileContentSQL("container/ddl/read_filter_pushdown.sql")
+    ContainerUtils.executeSQLStatement(getDorisQueryConnection(DATABASE), LOG, 
sourceInitSql: _*)
+
+    val session = SparkSession.builder().master("local[*]").getOrCreate()
+    try {
+      val df = session.read
+        .format("doris")
+        .option("doris.fenodes", getFenodes)
+        .option("doris.table.identifier", DATABASE + "." + 
TABLE_READ_EXPRESSION_NOTPUSHDOWN)
+        .option("user", getDorisUsername)
+        .option("password", getDorisPassword)
+        .load()
+
+      import org.apache.spark.sql.functions._
+
+      // 将 select COALESCE(CAST(A4 AS STRING),'null')
+      // from test_source where COALESCE(CAST(A4 AS STRING),'null') in ('a4')
+      // 转换为DataFrame API

Review Comment:
   english comment



##########
spark-doris-connector/spark-doris-connector-it/src/test/java/org/apache/doris/spark/sql/DorisReaderITCase.scala:
##########
@@ -601,4 +601,42 @@ class DorisReaderITCase(readMode: String, flightSqlPort: 
Int) extends AbstractCo
       session.stop()
     }
   }
+
+  @Test
+  def testDataFrameExpressionNotPushDown(): Unit = {
+    val sourceInitSql: Array[String] = 
ContainerUtils.parseFileContentSQL("container/ddl/read_filter_pushdown.sql")
+    ContainerUtils.executeSQLStatement(getDorisQueryConnection(DATABASE), LOG, 
sourceInitSql: _*)
+
+    val session = SparkSession.builder().master("local[*]").getOrCreate()
+    try {
+      val df = session.read
+        .format("doris")
+        .option("doris.fenodes", getFenodes)
+        .option("doris.table.identifier", DATABASE + "." + 
TABLE_READ_EXPRESSION_NOTPUSHDOWN)
+        .option("user", getDorisUsername)
+        .option("password", getDorisPassword)
+        .load()
+
+      import org.apache.spark.sql.functions._
+
+      // 将 select COALESCE(CAST(A4 AS STRING),'null')
+      // from test_source where COALESCE(CAST(A4 AS STRING),'null') in ('a4')
+      // 转换为DataFrame API
+      val resultData = df.select(coalesce(col("A4").cast("string"), 
lit("null")).as("coalesced_A4"))
+        .filter(col("coalesced_A4").isin("a4"))
+
+      println(resultData.collect().toList.toString())
+      assert("List([a4], [a4], [a4], [a4], 
[a4])".equals(resultData.collect().toList.toString()))
+
+      // 将 select COALESCE(CAST(NAME AS STRING),'null')
+      // from test_source where COALESCE(CAST(NAME AS STRING),'null') in 
('name2')
+      // 转换为DataFrame API

Review Comment:
   english comment



-- 
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]

Reply via email to