ARF created ARROW-11765:
---------------------------

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


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)

Reply via email to