You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow DynamicFileCatalog support to query partitioned file #12671
Is your feature request related to a problem or challenge?
#11035 supports to query files through their URL. If the target dataset is partitioned, DynamicFileCatalog can't recognize the partitioned columns well.
Given the file structure like:
When inferring the ListingTableConfig, we can register the table partition column automatically. I think we can invoke ListingOption::infer_partitions to infer the required partition columns at the runtime.
# dynamic file query doesn't support partitioned table
statement error DataFusion error: Error during planning: table 'datafusion.public.../core/tests/data/partitioned_table_arrow' not found
SELECT * FROM '../core/tests/data/partitioned_table_arrow' ORDER BY f0;
However, I found that it's not a partitioned-table-related issue. The root cause is the input files, partitioned_table_arrow/part=123/data.arrow and partitioned_table_arrow/part=456/data.arrow, have different arrow schema:
Activity
goldmedal commentedon Sep 29, 2024
take
goldmedal commentedon Sep 29, 2024
There is a test case to assert querying partitioned table fails
datafusion/datafusion/sqllogictest/test_files/dynamic_file.slt
Lines 28 to 30 in 810e908
However, I found that it's not a partitioned-table-related issue. The root cause is the input files,
partitioned_table_arrow/part=123/data.arrowandpartitioned_table_arrow/part=456/data.arrow, have different arrow schema:{ "index_columns":[ { "kind":"range", "name":null, "start":0, "stop":2, "step":1 } ], "column_indexes":[ { "name":null, "field_name":null, "pandas_type":"unicode", "numpy_type":"object", "metadata":{ "encoding":"UTF-8" } } ], "columns":[ { "name":"f0", "field_name":"f0", "pandas_type":"int64", "numpy_type":"int64", "metadata":null }, { "name":"f1", "field_name":"f1", "pandas_type":"unicode", "numpy_type":"object", "metadata":null }, { "name":"f2", "field_name":"f2", "pandas_type":"bool", "numpy_type":"object", "metadata":null } ], "creator":{ "library":"pyarrow", "version":"15.0.0" }, "pandas_version":"2.2.1" }and
{ "index_columns":[ { "kind":"range", "name":null, "start":0, "stop":2, "step":1 } ], "column_indexes":[ { "name":null, "field_name":null, "pandas_type":"unicode", "numpy_type":"object", "metadata":{ "encoding":"UTF-8" } } ], "columns":[ { "name":"f0", "field_name":"f0", "pandas_type":"int64", "numpy_type":"int64", "metadata":null }, { "name":"f1", "field_name":"f1", "pandas_type":"unicode", "numpy_type":"object", "metadata":null }, { "name":"f2", "field_name":"f2", "pandas_type":"bool", "numpy_type":"bool", "metadata":null } ], "creator":{ "library":"pyarrow", "version":"15.0.0" }, "pandas_version":"2.2.1" }Their
numpy_typeoff2are different. One isbooland another isobject. It causes an ArrowError for merging schema atdatafusion/datafusion/core/src/datasource/file_format/arrow.rs
Line 154 in c4b48d7
We can create an external table for them and query them well.
datafusion/datafusion/sqllogictest/test_files/arrow_files.slt
Lines 53 to 61 in a0a635a
I guess it may be an issue of
ArrowFormat::infer_schemaorarrow_schema::Schema::try_merge(schemas)🤔.@alamb WDYT?