You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/11/16 01:46:56 UTC

[GitHub] [spark] wangyum commented on a change in pull request #30380: [SPARK-27421][SQL] Fix filter for int column and value class java.lang.String when pruning partition column

wangyum commented on a change in pull request #30380:
URL: https://github.com/apache/spark/pull/30380#discussion_r523855212



##########
File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/client/HivePartitionFilteringSuite.scala
##########
@@ -272,6 +272,13 @@ class HivePartitionFilteringSuite(version: String)
       day1 :: day2 :: Nil)
   }
 
+  test("getPartitionsByFilter: chunk in ('ab', 'ba') and ((cast(ds as string)>'20170102')") {
+    val day = (20170101 to 20170103, 0 to 4, Seq("ab", "ba"))
+    testMetastorePartitionFiltering(
+      attr("chunk").in("ab", "ba") && (attr("ds").cast(StringType) > "20170102"),

Review comment:
       It is the same because we didn't pruning it:
   ```diff
   diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/HivePartitionFilteringSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/HivePartitionFilteringSuite.scala
   index 7e10d49..6b976d9 100644
   --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/HivePartitionFilteringSuite.scala
   +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/HivePartitionFilteringSuite.scala
   @@ -28,7 +28,7 @@ import org.apache.spark.sql.catalyst.TableIdentifier
    import org.apache.spark.sql.catalyst.catalog._
    import org.apache.spark.sql.catalyst.dsl.expressions._
    import org.apache.spark.sql.catalyst.expressions._
   -import org.apache.spark.sql.types.{BooleanType, IntegerType, LongType, StructType}
   +import org.apache.spark.sql.types.{BooleanType, IntegerType, LongType, StringType, StructType}
    import org.apache.spark.util.Utils
   
    class HivePartitionFilteringSuite(version: String)
   @@ -272,6 +272,15 @@ class HivePartitionFilteringSuite(version: String)
          day1 :: day2 :: Nil)
      }
   
   +
   +  test("getPartitionsByFilter: chunk in ('ab', 'ba') and " +
   +    "((cast(ds as string)='20170101') or (cast(ds as string)='20170102'))") {
   +    val day = (20170101 to 20170103, 0 to 4, Seq("ab", "ba"))
   +    testMetastorePartitionFiltering(attr("chunk").in("ab", "ba") &&
   +      (attr("ds").cast(StringType) > "20170102.1234"),
   +      day :: Nil)
   +  }
   +
   ```




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org