[
https://issues.apache.org/jira/browse/IMPALA-2515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17032203#comment-17032203
]
Onur Tokat commented on IMPALA-2515:
------------------------------------
Hello,
I am trying to custom parquet-avro schema creation for a table which is taken
from Kafka Topic using Java Avro API. Output parquet file is worn with Hive
table table. Decimal fields are created as fixed_len_byte_array on the schema.
The Hive table can be queried using Hive and Spark. But, when impala query is
used, it gives like below error.
!image-2020-02-07-11-31-43-641.png!
I try to define byte array size according to cloudera impala documentation
1 <= precision <=9, then 4 bytes
10<= precision <=18, then 8 bytes
precision>18, then 16 bytes.
In the impala query screen on Cloudera Hue. It shows Hive table description.
!image-2020-02-07-11-33-27-944.png!
!image-2020-02-07-11-34-04-220.png!
I am using array size detection for fixed_len_byte_array like below (accrording
to your formula)
!image-2020-02-07-11-36-31-458.png!
But it give above error. What is the formula for catching expected array size
for Impala?
> Impala is unable to read a Parquet decimal column if size is larger than
> needed
> -------------------------------------------------------------------------------
>
> Key: IMPALA-2515
> URL: https://issues.apache.org/jira/browse/IMPALA-2515
> Project: IMPALA
> Issue Type: Sub-task
> Components: Backend
> Affects Versions: Impala 2.3.0
> Reporter: Taras Bobrovytsky
> Assignee: Yongzhi Chen
> Priority: Minor
> Labels: ramp-up
> Attachments: image-2020-02-07-11-31-38-074.png,
> image-2020-02-07-11-31-43-641.png, image-2020-02-07-11-33-27-944.png,
> image-2020-02-07-11-34-04-220.png, image-2020-02-07-11-36-31-458.png
>
>
> Impala cannot read this:
> {code}
> {"name": "tmp_1",
> "type": "fixed",
> "size": 8,
> "logicalType": "decimal",
> "precision": 10,
> "scale": 5}
> {code}
> However, this can be read:
> {code}
> {"name": "tmp_1",
> "type": "fixed",
> "size": 5,
> "logicalType": "decimal",
> "precision": 10,
> "scale": 5}
> {code}
> Size must be precisely set to this, or Impala is unable to read the decimal
> column:
> {code}
> size = int(math.ceil((math.log(2, 10) + precision) / math.log(256, 10)))
> {code}
> There is nothing in the Parquet spec that says that Decimal columns must be
> sized precisely. Arguably it's a bug in the writer if it's doing it, because
> it's just wasting space.
> https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#decimal
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]