You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "henrifroese (via GitHub)" <gi...@apache.org> on 2024/03/17 15:04:54 UTC

[I] Partitioned object store lists all files on every query when using hive-partitioned parquet files [arrow-datafusion]

henrifroese opened a new issue, #9654:
URL: https://github.com/apache/arrow-datafusion/issues/9654

   ### Describe the bug
   
   Hey,
   
   awesome project! I'm trying to use datafusion to query across 100s of thousands of partitioned parquet files in S3. Partitioning is e.g. `experiment=A/measurement=B/date_id=20230101/file.parquet`.
   
   Now say I want to query `SELECT * WHERE experiment='A' and measurement='B' and date_id=20230101`.
   
   Depending on what I do I get very different performance:
   
   1. If I first `register_listing_table` with prefix `experiment=A/measurement=B/` and `ListingOptions.with_table_partition_cols`  only date_id, and then send query `SELECT * WHERE date_id=20230101` that's very fast.
   
   2. If I just `register_listing_table` without prefix, and `ListingOptions.with_table_partition_cols` specify experiment, measurement, date_id, and send the full query `SELECT * WHERE experiment='A' and measurement='B' and date_id=20230101`, that's very slow. (Still works!)
   
   It makes sense to me that the first time, we have to list all files, so (2) is slower. But it's also slower on repeated queries. 
   
   Afaict the actual filtering happens in https://github.com/apache/arrow-datafusion/blob/cf0f8eececd37f593b811320f89c0edd00fd3945/datafusion/core/src/datasource/listing/helpers.rs#L328
   which calls `list_partitions`.
   
   I can think of two ways to speed this up:
   
   1. Allow caching a `ListingTable`'s files
   2. In `ListingTable`, allow specifying the order of partitioning columns (e.g. in this case `[experiment, measurement, date_id]`), and if specified filters are a prefix of this, use that to only list beyond that prefix. E.g. here that'd lead to only listing files after `experiment=A/measurement=B/`.
   
   Do any of these ways already exist and I just didn't find them? Or already have tickets?
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Partitioned object store lists all files on every query when using hive-partitioned parquet files [arrow-datafusion]

Posted by "henrifroese (via GitHub)" <gi...@apache.org>.
henrifroese commented on issue #9654:
URL: https://github.com/apache/arrow-datafusion/issues/9654#issuecomment-2002506332

   Ah seems to be what @suremarc mentioned here: https://github.com/apache/arrow-datafusion/pull/7620#issuecomment-1750983578


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Partitioned object store lists all files on every query when using hive-partitioned parquet files [arrow-datafusion]

Posted by "henrifroese (via GitHub)" <gi...@apache.org>.
henrifroese commented on issue #9654:
URL: https://github.com/apache/arrow-datafusion/issues/9654#issuecomment-2002563830

   Tried having a go at this in !9655 @suremarc @Ted-Jiang lmk whether that makes sense


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org