Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for arbitrary precision number attributes #167

Open
ikonst opened this issue Jan 16, 2023 · 0 comments
Open

Support for arbitrary precision number attributes #167

ikonst opened this issue Jan 16, 2023 · 0 comments

Comments

@ikonst
Copy link

ikonst commented Jan 16, 2023

In DynamoDB:

Numbers are variable length, with up to 38 significant digits. Leading and trailing zeroes are trimmed. The size of a number is approximately (length of attribute name) + (1 byte per two significant digits) + (1 byte).

The Hive connector chokes up on numbers larger than Long can hold. It should probably be a DECIMAL in Hive and BigDecimal in Java.

For example, for number 11888647184542023637 which is in (2^63, 2^64), we get:

...
        at org.apache.hadoop.hive.dynamodb.DynamoDBObjectInspector.getColumnData(DynamoDBObjectInspector.java:104)
        at org.apache.hadoop.hive.dynamodb.DynamoDBObjectInspector.getStructFieldData(DynamoDBObjectInspector.java:73)
        at org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters$StructConverter.convert(ObjectInspectorConverters.java:420)
        at org.apache.hadoop.hive.ql.exec.MapOperator$MapOpCtx.readRow(MapOperator.java:133)
        at org.apache.hadoop.hive.ql.exec.MapOperator$MapOpCtx.access$200(MapOperator.java:91)
        at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:554)
        ... 18 more
Caused by: java.lang.NumberFormatException: For input string: "11888647184542023637"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Long.parseLong(Long.java:592)
        at java.lang.Long.parseLong(Long.java:631)
        at org.apache.hadoop.hive.dynamodb.util.DynamoDBDataParser.getNumberObject(DynamoDBDataParser.java:240)
        at org.apache.hadoop.hive.dynamodb.type.HiveDynamoDBNumberType.getHiveData(HiveDynamoDBNumberType.java:43)
        at org.apache.hadoop.hive.dynamodb.DynamoDBObjectInspector.getColumnData(DynamoDBObjectInspector.java:98)
        ... 23 more

As a side note, since the connector does not support ProjectionExpression, there's also no way to avoid this attribute (if it was not significant to the query).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant