You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (JIRA)" <ji...@apache.org> on 2017/07/03 22:29:00 UTC

[jira] [Commented] (ARROW-601) Some logical types not supported when loading Parquet

    [ https://issues.apache.org/jira/browse/ARROW-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16072955#comment-16072955 ] 

Wes McKinney commented on ARROW-601:
------------------------------------

Well, we can read and convert the structs now, but not the time32[ms]:

{code}
In [12]: pq.read_table('/home/wesm/Downloads/t.parquet', columns=['a-group.bool', 'a-group.another']).to_pandas()
Out[12]: 
                          a-group
0  {'bool': True, 'another': 343}

In [13]: pq.read_table('/home/wesm/Downloads/t.parquet').to_pandas()
---------------------------------------------------------------------------
ArrowNotImplementedError                  Traceback (most recent call last)
<ipython-input-13-7a965403c9d1> in <module>()
----> 1 pq.read_table('/home/wesm/Downloads/t.parquet').to_pandas()

/home/wesm/code/arrow/python/pyarrow/table.pxi in pyarrow.lib.Table.to_pandas (/home/wesm/code/arrow/python/build/temp.linux-x86_64-3.5/lib.cxx:32758)()
    768             nthreads = cpu_count()
    769 
--> 770         mgr = pdcompat.table_to_blockmanager(self, nthreads)
    771         return pd.DataFrame(mgr)
    772 

/home/wesm/code/arrow/python/pyarrow/pandas_compat.py in table_to_blockmanager(table, nthreads)
    141             )
    142 
--> 143     result = lib.table_to_blocks(block_table, nthreads)
    144 
    145     blocks = []

/home/wesm/code/arrow/python/pyarrow/table.pxi in pyarrow.lib.table_to_blocks (/home/wesm/code/arrow/python/build/temp.linux-x86_64-3.5/lib.cxx:31292)()
    570 
    571     with nogil:
--> 572         check_status(
    573             libarrow.ConvertTableToPandas(
    574                 c_table, nthreads, &result_obj

/home/wesm/code/arrow/python/pyarrow/error.pxi in pyarrow.lib.check_status (/home/wesm/code/arrow/python/build/temp.linux-x86_64-3.5/lib.cxx:7378)()
     64             raise ArrowKeyError(message)
     65         elif status.IsNotImplemented():
---> 66             raise ArrowNotImplementedError(message)
     67         elif status.IsTypeError():
     68             raise ArrowTypeError(message)

ArrowNotImplementedError: NotImplemented: No known equivalent Pandas block for Arrow data of type time32[ms] is known.
{code}

See ARROW-1183

> Some logical types not supported when loading Parquet
> -----------------------------------------------------
>
>                 Key: ARROW-601
>                 URL: https://issues.apache.org/jira/browse/ARROW-601
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.2.0
>            Reporter: Saul Shanabrook
>            Assignee: Miki Tebeka
>              Labels: parquet
>             Fix For: 0.5.0
>
>         Attachments: t.parquet
>
>
> When I try to read a parquet file with some logical types in it, pyarrow says they are not supported:
> {code}
> table = pq.read_table('t.parquet')
> ---------------------------------------------------------------------------
> ArrowException                            Traceback (most recent call last)
> <ipython-input-14-b7190e66bcb5> in <module>()
> ----> 1 table = pq.read_table('parquet/t')
> /opt/conda/lib/python3.5/site-packages/pyarrow/parquet.py in read_table(source, columns, nthreads, metadata)
>     113 
>     114     pf = ParquetFile(source, metadata=metadata)
> --> 115     return pf.read(columns=columns, nthreads=nthreads)
>     116 
>     117 
> /opt/conda/lib/python3.5/site-packages/pyarrow/parquet.py in read(self, nrows, columns, nthreads)
>      78 
>      79         return self.reader.read(column_indices=column_indices,
> ---> 80                                 nthreads=nthreads)
>      81 
>      82 
> /opt/conda/lib/python3.5/site-packages/pyarrow/_parquet.pyx in pyarrow._parquet.ParquetReader.read (/feedstock_root/build_artefacts/pyarrow_1488133203047/work/arrow-f6924ad83bc95741f003830892ad4815ca3b70fd/python/build/temp.linux-x86_64-3.5/_parquet.cxx:7706)()
> /opt/conda/lib/python3.5/site-packages/pyarrow/error.pyx in pyarrow.error.check_status (/feedstock_root/build_artefacts/pyarrow_1488133203047/work/arrow-f6924ad83bc95741f003830892ad4815ca3b70fd/python/build/temp.linux-x86_64-3.5/error.cxx:1197)()
> ArrowException: NotImplemented: Unhandled logical type for int32
> {code}
> This is the schema of the parquet file (see attached):
> {code}
> optional group root {
>   optional int64 instant (TIMESTAMP_MILLIS);
>   optional int32 time (TIME_MILLIS);
>   optional double a-double;
>   optional int64 another-int;
>   optional binary a-string (UTF8);
>   optional group list (LIST) {
>     repeated group list {
>       optional int64 element;
>     }
>   }
>   optional boolean a-boolean;
>   optional group a-group {
>     optional boolean bool;
>     optional int64 another;
>   }
>   optional int64 an-int;
>   optional int32 a-date (DATE);
> }
> {code}
> I assume this is because not pyarrow doesn't support loading all the parquet logical types yet. Is there someplace I can look (even if it's not documented, just in the codebase), where I can find what types are supported currently and which are not?
>  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)