Skip to content

Conversation

@denodo-research-labs
Copy link
Contributor

@denodo-research-labs denodo-research-labs commented Jan 27, 2025

Description

Avoid batch reading (set with hive.parquet-batch-read-optimization-enabled=true) of nested decimals as this reader is not implemented.

Reading a nested decimal column defined as:

as_array_big_decimal: OPTIONAL F:1
.list:                REPEATED F:1
..element:            OPTIONAL INT32 L:DECIMAL(1,0) R:1 D:3

without this PR results in the following error:

java.lang.UnsupportedOperationException: com.facebook.presto.common.block.IntArrayBlock

	at com.facebook.presto.common.block.Block.getLong(Block.java:89)
	at com.facebook.presto.common.type.ShortDecimalType.getObjectValue(ShortDecimalType.java:77)
	at com.facebook.presto.common.type.ArrayType.arrayBlockToObjectValues(ArrayType.java:160)
	at com.facebook.presto.common.type.ArrayType.getObjectValue(ArrayType.java:151)
	at com.facebook.presto.hive.parquet.ParquetTester.decodeObject(ParquetTester.java:815)

Motivation and Context

Fixes #23877

Test Plan

Added tests that fail without this PR:

  • testNestedArraysDecimalBackedByINT32
  • testNestedArraysDecimalBackedByINT64
  • testNestedArraysShortDecimalBackedByBinary

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

Hive Connector Changes
* Fix Parquet read failing for nested Decimal types :pr:`24440`

@tdcmeehan tdcmeehan merged commit af6399a into prestodb:master Jan 29, 2025
52 checks passed
jp-sivaprasad pushed a commit to jp-sivaprasad/presto that referenced this pull request Mar 10, 2025
@prestodb-ci prestodb-ci mentioned this pull request Mar 28, 2025
30 tasks
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

Successfully merging this pull request may close these issues.

Reading complex types with decimals inside with 'hive.parquet-batch-read-optimization-enabled=true' results in error

2 participants