You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "westonpace (via GitHub)" <gi...@apache.org> on 2023/04/28 18:45:17 UTC
[GitHub] [arrow] westonpace commented on issue #35305: [C++] Support predicate pushdown for timestamp and string types in Parquet Scanner
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