You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "YoungRX (via GitHub)" <gi...@apache.org> on 2023/04/24 15:12:35 UTC

[GitHub] [arrow] YoungRX opened a new issue, #35305: [C++] Support predicate pushdown for timestamp and string types in Parquet Scanner

YoungRX opened a new issue, #35305:
URL: https://github.com/apache/arrow/issues/35305

   ### Describe the enhancement requested
   
   I am using version 8.0.0. And I use Scanner class to read Parquet files. 
   
   When I read datas about timestamp or string types, I use TimestampScalar or StringScalar as predicate value, less or greater functions in expressions.h to organize filter expressions. I add these expressions to the ScanOptions.filter.
   
   ```
   select timestamp_col, string_col from parquet_file;  -- query1
   select timestamp_col, string_col from parquet_file where timestamp_col < '2020-01-01';  -- query2
   select timestamp_col, string_col from parquet_file where string_col > 'hello';  -- query3
   ```
   Although the query results are correct, queries 2 and 3 take longer than query 1.
   
   **This indicates that queries 2 and 3 scan all data into memory before filtering, rather than avoiding scanning unnecessary row groups  by predicate pushdown first.**
   
   I make sure that these queries filter some groups of rows in my parquet data by predicate  pushdown.
   
   And I also tested the int32 type, which is able to do predicate pushdown.
   
   So could you please support predicate pushdown for timestamp and string types in Parquet Scanner?And more, please support decimal, interval, date and other types.
   
   Or this is just not supported in version 8.0.0. Please tell me which Arrow version supports these types of predicate pushdown.
   
   
   ### Component(s)
   
   C++


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

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


[GitHub] [arrow] YoungRX closed issue #35305: [C++] Support predicate pushdown for timestamp and string types in Parquet Scanner

Posted by "YoungRX (via GitHub)" <gi...@apache.org>.
YoungRX closed issue #35305: [C++] Support predicate pushdown for timestamp and string types in Parquet Scanner
URL: https://github.com/apache/arrow/issues/35305


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

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


[GitHub] [arrow] westonpace commented on issue #35305: [C++] Support predicate pushdown for timestamp and string types in Parquet Scanner

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

   I think we might need more details or a reproducing script of some kind.  Here is a quick experiment I ran:
   
   ```
   import pyarrow as pa
   import pyarrow.compute as pc
   import pyarrow.parquet as pq
   import pyarrow.dataset as ds
   import shutil
   
   shutil.rmtree("/tmp/my_dataset", ignore_errors=True)
   
   values = list(range(100))
   
   int_col = pa.array(values, pa.int64())
   ts_col = pc.cast(int_col, pa.timestamp('us'))
   
   table = pa.Table.from_arrays([int_col, ts_col], names=["ints","timestamps"])
   
   ds.write_dataset(table, "/tmp/my_dataset", format="parquet")
   
   my_dataset = ds.dataset("/tmp/my_dataset")
   
   # Prime the query once to load parquet metadata into memory                                                                                                                                                        
   my_dataset.to_table()
   
   big_ts = pc.cast(pa.array([1000], pa.int64()), pa.timestamp('us'))[0]
   print("WITH FILTER")
   print(my_dataset.to_table(filter=pc.field("timestamps") > big_ts))
   
   print("WITHOUT FILTER")
   print(my_dataset.to_table())
   ```
   
   I then tested this with `strace` using the command `strace -f -P /tmp/my_dataset/part-0.parquet python repr.py`:
   
   ```
   WITH FILTER
   pyarrow.Table
   ints: int64
   timestamps: timestamp[us]
   ----
   ints: [[]]
   timestamps: [[]]
   WITHOUT FILTER
   [pid 43296] openat(AT_FDCWD, "/tmp/my_dataset/part-0.parquet", O_RDONLY) = 7
   [pid 43296] newfstatat(7, "", {st_mode=S_IFREG|0664, st_size=2111, ...}, AT_EMPTY_PATH) = 0
   [pid 43296] newfstatat(7, "", {st_mode=S_IFREG|0664, st_size=2111, ...}, AT_EMPTY_PATH) = 0
   [pid 43314] pread64(7, "\25\4\25\300\f\25\266\6L\25\310\1\25\4\22\0\0\240\6\0\0\r\1\0\1\r\10\0\2\r\10\0"..., 595, 4) = 595
   [pid 43314] pread64(7, "\25\4\25\300\f\25\266\6L\25\310\1\25\4\22\0\0\240\6\0\0\r\1\0\1\r\10\0\2\r\10\0"..., 595, 695) = 595
   [pid 43314] close(7)                    = 0
   pyarrow.Table
   ints: int64
   timestamps: timestamp[us]
   ----
   ints: [[0,1,2,3,4,...,95,96,97,98,99]]
   timestamps: [[1970-01-01 00:00:00.000000,1970-01-01 00:00:00.000001,1970-01-01 00:00:00.000002,1970-01-01 00:00:00.000003,1970-01-01 00:00:00.000004,...,1970-01-01 00:00:00.000095,1970-01-01 00:00:00.000096,1970-01-01 00:00:00.000097,1970-01-01 00:00:00.000098,1970-01-01 00:00:00.000099]]
   ```
   
   I also verified with a debugger that the row groups are not actually being read.
   
   


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


[GitHub] [arrow] YoungRX commented on issue #35305: [C++] Support predicate pushdown for timestamp and string types in Parquet Scanner

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

   Yes, you are right. I'm sorry. When I build the expression, I set the wrong types.


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