-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-33474][SQL] Support TypeConstructed partition spec value #30421
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
Closed
Closed
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
adb1842
[SPARK-33474][SQL] Support TypeConstructed partition spec value
AngersZhuuuu ae59115
Update AstBuilder.scala
AngersZhuuuu c9a97d0
Update AstBuilder.scala
AngersZhuuuu bcdc7e5
Update SQLQuerySuite.scala
AngersZhuuuu d171377
FOLLOW COMMENT
AngersZhuuuu 516c070
Update SQLQuerySuite.scala
AngersZhuuuu 251c36b
Update DDLParserSuite.scala
AngersZhuuuu 1590e8a
Merge branch 'master' into SPARK-33474
AngersZhuuuu 6adefa7
Update DDLParserSuite.scala
AngersZhuuuu 05f1962
Update SQLQuerySuite.scala
AngersZhuuuu e312697
follow comment
AngersZhuuuu edd270e
Update AstBuilder.scala
AngersZhuuuu a8f26a1
follow comment
AngersZhuuuu 98986a0
Update AstBuilder.scala
AngersZhuuuu e2749c3
Update sql-migration-guide.md
AngersZhuuuu 713da66
follow comment
AngersZhuuuu 4898fb4
follow comment
AngersZhuuuu e875bcf
Update SQLQuerySuite.scala
AngersZhuuuu 0228292
Update SQLQuerySuite.scala
AngersZhuuuu 2db3f14
Merge branch 'master' into SPARK-33474
AngersZhuuuu 055a903
Update
AngersZhuuuu e6092c1
Merge branch 'master' into SPARK-33474
AngersZhuuuu 06a9321
Update DDLParserSuite.scala
AngersZhuuuu bc3e347
Merge branch 'master' into SPARK-33474
AngersZhuuuu 0358274
Merge branch 'master' into SPARK-33474
AngersZhuuuu ca69533
Merge branch 'SPARK-33474' of https://github.com/AngersZhuuuu/spark i…
AngersZhuuuu 894ac90
Merge branch 'master' into SPARK-33474
AngersZhuuuu 0b4b211
update
AngersZhuuuu 7264a3d
Update DDLParserSuite.scala
AngersZhuuuu b68ee81
Fix build issue
AngersZhuuuu dc0783a
Update sql-migration-guide.md
AngersZhuuuu d3b1960
Update AstBuilder.scala
AngersZhuuuu 2e9058a
follow comment
AngersZhuuuu 31c1092
Merge branch 'master' into SPARK-33474
AngersZhuuuu 9f5d569
Update SQLQuerySuite.scala
AngersZhuuuu 5e05adb
follow comment
AngersZhuuuu dd34027
follow comment
AngersZhuuuu 4cdb4a7
Update AlterTableDropPartitionSuiteBase.scala
AngersZhuuuu 093b062
Update SQLInsertTestSuite.scala
AngersZhuuuu adc3984
Merge branch 'master' into SPARK-33474
AngersZhuuuu f6bdbbe
follow comment
AngersZhuuuu 2ef0fd0
Update SQLInsertTestSuite.scala
AngersZhuuuu 4023041
Update SQLInsertTestSuite.scala
AngersZhuuuu fe5095a
Update SQLInsertTestSuite.scala
AngersZhuuuu 63a4fb4
follow comment
AngersZhuuuu 4f61e60
follow comment
AngersZhuuuu 08c55f6
Update SQLInsertTestSuite.scala
AngersZhuuuu 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -18,9 +18,11 @@ | |
| package org.apache.spark.sql | ||
|
|
||
| import org.apache.spark.SparkConf | ||
| import org.apache.spark.sql.catalyst.expressions.Hex | ||
| import org.apache.spark.sql.connector.InMemoryPartitionTableCatalog | ||
| import org.apache.spark.sql.internal.SQLConf | ||
| import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils} | ||
| import org.apache.spark.unsafe.types.UTF8String | ||
|
|
||
| /** | ||
| * The base trait for DML - insert syntax | ||
|
|
@@ -209,6 +211,52 @@ trait SQLInsertTestSuite extends QueryTest with SQLTestUtils { | |
| } | ||
| } | ||
|
|
||
| test("SPARK-33474: Support typed literals as partition spec values") { | ||
| withTable("t1") { | ||
| val binaryStr = "Spark SQL" | ||
| val binaryHexStr = Hex.hex(UTF8String.fromString(binaryStr).getBytes).toString | ||
| sql( | ||
| """ | ||
| | CREATE TABLE t1(name STRING, part1 DATE, part2 TIMESTAMP, part3 BINARY, | ||
| | part4 STRING, part5 STRING, part6 STRING, part7 STRING) | ||
| | USING PARQUET PARTITIONED BY (part1, part2, part3, part4, part5, part6, part7) | ||
| """.stripMargin) | ||
|
|
||
| sql( | ||
| s""" | ||
| | INSERT OVERWRITE t1 PARTITION( | ||
|
Contributor
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. seems we can test with only one insert:
Contributor
Author
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. Done |
||
| | part1 = date'2019-01-01', | ||
| | part2 = timestamp'2019-01-01 11:11:11', | ||
| | part3 = X'$binaryHexStr', | ||
| | part4 = 'p1', | ||
| | part5 = date'2019-01-01', | ||
| | part6 = timestamp'2019-01-01 11:11:11', | ||
| | part7 = X'$binaryHexStr' | ||
| | ) VALUES('a') | ||
| """.stripMargin) | ||
| checkAnswer(sql( | ||
| """ | ||
| | SELECT | ||
| | name, | ||
| | CAST(part1 AS STRING), | ||
| | CAST(part2 as STRING), | ||
| | CAST(part3 as STRING), | ||
| | part4, | ||
| | part5, | ||
| | part6, | ||
| | part7 | ||
| | FROM t1 | ||
| """.stripMargin), | ||
| Row("a", "2019-01-01", "2019-01-01 11:11:11", "Spark SQL", "p1", | ||
| "2019-01-01", "2019-01-01 11:11:11", "Spark SQL")) | ||
|
|
||
| val e = intercept[AnalysisException] { | ||
| sql("CREATE TABLE t2(name STRING, part INTERVAL) USING PARQUET PARTITIONED BY (part)") | ||
| }.getMessage | ||
| assert(e.contains("Cannot use interval")) | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-34556: " + | ||
| "checking duplicate static partition columns should respect case sensitive conf") { | ||
| withTable("t") { | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.