Uh oh!
There was an error while loading. Please reload this page.
[SPARK-28659][SQL] Use data source if convertible in insert overwrite directory - #25398
[SPARK-28659][SQL] Use data source if convertible in insert overwrite directory#25398Udbhav30 wants to merge 5 commits into
Conversation
maropu
commented
Aug 10, 2019
Can you add tests? |
Udbhav30
commented
Aug 10, 2019
yes i will add tests and update the PR |
Udbhav30
commented
Aug 10, 2019
@maropu added the testcase! |
maropu
commented
Aug 10, 2019
ok to test |
maropu
commented
Aug 10, 2019
Thanks! |
SparkQA
commented
Aug 10, 2019
Test build #108912 has finished for PR 25398 at commit
|
SparkQA
commented
Aug 10, 2019
Test build #108920 has finished for PR 25398 at commit
|
| (ctx.LOCAL != null, storage, Some(DDLUtils.HIVE_PROVIDER)) | ||
| val fileFormat = extractFileFormat(fileStorage.serde) | ||
| (ctx.LOCAL != null, storage, Some(fileFormat)) | ||
| } |
There was a problem hiding this comment.
Are you sure this is correct? It seems a valid value is Some(DDLUtils.HIVE_PROVIDER) or None for the third parameter.
There was a problem hiding this comment.
in case of parquet and orc we can use the respective file format instead of hive.
In case of ctas also we convert to use data source https://github.com/viirya/spark-1/blob/839a6ce1732fa37b5f8ec9afa2d51730fc6ca691/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveStrategies.scala#L188
This will make it inline with that behavior.
| sql( | ||
| s""" | ||
| |INSERT OVERWRITE LOCAL DIRECTORY '$path' | ||
| |STORED AS orc |
There was a problem hiding this comment.
if we use stored as and file format is orc or parquet it will be converted to data source flow.
There was a problem hiding this comment.
I believe the test case name should be modified correspondingly and a new test case for (orc/parquet) should be added.
There was a problem hiding this comment.
@advancedxy i have updated the testcase name and for orc and parquet testcase was already added. As they will be converted to data source, the data in the directory would be compressed.
| sql( | ||
| s""" | ||
| |INSERT OVERWRITE LOCAL DIRECTORY '$path' | ||
| |STORED AS orc |
There was a problem hiding this comment.
I believe the test case name should be modified correspondingly and a new test case for (orc/parquet) should be added.
| } | ||
| private def extractFileFormat(serde: Option[String]): String = { | ||
| if (serde.toString.contains("parquet")) { |
There was a problem hiding this comment.
Although None.toString is "None", this looks like a hack to me.
How about:
serde.map({ x =>
val lowerCaseSerde = x.toLowerCase(Locale.ROOT)
if (lowerCaseSerde.contains("parquet") "parquet"
else if (lowerCaseSerde.contains("orc") "orc"
else DDLUtils.HIVE_PROVIDER
}).getOrElse( DDLUtils.HIVE_PROVIDER)
SparkQA
commented
Aug 12, 2019
Test build #108968 has finished for PR 25398 at commit
|
SparkQA
commented
Aug 12, 2019
Test build #108972 has finished for PR 25398 at commit
|
Udbhav30
commented
Aug 22, 2019
cc @HyukjinKwon |
HyukjinKwon
commented
Sep 17, 2019
ok to test |
SparkQA
commented
Sep 17, 2019
Test build #110698 has finished for PR 25398 at commit
|
Udbhav30
commented
Sep 17, 2019
failed test doesn't look related to this PR @HyukjinKwon |
HyukjinKwon
commented
Sep 18, 2019
retest this please |
SparkQA
commented
Sep 18, 2019
Test build #110857 has finished for PR 25398 at commit
|
Udbhav30
commented
Sep 18, 2019
retest this please |
1 similar comment
maropu
commented
Sep 18, 2019
retest this please |
SparkQA
commented
Sep 18, 2019
Test build #110880 has finished for PR 25398 at commit
|
Uh oh!
There was an error while loading. Please reload this page.
If you only target to fix Hive ser/de to respect compression, why don't you set Hive compression properly? |
Yes compression can be achieved by setting Hive ser/de or |
HyukjinKwon
left a comment
There was a problem hiding this comment.
Alright, if we want to do the conversion, it should have a configuration like spark.sql.hive.convertMetastoreCtas which respects spark.sql.hive.convertMetastoreParquet or spark.sql.hive.convertMetastoreOrc.
AmplabJenkins
commented
Feb 27, 2020
Can one of the admins verify this patch? |
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
What changes were proposed in this pull request?
In insert overwrite directory while using
STORED AS file_format, files are not compressed.In this PR it is converted to
datasourceif it is convertible, to make it inline withCTASbehavior which is fixed in this PRWhy are the changes needed?
To make the behavior inline with
CTASwhile usingSTORED AS file_formatDoes this PR introduce any user-facing change?
Yes, After the fix of this PR now

STORED AS file_formatwill be converted todatasourceif it is convertibleBefore
After

How was this patch tested?
New testcase is added