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

   ## 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 https://github.com/apache/arrow-datafusion/issues/8994.
   Related to https://github.com/apache/arrow-datafusion/issues/9369 as well.
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.  
   -->
   
   Currently, in our implementation of 'Create External Table' and 'Copy to', 
the configuration options are not systematically organized, leading to 
potential confusion and complexity for the users.
   
   ## What changes are included in this PR?
   
   - A document generatable, 'datafusion.x' config-like table options 
introduced.
   - FileFormat now supports all configurations coming from SQL syntax. They 
can create `Writers` as they create `Readers`, which removes the writer from 
the `FileSInkConfig`.    
   -  `TableOptions` is extendable, which gives us the power of uniting the 
`object_store` configurations, like AWS.
   - Removed `StatementOptions`.
   
   The issues I want to talk about
   - `write_csv`, `write_parquet` etc. does not have a `CsvReadOptions` or 
`ParquetReadOptions` counterpart. I think we can add a structure to ensure a 
symmetric design (like `CsvWriteOptions`), which reduces the friction on user 
behaviour.     
   - Limiting usage of free-standing strings.
   
   ## Are these changes tested?
   
   With existing tests.
   
   ## Are there any user-facing changes?
   
   Yes, there is a breaking change here.
   Now., COPY options beside `partitioned_by` and `format` must have a prefix.
   ```sql
   COPY source_table
   TO 'test_files/scratch/copy/table_with_options/'
   (format parquet,
   'format.parquet.compression' snappy,
   'format.parquet.compression::col1' 'zstd(5)',
   'format.parquet.compression::col2' snappy,
   'format.parquet.max_row_group_size' 12345,
   'format.parquet.data_pagesize_limit' 1234,
   'format.parquet.write_batch_size' 1234,
   'format.parquet.writer_version' 2.0,
   'format.parquet.dictionary_page_size_limit' 123,
   'format.parquet.created_by' 'DF copy.slt',
   'format.parquet.column_index_truncate_length' 123,
   'format.parquet.data_page_row_count_limit' 1234,
   'format.parquet.bloom_filter_enabled' true,
   'format.parquet.bloom_filter_enabled::col1' false,
   'format.parquet.bloom_filter_fpp::col2' 0.456,
   'format.parquet.bloom_filter_ndv::col2' 456,
   'format.parquet.encoding' plain,
   'format.parquet.encoding::col1' DELTA_BINARY_PACKED,
   'format.parquet.dictionary_enabled::col2' true,
   'format.parquet.dictionary_enabled' false,
   'format.parquet.statistics_enabled' page,
   'format.parquet.statistics_enabled::col2' none,
   'format.parquet.max_statistics_size' 123,
   'format.parquet.bloom_filter_fpp' 0.001,
   'format.parquet.bloom_filter_ndv' 100
   )
   ``` 
   or CREATE EXTERNAL TABLE
   
   ```sql
   CREATE EXTERNAL TABLE csv_with_quote (
   c1 VARCHAR,
   c2 VARCHAR
   ) STORED AS CSV
   WITH HEADER ROW
   DELIMITER ','
   OPTIONS ('format.csv.quote' '~')
   LOCATION '../core/tests/data/quote.csv';
   ``` 


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to