jychen7 opened a new pull request #2099:
URL: https://github.com/apache/arrow-datafusion/pull/2099


   # Which issue does this PR close?
   
   Closes https://github.com/apache/arrow-datafusion/issues/2061
   
    # Rationale for this change
   support partition pruning using CreateExternalTable DDL
   
   # What changes are included in this PR?
   
   
   # Are there any user-facing changes?
   No change if user is using SQL.
   However, there is change in `context.read_parquet` params, receiving a 
ParquetReadOptions for `table_partition_cols`. It is more align with other file 
format, since Csv, Avro, Json already have their own ReadOptions
   
   # Manual Test in datafusion-cli
   
   create tmp sample file
   ```
   echo "1,2" > tmp/year=2022/data.csv
   echo "3,4" > tmp/year=2021/data.csv
   ```
   
   run in datafusion-cli
   ```
   ❯ CREATE EXTERNAL TABLE t1 (a INT, b INT) STORED AS CSV LOCATION 'tmp';
   0 rows in set. Query took 0.002 seconds.
   ❯ select * from t1;
   +---+---+
   | a | b |
   +---+---+
   | 3 | 4 |
   | 1 | 2 |
   +---+---+
   2 rows in set. Query took 0.012 seconds.
   ❯ CREATE EXTERNAL TABLE t2 (a INT, b INT) STORED AS CSV PARTITIONED BY 
(year) LOCATION 'tmp';
   0 rows in set. Query took 0.001 seconds.
   ❯ select * from t2;
   +---+---+------+
   | a | b | year |
   +---+---+------+
   | 1 | 2 | 2022 |
   | 3 | 4 | 2021 |
   +---+---+------+
   2 rows in set. Query took 0.011 seconds.
   ❯ select * from t2 where year = '2022';
   +---+---+------+
   | a | b | year |
   +---+---+------+
   | 1 | 2 | 2022 |
   +---+---+------+
   1 row in set. Query took 0.013 seconds.
   ```


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