[Flink] Filter pushdown of DOUBLE <= DECIMAL literal throws ValidationException: Invalid value for conversion to type double (java.math.BigDecimal)

オープン
#19,087 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@adiranjan25 がすでに取り組んでいます。

2026年11月22日 から。

  • #19098 @adiranjan25 による — オープン

評価

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

調査の方向性

The failure comes from FlinkFilters converting a DECIMAL literal to BigDecimal, which then fails in UnboundPredicate.bindLiteralOperation during ManifestGroup projection inside FlinkSplitPlanner.planIcebergSourceSplits. Start by reading the literal conversion in FlinkFilters and the bind path in UnboundPredicate. Done means a DOUBLE column compared with an uncast decimal literal plans and filters without ValidationException, but a pull request (#19098) is already open against this issue, so check it before starting.

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

説明

bug
Apache Iceberg version

1.11.0

Query engine

Flink

Please describe the bug 🐞

In Flink SQL batch mode, querying a non-empty Iceberg table with a comparison between a DOUBLE column and an uncast SQL decimal literal (for example WHERE score <= 14.3) crashes during split planning (even on EXPLAIN PLAN FOR) with:

org.apache.iceberg.exceptions.ValidationException: Invalid value for conversion to type double: 14.3 (java.math.BigDecimal)

Flink pushes filter=[<=(score, 14.3:DECIMAL(3, 1))] into IcebergTableSource. FlinkFilters converts the DECIMAL(3, 1) literal to java.math.BigDecimal and builds an Iceberg UnboundPredicate against the DOUBLE column score. When FlinkSplitPlanner.planIcebergSourceSplits evaluates manifests via ManifestGroup, UnboundPredicate.bindLiteralOperation fails to convert BigDecimal to Types.DoubleType and throws ValidationException.

In contrast:

  • Explicitly casting the literal (WHERE score <= CAST(14.3 AS DOUBLE)) passes planning and filter binding cleanly.
  • The exact same predicate WHERE score <= 14.3 on a pure Flink VALUES source (and on Apache Spark 3.5.5 + Iceberg 1.11.0, Trino 470, and DuckDB 2.0.0 against the same Iceberg table) succeeds without error.
  • Note that the table must have at least one committed data file so that ManifestGroup binds and evaluates the pushed filter.
Minimal Reproducer

Run in Flink 2.1.0 SQL Gateway / SQL Client with iceberg-flink-runtime-2.1-1.11.0.jar:

SET 'execution.runtime-mode' = 'batch';
SET 'table.dml-sync' = 'true';

CREATE CATALOG ic_r25 WITH (
  'type' = 'iceberg',
  'catalog-type' = 'hadoop',
  'warehouse' = 'file:///tmp/ic_r25_wh'
);

CREATE TABLE ic_r25.`default`.t_double (
  id INT,
  score DOUBLE
);

INSERT INTO ic_r25.`default`.t_double
VALUES
  (1, CAST(10.5 AS DOUBLE)),
  (2, CAST(20.0 AS DOUBLE));

-- Fails during planning with ValidationException:
EXPLAIN PLAN FOR
SELECT id,
  score
FROM ic_r25.`default`.t_double
WHERE score <= 14.3;

-- Also fails during execution with the same ValidationException:
SELECT id,
  score
FROM ic_r25.`default`.t_double
WHERE score <= 14.3;

-- Control: explicit CAST to DOUBLE passes planning & filter binding cleanly:
EXPLAIN PLAN FOR
SELECT id,
  score
FROM ic_r25.`default`.t_double
WHERE score <= CAST(14.3 AS DOUBLE);
Stacktrace (Flink 2.1.0 + iceberg-flink-runtime-2.1-1.11.0.jar)
Caused by: org.apache.iceberg.exceptions.ValidationException: Invalid value for conversion to type double: 14.3 (java.math.BigDecimal)
	at org.apache.iceberg.expressions.UnboundPredicate.bindLiteralOperation(UnboundPredicate.java:184)
	at org.apache.iceberg.expressions.UnboundPredicate.bind(UnboundPredicate.java:123)
	at org.apache.iceberg.expressions.Projections$BaseProjectionEvaluator.predicate(Projections.java:181)
	at org.apache.iceberg.expressions.Projections$BaseProjectionEvaluator.predicate(Projections.java:135)
	at org.apache.iceberg.expressions.ExpressionVisitors.visit(ExpressionVisitors.java:347)
	at org.apache.iceberg.expressions.Projections$BaseProjectionEvaluator.project(Projections.java:151)
	at org.apache.iceberg.ManifestGroup.lambda$entries$9(ManifestGroup.java:289)
	...
	at org.apache.iceberg.flink.source.FlinkSplitPlanner.planIcebergSourceSplits(FlinkSplitPlanner.java:77)
	at org.apache.iceberg.flink.source.IcebergSource.planSplitsForBatch(IcebergSource.java:159)
	at org.apache.iceberg.flink.source.IcebergSource.lambda$inferParallelism$0(IcebergSource.java:248)
	at org.apache.iceberg.flink.source.SourceUtil.inferParallelism(SourceUtil.java:65)
	at org.apache.iceberg.flink.source.IcebergSource.inferParallelism(IcebergSource.java:244)
	at org.apache.iceberg.flink.source.IcebergSource$Builder.buildStream(IcebergSource.java:652)
	at org.apache.iceberg.flink.source.IcebergTableSource.createFLIP27Stream(IcebergTableSource.java:148)
Expected Behavior

FlinkFilters should either:

  1. Avoid pushing down predicates whose literal Java/Flink type (BigDecimal / DECIMAL) is not accepted by Iceberg's UnboundPredicate.bind for the target column type (DOUBLE / FLOAT), letting Flink's Calc operator evaluate the filter safely; or
  2. Convert the BigDecimal literal to a valid bound for DOUBLE / FLOAT before constructing the Iceberg Expression.
Environment
  • Iceberg Runtime: iceberg-flink-runtime-2.1-1.11.0.jar (also reproduced on iceberg-flink-runtime-1.19-1.8.1.jar with REST catalog)
  • Flink Version: 2.1.0 (flink:2.1.0-scala_2.12-java17, also reproduced on 1.19.1)
  • Runtime Mode: batch
Willingness to contribute
  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time
主要言語
Java
スター
9.4k
フォーク
3.7k
平均マージ
2日 16時間
マージ済み PR(30日)
160

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/iceberg のほかの issue

apache/iceberg の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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