apache / apache/arrow-java

[JDBC] Exception handling for non-simple types swallows actual error during processing

オープン
#94 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
94
フォーク
152
平均マージ
3日 16時間
マージ済み PR(30日)
11

説明

### Describe the bug, including details regarding any error messages, version, and platform.

It appears as though apache/arrow#39356 added support for better error messages when an error is encountered during JDBC processing. However, some `MinorType` such as Decimal (and various others) do not have an associated ArrowType and throw an exception trying to get the additional information leading to the original error being suppressed.

Decimal MinorType:
https://github.com/apache/arrow/blob/main/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java#L583

Callsite for suppressing error:
https://github.com/apache/arrow/blob/main/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java#L821

called from consumer (where minorType's arrow type is null)
https://github.com/apache/arrow/blob/main/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/consumer/CompositeJdbcConsumer.java#L55

```
java.lang.RuntimeException: Error occurred while consuming data.
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.consumeData(ArrowVectorIterator.java:121)
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.load(ArrowVectorIterator.java:164)
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.next(ArrowVectorIterator.java:183)
...
Caused by: java.lang.UnsupportedOperationException: Cannot get simple type for type DECIMAL
at org.apache.arrow.vector.types.Types$MinorType.getType(Types.java:821)
at org.apache.arrow.adapter.jdbc.consumer.CompositeJdbcConsumer.consume(CompositeJdbcConsumer.java:55)
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.consumeData(ArrowVectorIterator.java:107)
... 95 more
```

suppressed error (via debugger):
```
java.lang.UnsupportedOperationException: BigDecimal precision cannot be greater than that in the Arrow vector: 39 > 38
at org.apache.arrow.vector.util.DecimalUtility.checkPrecisionAndScale(DecimalUtility.java:99)
at org.apache.arrow.vector.DecimalVector.set(DecimalVector.java:365)
at org.apache.arrow.adapter.jdbc.consumer.DecimalConsumer.set(DecimalConsumer.java:79)
at org.apache.arrow.adapter.jdbc.consumer.DecimalConsumer$NullableDecimalConsumer.consume(DecimalConsumer.java:101)
at org.apache.arrow.adapter.jdbc.consumer.CompositeJdbcConsumer.consume(CompositeJdbcConsumer.java:50)
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.consumeData(ArrowVectorIterator.java:107)
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.load(ArrowVectorIterator.java:164)
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.next(ArrowVectorIterator.java:183)
```

It is somewhat difficult to come up with a simple reproduction, but I getting this error by rounding decimals that should be too large to fit into a `decimal(38,10)` -- if a decimal exceeds this (such as the numeric value of `99999999999999999999999999999.9999999999` which requires 39 digits of precision) this error is thrown.

This is happening on version 15.0.0 and up. (was not occurring in 14.0.X and below).

### Component(s)

Java

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

CompositeJdbcConsumer.consume から始め、次に Types.java、DecimalConsumer.java、ArrowVectorIterator.consumeData を調べて、元の Decimal 精度エラーがどのように置き換えられるかを追跡します。decimal(38,10) を超える JDBC 値を再現し、処理によって MinorType.getType() からの UnsupportedOperationException ではなく、基盤となる精度エラーが報告されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。