Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class ParquetFilters(
case sources.StringStartsWith(name, prefix)
if pushDownStartWith && canMakeFilterOn(name, prefix) =>
Option(prefix).map { v =>
FilterApi.userDefined(binaryColumn(name),
FilterApi.userDefined(binaryColumn(nameToParquetField(name).fieldName),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

new UserDefinedPredicate[Binary] with Serializable {
private val strToBinary = Binary.fromReusedByteArray(v.getBytes)
private val size = strToBinary.length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,27 @@ abstract class ParquetFilterSuite extends QueryTest with ParquetTest with Shared
}
}
}

test("SPARK-30826: case insensitivity of StringStartsWith attribute") {
import testImplicits._
withSQLConf(SQLConf.CASE_SENSITIVE.key -> "false") {
withTable("t1") {
withTempPath { dir =>
val path = dir.toURI.toString
Seq("42").toDF("COL").write.parquet(path)
spark.sql(
s"""
|CREATE TABLE t1 (col STRING)
|USING parquet
|OPTIONS (path '$path')
""".stripMargin)
checkAnswer(
spark.sql("SELECT * FROM t1 WHERE col LIKE '4%'"),
Row("42"))
}
}
}
}
}

class ParquetV1FilterSuite extends ParquetFilterSuite {
Expand Down