Skip to content

Commit 752eb8d

Browse files
committed
Fix
1 parent ce5f0d1 commit 752eb8d

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

sql/hive/src/test/scala/org/apache/spark/sql/hive/client/FiltersSuite.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import org.apache.spark.sql.catalyst.expressions._
3030
import org.apache.spark.sql.catalyst.plans.PlanTest
3131
import org.apache.spark.sql.internal.SQLConf
3232
import org.apache.spark.sql.types._
33+
import org.apache.spark.unsafe.types.UTF8String
3334

3435
/**
3536
* A set of tests for the filter conversion logic used when pushing partition pruning into the
@@ -82,6 +83,10 @@ class FiltersSuite extends SparkFunSuite with Logging with PlanTest {
8283
(a("datecol", DateType) === Literal(null)) :: Nil,
8384
"")
8485

86+
filterTest("string filter with InSet predicate",
87+
InSet(a("strcol", StringType), Set("1", "2").map(s => UTF8String.fromString(s))) :: Nil,
88+
"(strcol = \"1\" or strcol = \"2\")")
89+
8590
filterTest("skip varchar",
8691
(Literal("") === a("varchar", StringType)) :: Nil,
8792
"")

sql/hive/src/test/scala/org/apache/spark/sql/hive/client/HivePartitionFilteringSuite.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,20 @@ class HivePartitionFilteringSuite(version: String)
333333
assert(filteredPartitions.map(_.spec.toSet).toSet == expectedPartitions.toSet)
334334
}
335335

336+
val dateAttr: Attribute = AttributeReference("part", DateType)()
337+
336338
testDataTypeFiltering(
337-
Seq(AttributeReference("part", DateType)() === Date.valueOf("2019-01-01")),
339+
Seq(dateAttr === Date.valueOf("2019-01-01")),
338340
Seq("2019-01-01").map(Date.valueOf) :: Nil)
339341
testDataTypeFiltering(
340-
Seq(AttributeReference("part", DateType)() > Date.valueOf("2019-01-02")),
342+
Seq(dateAttr > Date.valueOf("2019-01-02")),
341343
Seq("2019-01-03", "2019-01-04").map(Date.valueOf) :: Nil)
342344
testDataTypeFiltering(
343-
Seq(In(AttributeReference("part", DateType)(),
345+
Seq(In(dateAttr,
344346
Seq("2019-01-01", "2019-01-02").map(d => Literal(Date.valueOf(d))))),
345347
Seq("2019-01-01", "2019-01-02").map(Date.valueOf) :: Nil)
346348
testDataTypeFiltering(
347-
Seq(InSet(AttributeReference("part", DateType)(),
349+
Seq(InSet(dateAttr,
348350
Set("2019-01-01", "2019-01-02").map(d => Literal(Date.valueOf(d)).eval(EmptyRow)))),
349351
Seq("2019-01-01", "2019-01-02").map(Date.valueOf) :: Nil)
350352
}

0 commit comments

Comments
 (0)