You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "byteink (via GitHub)" <gi...@apache.org> on 2023/06/10 13:27:03 UTC
[GitHub] [arrow-datafusion] byteink opened a new pull request, #6628: Insert supports specifying column names in any order
byteink opened a new pull request, #6628:
URL: https://github.com/apache/arrow-datafusion/pull/6628
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #.
# Rationale for this change
Currently, the order of the specified column names for INSERT must match the order of the column names in the table.
For example, the following statement cannot be executed successfully
```shell
DataFusion CLI v26.0.0
❯ create table t(a int, b int);
0 rows in set. Query took 0.028 seconds.
❯ insert into t(b,a) values(2,1);
Error during planning: Inserting query must have the same schema with the table.
```
To address this issue, we can rearrange the order of the INSERT fields so that they align with the table fields.
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are these changes tested?
Yes
# Are there any user-facing changes?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb merged pull request #6628: Insert supports specifying column names in any order
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #6628:
URL: https://github.com/apache/arrow-datafusion/pull/6628
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Dandandan commented on a diff in pull request #6628: Insert supports specifying column names in any order
Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on code in PR #6628:
URL: https://github.com/apache/arrow-datafusion/pull/6628#discussion_r1225363725
##########
datafusion/core/tests/sqllogictests/test_files/insert.slt:
##########
@@ -234,3 +234,36 @@ select count(*) from table_without_values;
statement ok
drop table table_without_values;
+
+
+# test insert with column names
+statement ok
+CREATE TABLE table_without_values(field1 BIGINT NULL, field2 BIGINT NULL);
Review Comment:
We could add a test with different column types as well (e.g. column names are correct but types don't match).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] byteink commented on a diff in pull request #6628: Insert supports specifying column names in any order
Posted by "byteink (via GitHub)" <gi...@apache.org>.
byteink commented on code in PR #6628:
URL: https://github.com/apache/arrow-datafusion/pull/6628#discussion_r1225372761
##########
datafusion/core/tests/sqllogictests/test_files/insert.slt:
##########
@@ -234,3 +234,36 @@ select count(*) from table_without_values;
statement ok
drop table table_without_values;
+
+
+# test insert with column names
+statement ok
+CREATE TABLE table_without_values(field1 BIGINT NULL, field2 BIGINT NULL);
Review Comment:
@Dandandan Thank you, I will try to add it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org