16
16
// under the License.
17
17
18
18
use crate :: parser:: {
19
- CopyToSource , CopyToStatement , CreateExternalTable , DFParser , DescribeTableStmt ,
19
+ CopyToStatement , CreateExternalTable , DFParser , DescribeTableStmt ,
20
20
Statement as DFStatement ,
21
21
} ;
22
22
use crate :: planner:: {
@@ -34,7 +34,7 @@ use datafusion_expr::logical_plan::builder::project;
34
34
use datafusion_expr:: logical_plan:: DdlStatement ;
35
35
use datafusion_expr:: utils:: expr_to_columns;
36
36
use datafusion_expr:: {
37
- cast, col, Analyze , CopyTo , CreateCatalog , CreateCatalogSchema ,
37
+ cast, col, Analyze , CreateCatalog , CreateCatalogSchema ,
38
38
CreateExternalTable as PlanCreateExternalTable , CreateMemoryTable , CreateView ,
39
39
DescribeTable , DmlStatement , DropCatalogSchema , DropTable , DropView , EmptyRelation ,
40
40
Explain , ExprSchemable , Filter , LogicalPlan , LogicalPlanBuilder , PlanType , Prepare ,
@@ -539,51 +539,11 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
539
539
} ) )
540
540
}
541
541
542
- fn copy_to_plan ( & self , statement : CopyToStatement ) -> Result < LogicalPlan > {
543
- let CopyToStatement {
544
- source,
545
- target,
546
- options,
547
- } = statement;
548
-
549
- let input = match source {
550
- CopyToSource :: Relation ( table_name) => {
551
- let table_ref = self . object_name_to_table_reference ( table_name) ?;
552
- let provider =
553
- self . schema_provider . get_table_provider ( table_ref. clone ( ) ) ?;
554
- let projection = None ;
555
- LogicalPlanBuilder :: scan ( table_ref, provider, projection) ?. build ( )
556
- }
557
- CopyToSource :: Query ( query) => {
558
- let mut planner_context = PlannerContext :: new ( ) ;
559
- self . query_to_plan ( query, & mut planner_context)
560
- }
561
- } ?;
562
-
563
- // convert options
564
- let options = options
565
- . into_iter ( )
566
- . map ( |( k, v) | {
567
- let scalar = match self . parse_value ( v, & [ ] ) ? {
568
- datafusion_expr:: Expr :: Literal ( scalar) => Ok ( scalar) ,
569
- expr => Err ( DataFusionError :: Plan ( format ! (
570
- "COPY options expects a literal for {k}, got {expr}"
571
- ) ) ) ,
572
- } ?;
573
- Ok ( ( k, scalar) )
574
- } )
575
- // check for errors
576
- . collect :: < Result < Vec < _ > > > ( ) ?
577
- // collect into hashMap
578
- . into_iter ( )
579
- . collect :: < HashMap < _ , _ > > ( ) ;
580
-
581
- Ok ( LogicalPlan :: CopyTo ( CopyTo {
582
- input : Arc :: new ( input) ,
583
- target,
584
- options,
585
- dummy_schema : DFSchemaRef :: new ( DFSchema :: empty ( ) ) ,
586
- } ) )
542
+ fn copy_to_plan ( & self , _statement : CopyToStatement ) -> Result < LogicalPlan > {
543
+ // TODO: implement as part of https://github.com/apache/arrow-datafusion/issues/5654
544
+ Err ( DataFusionError :: NotImplemented (
545
+ "`COPY .. TO ..` statement is yet supported" . to_string ( ) ,
546
+ ) )
587
547
}
588
548
589
549
fn build_order_by (
0 commit comments