You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/05/04 13:59:08 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6219: Select Into support

alamb commented on code in PR #6219:
URL: https://github.com/apache/arrow-datafusion/pull/6219#discussion_r1185058357


##########
datafusion/sql/src/select.rs:
##########
@@ -221,7 +219,23 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 .collect::<Result<Vec<_>>>()?;
             LogicalPlanBuilder::from(plan)
                 .repartition(Partitioning::DistributeBy(x))?
-                .build()
+                .build()?
+        } else {
+            plan
+        };
+
+        if let Some(select_into) = select.into {

Review Comment:
   I verified that this is consistent with postgres:
   
   ```sql
   
   postgres=# select * from test;
    column1 | column2
   ---------+---------
          1 |      10
          2 |      20
          3 |      30
   (3 rows)
   
   postgres=# select * into test2 from test;
   SELECT 3
   postgres=# select * into test2 from test;
   ERROR:  relation "test2" already exists
   postgres=# select * from test2;
    column1 | column2
   ---------+---------
          1 |      10
          2 |      20
          3 |      30
   (3 rows)
   ```



##########
datafusion/core/tests/sqllogictests/test_files/ddl.slt:
##########
@@ -296,9 +320,20 @@ SELECT * FROM my_table;
 ----
 1 2 hello
 
+# select_into_with_schema_as_values
+statement ok
+SELECT * INTO new_table FROM my_table

Review Comment:
   I don't understand how this test is different than the ones above. Is the intent to insert into a table in a schema? Like `SELECT * into my_schema.new_table from my_table`?



##########
datafusion/core/tests/sqllogictests/test_files/ddl.slt:
##########
@@ -476,6 +511,15 @@ SELECT * FROM abc
 1 3 3
 5 5 6
 
+statement ok
+SELECT * INTO fgh FROM (VALUES (1,2,3), (4,5,6));

Review Comment:
   likewise it isn't clear to me what other case this is testing



-- 
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