-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-43438][SQL] Error on missing input columns in INSERT
#42393
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
17 commits
Select commit
Hold shift + click to select a range
8b07168
Error on missing input columns in INSERT
MaxGekk c736952
Add comments and fix tests
MaxGekk cd9d3d0
Fix InsertSuite
MaxGekk e565071
Fix HiveQuerySuite
MaxGekk 049dbd2
Checks column match in TableOutputResolver.resolveOutputColumns
MaxGekk ff0d5d9
Merge remote-tracking branch 'origin/master' into fix-num-cols-insert
MaxGekk c9b1fb3
Fix DSV2SQLInsertTestSuite.insert by name: mismatch column name
MaxGekk 722685d
Fix DataFrameWriterV2Suite
MaxGekk 51d3fbf
Fix V2AppendDataANSIAnalysisSuite
MaxGekk 01f0117
Remove a test
MaxGekk 6091fff
Merge remote-tracking branch 'origin/master' into fix-num-cols-insert
MaxGekk 96cab93
Trigger build
MaxGekk 9c3188c
Trigger build
MaxGekk e00fdbe
Trigger build
MaxGekk 87f7e96
Move the check
MaxGekk 60f9327
Address review comments
MaxGekk b644f8f
Address review comments
MaxGekk 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -962,11 +962,15 @@ class InsertSuite extends DataSourceTest with SharedSparkSession { | |
| (1 to 10).map(i => Row(i, null)) | ||
| ) | ||
|
|
||
| sql("INSERT OVERWRITE TABLE jsonTable SELECT a FROM jt") | ||
| checkAnswer( | ||
| sql("SELECT a, b FROM jsonTable"), | ||
| (1 to 10).map(i => Row(i, null)) | ||
| ) | ||
| checkError( | ||
| exception = intercept[AnalysisException] { | ||
| sql("INSERT OVERWRITE TABLE jsonTable SELECT a FROM jt") | ||
| }, | ||
| errorClass = "INSERT_COLUMN_ARITY_MISMATCH.NOT_ENOUGH_DATA_COLUMNS", | ||
| parameters = Map( | ||
| "tableName" -> "`unknown`", | ||
| "tableColumns" -> "`a`, `b`", | ||
| "dataColumns" -> "`a`")) | ||
|
|
||
| sql("INSERT OVERWRITE TABLE jsonTable(a) SELECT a FROM jt") | ||
| checkAnswer( | ||
|
|
@@ -1027,7 +1031,7 @@ class InsertSuite extends DataSourceTest with SharedSparkSession { | |
| } | ||
| withTable("t") { | ||
| sql("create table t(i int, s bigint default 42, x bigint) using parquet") | ||
| sql("insert into t values(1)") | ||
|
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. which Spark version added this test?
Member
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. Added by #41262 which haven't been released yet. |
||
| sql("insert into t(i) values(1)") | ||
| checkAnswer(spark.table("t"), Row(1, 42L, null)) | ||
| } | ||
| // The table has a partitioning column and a default value is injected. | ||
|
|
@@ -1495,7 +1499,7 @@ class InsertSuite extends DataSourceTest with SharedSparkSession { | |
| sql(createTableIntCol) | ||
| sql("alter table t add column s bigint default 42") | ||
| sql("alter table t add column x bigint") | ||
| sql("insert into t values(1)") | ||
| sql("insert into t(i) values(1)") | ||
| checkAnswer(spark.table("t"), Row(1, 42, null)) | ||
| } | ||
| // The table has a partitioning column and a default value is injected. | ||
|
|
||
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.