[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16670339#comment-16670339 ] Wenchen Fan commented on SPARK-25206: - marked it as resolved in 2.4.0, since the test is already in 2.4.0 and passes. > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness, known_issue > Fix For: 2.4.0 > > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598467#comment-16598467 ] Dongjoon Hyun commented on SPARK-25206: --- Thank you all for the decision. > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598235#comment-16598235 ] Wenchen Fan commented on SPARK-25206: - It turns out we need to backport 3 non-trivial PRs to entirely fix the problem, which is risky. Let's close this JIRA if the problem has been resolved in master. > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598115#comment-16598115 ] Saisai Shao commented on SPARK-25206: - I see, if it is not going to be merged, let's close this JIRA and add to the release note. > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598113#comment-16598113 ] yucai commented on SPARK-25206: --- Based on our discussion in [https://github.com/apache/spark/pull/22184#issuecomment-416840509], seems like [~cloud_fan] prefers not backport, need his confirmation. > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598110#comment-16598110 ] Saisai Shao commented on SPARK-25206: - What is the status of this JIRA, are we going to backport, or just mark as a known issue? [~yucai] [~cloud_fan] [~smilegator] > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16595298#comment-16595298 ] yucai commented on SPARK-25206: --- Do you want to simulate an Exception in Spark? Backporting SPARK-25132 and SPARK-24716 is to fix a bug for our data source table, it looks more meaningful. > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16594958#comment-16594958 ] yucai commented on SPARK-25206: --- [~smilegator] , 2.1's exception is from parquet. {code:java} java.lang.IllegalArgumentException: Column [ID] was not found in schema! at org.apache.parquet.Preconditions.checkArgument(Preconditions.java:55) at org.apache.parquet.filter2.predicate.SchemaCompatibilityValidator.getColumnDescriptor(SchemaCompatibilityValidator.java:181) at org.apache.parquet.filter2.predicate.SchemaCompatibilityValidator.validateColumn(SchemaCompatibilityValidator.java:169) at org.apache.parquet.filter2.predicate.SchemaCompatibilityValidator.validateColumnFilterPredicate(SchemaCompatibilityValidator.java:151) at org.apache.parquet.filter2.predicate.SchemaCompatibilityValidator.visit(SchemaCompatibilityValidator.java:91) at org.apache.parquet.filter2.predicate.SchemaCompatibilityValidator.visit(SchemaCompatibilityValidator.java:58) at org.apache.parquet.filter2.predicate.Operators$NotEq.accept(Operators.java:194) at org.apache.parquet.filter2.predicate.SchemaCompatibilityValidator.visit(SchemaCompatibilityValidator.java:121) {code} 2.1 uses parquet 1.8.1, while 2.3 uses parquet 1.8.3, it is behavior change in parquet. See: https://issues.apache.org/jira/browse/PARQUET-389 [https://github.com/apache/parquet-mr/commit/2282c22c5b252859b459cc2474350fbaf2a588e9] > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-25206) wrong records are returned when Hive metastore schema and parquet schema are in different letter cases
[ https://issues.apache.org/jira/browse/SPARK-25206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16593840#comment-16593840 ] Xiao Li commented on SPARK-25206: - Silently ignoring it is bad. We should issue an exception like what we did in the previous version? What do you think? > wrong records are returned when Hive metastore schema and parquet schema are > in different letter cases > -- > > Key: SPARK-25206 > URL: https://issues.apache.org/jira/browse/SPARK-25206 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.2, 2.3.1 >Reporter: yucai >Priority: Blocker > Labels: Parquet, correctness > Attachments: image-2018-08-24-18-05-23-485.png, > image-2018-08-24-22-33-03-231.png, image-2018-08-24-22-34-11-539.png, > image-2018-08-24-22-46-05-346.png, image-2018-08-25-09-54-53-219.png, > image-2018-08-25-10-04-21-901.png, pr22183.png > > > In current Spark 2.3.1, below query returns wrong data silently. > {code:java} > spark.range(10).write.parquet("/tmp/data") > sql("DROP TABLE t") > sql("CREATE TABLE t (ID LONG) USING parquet LOCATION '/tmp/data'") > scala> sql("select * from t where id > 0").show > +---+ > | ID| > +---+ > +---+ > {code} > > *Root Cause* > After deep dive, it has two issues, both are related to different letter > cases between Hive metastore schema and parquet schema. > 1. Wrong column is pushdown. > Spark pushdowns FilterApi.gt(intColumn("{color:#ff}ID{color}"), 0: > Integer) into parquet, but {color:#ff}ID{color} does not exist in > /tmp/data (parquet is case sensitive, it has {color:#ff}id{color} > actually). > So no records are returned. > Since SPARK-24716, Spark uses Parquet schema instead of Hive metastore schema > to do the pushdown, perfect for this issue. > 2. Spark SQL returns NULL for a column whose Hive metastore schema and > Parquet schema are in different letter cases, even spark.sql.caseSensitive > set to false. > SPARK-25132 addressed this issue already. > > The biggest difference is, in Spark 2.1, user will get Exception for the same > query: > {code:java} > Caused by: java.lang.IllegalArgumentException: Column [ID] was not found in > schema!{code} > So they will know the issue and fix the query. > But in Spark 2.3, user will get the wrong results sliently. > > To make the above query work, we need both SPARK-25132 and -SPARK-24716.- > > [~yumwang] , [~cloud_fan], [~smilegator], any thoughts? Should we backport it? -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org