-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-13528][SQL] Make the short names of compression codecs consistent in ParquetRelation #11408
Closed
Closed
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
25e9250
Add a common utility code to map short names to fully-qualified codec…
maropu 2d7737b
Fix style errors
maropu da879a6
Add a test for an illegal codec given in an option
maropu c3f0140
Revert codes
maropu ac6b82c
Use foreach not map
maropu 1be5cc1
Fix bugs
maropu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 15 additions & 15 deletions
30
sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
|
||
package org.apache.spark.sql.execution.datasources.text | ||
|
||
import org.apache.spark.sql.{AnalysisException, DataFrame, QueryTest, Row} | ||
import org.apache.spark.sql.{AnalysisException, DataFrame, QueryTest, Row, SaveMode} | ||
import org.apache.spark.sql.test.SharedSQLContext | ||
import org.apache.spark.sql.types.{StringType, StructType} | ||
import org.apache.spark.util.Utils | ||
|
@@ -58,18 +58,13 @@ class TextSuite extends QueryTest with SharedSQLContext { | |
} | ||
|
||
test("SPARK-13503 Support to specify the option for compression codec for TEXT") { | ||
val df = sqlContext.read.text(testFile).withColumnRenamed("value", "adwrasdf") | ||
|
||
val tempFile = Utils.createTempDir() | ||
tempFile.delete() | ||
df.write | ||
.option("compression", "gZiP") | ||
.text(tempFile.getCanonicalPath) | ||
val compressedFiles = tempFile.listFiles() | ||
assert(compressedFiles.exists(_.getName.endsWith(".gz"))) | ||
verifyFrame(sqlContext.read.text(tempFile.getCanonicalPath)) | ||
|
||
Utils.deleteRecursively(tempFile) | ||
Seq("bzip2", "deflate", "gzip").map { codecName => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: |
||
val tempDir = Utils.createTempDir() | ||
val tempDirPath = tempDir.getAbsolutePath() | ||
val df = sqlContext.read.text(testFile) | ||
df.write.option("compression", codecName).mode(SaveMode.Overwrite).text(tempDirPath) | ||
verifyFrame(sqlContext.read.text(tempDirPath)) | ||
} | ||
} | ||
|
||
private def testFile: String = { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with standardizing names, but this seems like a lot of over-engineering, with abstract classes and whatnot just to attempt to make some keys consistent. I think this makes it harder to understand, and would stick to standardizing the keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in an original idea, we should have consistent short names for compression codecs everywhere in spark. Any simpler way we can have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, agree with Sean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also agree - this abstract class is too much. I think just having lz4/bzip2 etc in different places isn't that big of a deal.