This is an automated email from the ASF dual-hosted git repository.

zhangzc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 947f28a7a  [CH] Add Compatibility test found by internal (#5882)
947f28a7a is described below

commit 947f28a7aab150f159f3277928a39bd84f1bc9e1
Author: Chang chen <[email protected]>
AuthorDate: Tue May 28 14:05:07 2024 +0800

     [CH] Add Compatibility test found by internal (#5882)
    
    Add Compatibility test found by internal
---
 .../gluten/compatibility/GlutenFunctionSuite.scala | 111 +++++++++++++++++++++
 1 file changed, 111 insertions(+)

diff --git 
a/backends-clickhouse/src/test/scala/org/apache/spark/sql/gluten/compatibility/GlutenFunctionSuite.scala
 
b/backends-clickhouse/src/test/scala/org/apache/spark/sql/gluten/compatibility/GlutenFunctionSuite.scala
new file mode 100644
index 000000000..d0e13b496
--- /dev/null
+++ 
b/backends-clickhouse/src/test/scala/org/apache/spark/sql/gluten/compatibility/GlutenFunctionSuite.scala
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.spark.sql.gluten.compatibility
+
+import org.apache.gluten.execution.GlutenClickHouseWholeStageTransformerSuite
+import org.apache.gluten.utils.UTSystemParameters
+
+import org.apache.spark.internal.Logging
+import org.apache.spark.sql.gluten.test.GlutenSQLTestUtils
+
+class GlutenFunctionSuite
+  extends GlutenClickHouseWholeStageTransformerSuite
+  with GlutenSQLTestUtils
+  with Logging {
+
+  override protected val fileFormat: String = "parquet"
+  private val testPath: String = 
s"${UTSystemParameters.testDataPath}/$fileFormat/function"
+
+  case class TestCase(
+      name: String,
+      sql: String,
+      ignore: Boolean = false
+  )
+
+  private val testCase = Seq(
+    TestCase(
+      "left",
+      s"""|select
+          |    left(`99`, 2)
+          |  , left(`100`, 3)
+          |  , left(`101`, 4)
+          |  , left(`101`, 0)
+          |  , left(`101`, -1)  -- error
+          | from parquet.`$testPath/left`
+          |""".stripMargin,
+      ignore = true
+    ),
+    TestCase(
+      "trim",
+      s"""|select
+          |    trim(both ' ' from `99`)
+          |  , trim(LEADING `100` from `99`) -- error
+          |  , trim(TRAILING `100` from `99`)  -- error
+          | from parquet.`$testPath/left`
+          |""".stripMargin,
+      ignore = true
+    ),
+    TestCase(
+      "date_format 1",
+      s"""|select
+          |   `0`
+          |  , date_format(`0`, 'y')
+          |  , date_format(`0`, 'M')
+          |  , date_format(`0`, 'D') -- error timezone related issue
+          |  , date_format(`0`, 'd')
+          |  , date_format(`0`, 'H')
+          |  , date_format(`0`, 'h')
+          |  , date_format(`0`, 'm')
+          |  , date_format(`0`, 's')
+          | from parquet.`$testPath/date_format/date`
+          |""".stripMargin,
+      ignore = true
+    ),
+    TestCase(
+      "date_format 2",
+      s"""|select
+          |   `4`
+          |  , date_format(`4`, 'y')
+          |  , date_format(`4`, 'M')
+          |  , date_format(`4`, 'D') -- error timezone related issue
+          |  , date_format(`4`, 'd')
+          |  , date_format(`4`, 'H')
+          |  , date_format(`4`, 'h')
+          |  , date_format(`4`, 'm')
+          |  , date_format(`4`, 's')
+          | from parquet.`$testPath/date_format/timestamp`
+          |""".stripMargin,
+      ignore = true
+    )
+  )
+
+  testCase.foreach {
+    data =>
+      if (data.ignore) {
+        ignore(s"${data.name}") {}
+      } else {
+        test(s"${data.name}") {
+          compareResultsAgainstVanillaSpark(
+            data.sql,
+            compareResult = true,
+            { _ => }
+          )
+        }
+      }
+  }
+
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to