[ 
https://issues.apache.org/jira/browse/SPARK-25207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16593128#comment-16593128
 ] 

Dongjoon Hyun commented on SPARK-25207:
---------------------------------------

[~yucai]. My bad. Please ignore that. It was based on the old one.

With the latest master branch, I found that the issue is a more general 
regression. Please see [the above 
comment|https://issues.apache.org/jira/browse/SPARK-25207?focusedCommentId=16593108&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16593108]
 and [Github 
comment|https://github.com/apache/spark/pull/22197#issuecomment-416085556] and 
update both GitHub PR and Apache JIRA description as you want.

> Case-insensitve field resolution for filter pushdown when reading Parquet
> -------------------------------------------------------------------------
>
>                 Key: SPARK-25207
>                 URL: https://issues.apache.org/jira/browse/SPARK-25207
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.0
>            Reporter: yucai
>            Priority: Major
>              Labels: Parquet
>         Attachments: image.png
>
>
> Currently, filter pushdown will not work if Parquet schema and Hive metastore 
> schema are in different letter cases even spark.sql.caseSensitive is false.
> Like the below case:
> {code:java}
> spark.range(10).write.parquet("/tmp/data")
> sql("DROP TABLE t")
> sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'")
> sql("select * from t where id > 0").show{code}
> -No filter will be pushed down.-
> {code}
> scala> sql("select * from t where id > 0").explain   // Filters are pushed 
> with `ID`
> == Physical Plan ==
> *(1) Project [ID#90L]
> +- *(1) Filter (isnotnull(id#90L) && (id#90L > 0))
>    +- *(1) FileScan parquet default.t[ID#90L] Batched: true, Format: Parquet, 
> Location: InMemoryFileIndex[file:/tmp/data], PartitionFilters: [], 
> PushedFilters: [IsNotNull(ID), GreaterThan(ID,0)], ReadSchema: 
> struct<ID:bigint>
> scala> sql("select * from t").show    // Parquet returns NULL for `ID` 
> because it has `id`.
> +----+
> |  ID|
> +----+
> |null|
> |null|
> |null|
> |null|
> |null|
> |null|
> |null|
> |null|
> |null|
> |null|
> +----+
> scala> sql("select * from t where id > 0").show   // `NULL > 0` is `false`.
> +---+
> | ID|
> +---+
> +---+
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to