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/06/03 11:36:02 UTC

[GitHub] [arrow-datafusion] alamb opened a new pull request, #6539: Implement basic copy plans

alamb opened a new pull request, #6539:
URL: https://github.com/apache/arrow-datafusion/pull/6539

   # Which issue does this PR close?
   
   Close https://github.com/apache/arrow-datafusion/issues/5654
   
   # Rationale for this change
   
   Make it easy to copy data in / out of DataFusion
   
   # What changes are included in this PR?
   
   Add planning support for `COPY .. TO ..`
   
   Still todo:
   - [ ] Figure out how to pass options
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


-- 
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 commented on pull request #6539: Implement basic copy plans

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6539:
URL: https://github.com/apache/arrow-datafusion/pull/6539#issuecomment-1649735465

   I still hope to work on this feature at some point


-- 
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] comphead commented on a diff in pull request #6539: Implement basic copy plans

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #6539:
URL: https://github.com/apache/arrow-datafusion/pull/6539#discussion_r1218282195


##########
datafusion/sql/src/statement.rs:
##########
@@ -569,11 +569,47 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         }))
     }
 
-    fn copy_to_plan(&self, _statement: CopyToStatement) -> Result<LogicalPlan> {
+    fn copy_to_plan(&self, statement: CopyToStatement) -> Result<LogicalPlan> {
         // TODO: implement as part of https://github.com/apache/arrow-datafusion/issues/5654
-        Err(DataFusionError::NotImplemented(
-            "`COPY .. TO ..` statement is not yet supported".to_string(),
-        ))
+        //Err(DataFusionError::NotImplemented(
+        //"`COPY .. TO ..` statement is not yet supported".to_string(),
+        //))
+        let CopyToStatement { source, target, options } = statement;
+        let input = match source {
+            CopyToSource::Relation(table_name) => {
+                // TODO create at table scan here
+
+                return Err(DataFusionError::Plan(
+                "COPY FROM TABLE not yet supported."
+                        .to_owned(),
+                ));
+            }
+            CopyToSource::Query(query) => {
+                self.query_to_plan(query, &mut PlannerContext::new())?
+            },
+        };
+
+        // figure out what to do with the target?
+        // should we treat it like a table name???

Review Comment:
   PG treats it as files https://www.postgresql.org/docs/current/sql-copy.html
   
   `filename`
   The path name of the input or output file. An input file name can be an absolute or relative path, but an output file name must be an absolute path. Windows users might need to use an E'' string and double any backslashes used in the path name.



-- 
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 closed pull request #6539: Implement basic copy plans

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed pull request #6539: Implement basic copy plans
URL: https://github.com/apache/arrow-datafusion/pull/6539


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