1717
1818//! Parquet writer operator for writing RecordBatches to Parquet files
1919
20- use arrow:: array:: { ArrayRef , AsArray } ;
21- use arrow:: compute:: {
22- cast, lexsort_to_indices, partition, take, Partitions , SortColumn , SortOptions ,
23- } ;
24- use opendal:: { services:: Hdfs , Operator } ;
25- use std:: collections:: HashMap ;
2620use std:: {
2721 any:: Any ,
2822 collections:: HashMap ,
@@ -32,20 +26,15 @@ use std::{
3226 io:: Cursor ,
3327 sync:: Arc ,
3428} ;
35-
36-
37- use url:: Url ;
38-
39- use arrow:: datatypes:: { DataType , Schema , SchemaRef } ;
40-
41-
29+ use arrow:: array:: { ArrayRef , AsArray } ;
30+ use arrow:: compute:: { cast, lexsort_to_indices, partition, take, Partitions , SortColumn , SortOptions } ;
4231use opendal:: Operator ;
4332
4433use crate :: execution:: shuffle:: CompressionCodec ;
4534use crate :: parquet:: parquet_support:: {
4635 create_hdfs_operator, is_hdfs_scheme, prepare_object_store_with_configs,
4736} ;
48-
37+ use arrow :: datatypes :: { DataType , Schema , SchemaRef } ;
4938use arrow:: record_batch:: RecordBatch ;
5039use async_trait:: async_trait;
5140use datafusion:: {
@@ -516,12 +505,12 @@ impl ExecutionPlan for ParquetWriterExec {
516505 use datafusion:: physical_plan:: metrics:: MetricBuilder ;
517506
518507 // Create metrics for tracking write statistics
519- let files_written = MetricBuilder :: new ( & self . metrics ) . counter ( "files_written" , partition ) ;
520- let bytes_written = MetricBuilder :: new ( & self . metrics ) . counter ( "bytes_written" , partition ) ;
521- let rows_written = MetricBuilder :: new ( & self . metrics ) . counter ( "rows_written" , partition ) ;
508+ let files_written = MetricBuilder :: new ( & self . metrics ) . counter ( "files_written" , partition_size ) ;
509+ let bytes_written = MetricBuilder :: new ( & self . metrics ) . counter ( "bytes_written" , partition_size ) ;
510+ let rows_written = MetricBuilder :: new ( & self . metrics ) . counter ( "rows_written" , partition_size ) ;
522511
523512 let runtime_env = context. runtime_env ( ) ;
524- let input = self . input . execute ( partition , context) ?;
513+ let input = self . input . execute ( partition_size , context) ?;
525514 let input_schema = self . input . schema ( ) ;
526515 let work_dir = self . work_dir . clone ( ) ;
527516 let task_attempt_id = self . task_attempt_id ;
@@ -547,13 +536,6 @@ impl ExecutionPlan for ParquetWriterExec {
547536 . build ( ) ;
548537
549538 let object_store_options = self . object_store_options . clone ( ) ;
550- let mut writer = Self :: create_arrow_writer (
551- & part_file,
552- Arc :: clone ( & output_schema) ,
553- props,
554- runtime_env,
555- & object_store_options,
556- ) ?;
557539
558540 // Clone schema for use in async closure
559541 let schema_for_write = Arc :: clone ( & output_schema) ;
0 commit comments