You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "ARF (Jira)" <ji...@apache.org> on 2021/02/26 13:15:00 UTC
[jira] [Commented] (ARROW-11765) Filtered parquet reads with the
'in'-operator fail on dictionary-type columns
[ https://issues.apache.org/jira/browse/ARROW-11765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17291639#comment-17291639 ]
ARF commented on ARROW-11765:
-----------------------------
Closing this as I misunderstood the {{in}}-operator. I mistakenly tried using it as a {{contains}}-operator. Hence, everything works as intended.
> Filtered parquet reads with the 'in'-operator fail on dictionary-type columns
> -----------------------------------------------------------------------------
>
> Key: ARROW-11765
> URL: https://issues.apache.org/jira/browse/ARROW-11765
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 3.0.0
> Reporter: ARF
> Priority: Major
>
> Filtered parquet reads with the 'in'-operator fail on dictionary-type columns:
>
> {code:python}
> import pyarrow as pa
> from pyarrow import parquet as pq
> schema = pa.schema({
> 'foo': pa.dictionary(pa.int8(), pa.string(), ordered=False),
> })
> def make_trivial_dict_array(dict_type, value, size):
> return
> table = pa.Table.from_pydict({
> 'foo': pa.DictionaryArray.from_arrays(
> pa.nulls(1, schema.field('foo').type.index_type).fill_null(0),
> ['abc bar def'])
> })
> pq.write_table(table, 'test_dict_in_filter.parquet', version='2.0', data_page_version='2.0')
> del table
> table = pq.read_table('test_dict_in_filter.parquet', filters=[('foo', 'in', 'bar')])
> print(f"number of rows containing 'bar': {len(table)}")
> {code}
> Output:
> {code:none}
> number of rows containing 'bar': 0
> {code}
> Note that filtered reads with the '=='-operator work perfectly fine on dictionary-type columns:
> {code:python}
> table = pq.read_table('test_dict_in_filter.parquet', filters=[('foo', '==', 'abc bar def')])
> print(f"number of rows equal to 'abc bar def': {len(table)}")
> {code}
> Output:
> {code:none}
> number of rows equal to 'abc bar def': 1{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)