Uh oh!
There was an error while loading. Please reload this page.
[SPARK-8811][SQL] Read array struct data from parquet error - #7209
[SPARK-8811][SQL] Read array struct data from parquet error#7209Sephiroth-Lin wants to merge 7 commits into
Conversation
SparkQA
commented
Jul 3, 2015
Test build #36489 has finished for PR 7209 at commit
|
scwf
commented
Jul 3, 2015
@liancheng we changing like this resolved the parquet query issue i send to you, but it failed the unit test, can you have a look? |
SparkQA
commented
Jul 3, 2015
Test build #36494 has finished for PR 7209 at commit
|
SaintBacchus
commented
Jul 3, 2015
LGTM |
liancheng
commented
Jul 4, 2015
@Sephiroth-Lin@scwf This issue is actually much more complicated than it looks like. The TL;DR is that, in the early days, Parquet didn't explicitly specify how LIST and MAP should be constructed, and different systems and tools just reinvent their own wheels. The consequence is that it breaks Parquet interoperability. Namely, Parquet files written by system A might not be read by system B. The most recent Parquet format spec tries to fix this by specifying LIST and MAP structures explicitly and adding backwards-compatibility rules (1, 2) to cover existing legacy data files. We are trying to make Spark SQL compatible with Parquet format spec. This work consists of three parts:
I'm currently working on part 2, which fixes your problem here. A PR will be sent out soon. |
liancheng
commented
Jul 4, 2015
After rethinking about this PR, I think it does spot another issue: the current master breaks backwards-compatibility of reading Parquet files created by parquet-avro. When converting a Spark SQL schema to a Parquet schema, Spark 1.4.0 and prior versions mostly follow parquet-avro, and convert arrays which may contain null values into something like this: Please note the field name @Sephiroth-Lin Would you mind to fix this issue by changing the |
liancheng
commented
Jul 6, 2015
@Sephiroth-Lin@scwf The aforementioned PR is here: #7231. A test case for SPARK-8811 is added. |
scwf
commented
Jul 6, 2015
wow that's cool !! |
scwf
commented
Jul 6, 2015
do we still need file a PR to changing the array_element string to array? |
Sephiroth-Lin
commented
Jul 6, 2015
@liancheng OK, good, thank you. |
liancheng
commented
Jul 6, 2015
Sephiroth-Lin
commented
Jul 7, 2015
@liancheng I have updated, please help to review, thank you! |
SparkQA
commented
Jul 7, 2015
Test build #36638 has finished for PR 7209 at commit
|
pzzs
commented
Jul 7, 2015
LGTM |
There was a problem hiding this comment.
This line shouldn't be changed. As commented above, this case branch is implements standard Parquet schema conversion following the Parquet format spec, which explicitly require the inner most element type name to be element.
SparkQA
commented
Jul 7, 2015
Test build #36651 has finished for PR 7209 at commit
|
SparkQA
commented
Jul 7, 2015
Test build #36653 has finished for PR 7209 at commit
|
SparkQA
commented
Jul 7, 2015
Test build #36663 has finished for PR 7209 at commit
|
There was a problem hiding this comment.
Actually I made a mistake here. We should leave this array as array_element.
This is a little bit complicated... So in the early days, when Spark SQL Parquet support was firstly authored, Parquet format spec wasn't clear about how to write arrays and maps. So Spark SQL took a somewhat weird approach here: if the array may contain nulls, we mimic parquet-hive, which writes a 3-level structure with array_element as the 2nd level type name; otherwise, we mimic parquet-avro, which writes a 2-level structure with array as the 2nd level type name.
There was a problem hiding this comment.
Just to be clear, PR #7231 already covers the original bug this PR tried to fix. We'll be able to read Hive data with legacy format. The field names changed here matter for the write path, because we want to write exactly the same format as older Spark SQL versions when compatible mode is turned on.
liancheng
commented
Jul 8, 2015
Hey @Sephiroth-Lin, do you mind me forking this PR branch and continue work on this (will still credit you as the main author)? Parquet schema conversion is particularly hard to get right because there are a bunch of head scratching historical compatibility issues :( |
Sephiroth-Lin
commented
Jul 8, 2015
@liancheng OK, no problem. Thank you! |
liancheng
commented
Jul 8, 2015
Cool, then would you mind closing this PR for now? |
liancheng
commented
Jul 8, 2015
Opened #7304 for fixing this issue. |
scwf
commented
Jul 9, 2015
@Sephiroth-Lin please close this PR. |
…hen handling Parquet LISTs in compatible mode This PR is based on #7209 authored by Sephiroth-Lin. Author: Weizhong Lin <linweizhong@huawei.com> Closes#7304 from liancheng/spark-8928 and squashes the following commits: 75267fe [Cheng Lian] Makes CatalystSchemaConverter sticking to 1.4.x- when handling LISTs in compatible mode
…hen handling Parquet LISTs in compatible mode This PR is based on #7209 authored by Sephiroth-Lin. Author: Weizhong Lin <linweizhong@huawei.com> Closes#7314 from liancheng/spark-8928 and squashes the following commits: 75267fe [Cheng Lian] Makes CatalystSchemaConverter sticking to 1.4.x- when handling LISTs in compatible mode
rxin
commented
Jul 9, 2015
@Sephiroth-Lin you should add the email you used for the commit to your github profile. Then it will show up as your commit. |
liancheng
commented
Jul 9, 2015
@Sephiroth-Lin BTW, I added your email address manually when merging #7314. (Failed to update the author field when merging this PR so I reverted this one and reopened it as #7314.) |
JIRA:https://issues.apache.org/jira/browse/SPARK-8811
so when read data from parquet will cause java.lang.ArrayIndexOutOfBoundsException