Skip to content

[Bug][Hive] Dynamic semijoin runtime filter still fails with NoDynamicValuesException after #9448 #11449

Backlog

Description

@Admaing

Search before asking

  • I searched in the issues and found nothing similar.

This is a follow-up to #9440. #9448 fixed the split-time IndexOutOfBoundsException for an empty BETWEEN literal list, but the query still fails later with DynamicValue$NoDynamicValuesException. I also checked the older open report #3802; it only covers the first-stage IndexOutOfBoundsException.

Paimon version

  • paimon-hive-connector-3.1 1.3.2
  • paimon-hive-connector-3.1 2.1.1
  • master at commit 4dc01acdb58ff131517bc58d2d67fe3b2e2a342c (2026-11-25) still has the same code path

Compute Engine

  • Hive 3.1.3
  • Tez 0.10.2
  • Hadoop 3.3.4
  • Java 8

Minimal reproduce step

Enable Tez dynamic semijoin reduction and run a join whose runtime filter is pushed into a Paimon table scan.

SET hive.execution.engine=tez;
SET hive.tez.dynamic.semijoin.reduction=true;

-- These two settings are test-only. They make the optimizer reliably produce
-- the dynamic runtime filter instead of a MapJoin in the test environment.
SET hive.auto.convert.join=false;
SET hive.tez.bigtable.minsize.semijoin.reduction=0;

SELECT /*+ SEMI(d, id, p) */ COUNT(*)
FROM codex_repro_9440.fact_9440 p
JOIN codex_repro_9440.dim_9440 d
  ON p.id = d.id
WHERE p.p_date >= DATE '2026-11-19'
  AND d.p_date >= DATE '2026-11-18'
  AND d.relation_category IN (1, 3);

The Paimon table is exposed to Hive through org.apache.paimon.hive.PaimonStorageHandler. A representative table definition is:

CREATE EXTERNAL TABLE codex_repro_9440.fact_9440 (
  id BIGINT,
  p_date DATE,
  payload STRING
)
STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
LOCATION '<your-paimon-table-location>';

CREATE EXTERNAL TABLE codex_repro_9440.dim_9440 (
  id BIGINT,
  relation_category INT,
  p_date DATE
)
STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
LOCATION '<your-paimon-table-location>';

EXPLAIN contains both of these predicates on the Paimon table scan:

id BETWEEN DynamicValue(RS_..._d_id_min) AND DynamicValue(RS_..._d_id_max)
and in_bloom_filter(id, DynamicValue(RS_..._d_id_bloom_filter))

I reproduced the same failure end-to-end with the customer-shaped query below; the important part is the /*+ SEMI(...) */ join and the runtime filter pushed to Paimon.

Customer-shaped query used for the 2.1.1 verification
SET hive.execution.engine=tez;
SET hive.tez.dynamic.partition.pruning=true;
SET hive.tez.dynamic.semijoin.reduction=true;
SET hive.stats.fetch.column.stats=true;
SET hive.disable.unsafe.external.table.operations=false;
SET hive.tez.bigtable.minsize.semijoin.reduction=0;
SET hive.auto.convert.join=false;
SET hive.vectorized.execution.enabled=true;
SET hive.cbo.enable=true;
SET tez.counters.max=500;

WITH videos AS
(
    SELECT /*+ SEMI(netceleb, id, v) */ v.id
          ,v.channel_id
          ,v.suggestion
          ,CAST(v.likes AS BIGINT) likes
          ,CAST(v.comments AS BIGINT) comments
          ,CAST(v.video_view AS BIGINT) video_view
          ,v.language
          ,v.pub_time
          ,IF(v.video_type IS NULL, '0', v.video_type) video_type
          ,v.is_live_stream
    FROM codex_repro_9440.video_9440 v
    JOIN codex_repro_9440.netceleb_9440 netceleb
      ON v.channel_id = netceleb.id
    WHERE v.data_mon >= '202302'
      AND v.channel_id IS NOT NULL
)
INSERT OVERWRITE TABLE codex_repro_9440.dw_netceleb_9440 PARTITION (data_dt = '20261125')
SELECT netceleb.id
      ,netceleb.country
      ,video_sen.total_video_view
      ,video_sen.total_videos
      ,netceleb.title
      ,netceleb.followers
      ,IF(video_sen.suggestion IS NOT NULL, CAST(video_sen.suggestion AS INT), NULL) suggestion
      ,netceleb.labels
      ,IF(b_kol.channel_id IS NOT NULL, 1,
          IF(white_data.channel_id IS NOT NULL, 0,
             IF(netceleb.suggestion = '0', 0, 1))) is_avoid
      ,IF(lan.language IS NULL, 'OTHERS', lan.language) language
      ,IF(white_data.channel_id IS NOT NULL, 1, 0) is_white
      ,video_sen.total_likes
      ,video_sen.total_comments
      ,video_sen.total_video_shorts
      ,video_sen.total_video_lives
      ,md.country_code mis_country
      ,md.languages mis_language
      ,aic.ai_country
FROM codex_repro_9440.netceleb_9440 netceleb
LEFT JOIN
(
    SELECT channel_id
          ,MAX(suggestion) suggestion
          ,COUNT(*) total_videos
          ,SUM(likes) total_likes
          ,SUM(comments) total_comments
          ,COUNT(IF(video_type = '1', id, NULL)) total_video_shorts
          ,COUNT(IF(is_live_stream = '1', id, NULL)) total_video_lives
          ,SUM(video_view) total_video_view
    FROM videos
    GROUP BY channel_id
) video_sen
ON netceleb.id = video_sen.channel_id
LEFT JOIN
(
    SELECT channel_id
          ,language
    FROM
    (
        SELECT channel_id
              ,language
              ,COUNT(id) language_cnt
              ,ROW_NUMBER() OVER (PARTITION BY channel_id ORDER BY COUNT(id) DESC, language ASC) cnt_rn
        FROM
        (
            SELECT id
                  ,channel_id
                  ,language
                  ,ROW_NUMBER() OVER (PARTITION BY channel_id ORDER BY pub_time DESC) rn
            FROM videos
            WHERE language IS NOT NULL
              AND lower(language) <> 'undefined'
              AND TRIM(language) <> ''
              AND TRIM(language) NOT LIKE '<%'
              AND TRIM(language) NOT LIKE '[%'
        ) tmp
        WHERE rn <= 30
        GROUP BY channel_id
                ,language
    ) t
    WHERE t.cnt_rn = 1
) lan
ON netceleb.id = lan.channel_id
LEFT JOIN
(
    SELECT channel_id
    FROM codex_repro_9440.white_9440
    WHERE platform = '1'
    GROUP BY channel_id
) white_data
ON netceleb.id = white_data.channel_id
LEFT JOIN
(
    SELECT id channel_id
    FROM codex_repro_9440.black_9440
    WHERE platform = '1'
    GROUP BY id
) b_kol
ON netceleb.id = b_kol.channel_id
LEFT JOIN
(
    SELECT channel_id
          ,country_code
          ,languages
    FROM codex_repro_9440.mis_9440
    WHERE data_dt = '20261125'
      AND platform = '1'
) md
ON netceleb.id = md.channel_id
LEFT JOIN
(
    SELECT channel_id
          ,ai_country
    FROM
    (
        SELECT platform
              ,channel_id
              ,create_time
              ,CONCAT('[', CONCAT_WS(',', SPLIT(REGEXP_REPLACE(upper(country_codes), ' ', ''), ',')), ']') ai_country
              ,ROW_NUMBER() OVER (PARTITION BY platform, channel_id ORDER BY create_time DESC) rn
        FROM codex_repro_9440.ai_9440
        WHERE country_codes IS NOT NULL
          AND TRIM(country_codes) <> ''
          AND platform = '1'
    ) tmp
    WHERE rn = 1
) aic
ON netceleb.id = aic.channel_id;

What doesn't meet your expectations?

1. Paimon 1.3.2 fails in split initialization (#9440)

ROOT_INPUT_INIT_FAILURE

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.get(ArrayList.java:433)
    at org.apache.paimon.hive.SearchArgumentToPredicateConverter.convertLeaf(
        SearchArgumentToPredicateConverter.java:163)
    at org.apache.paimon.hive.utils.HiveUtils.createPredicate(HiveUtils.java:96)
    at org.apache.paimon.hive.utils.HiveSplitGenerator.generateSplits(HiveSplitGenerator.java:68)
    at org.apache.paimon.hive.mapred.PaimonInputFormat.getSplits(PaimonInputFormat.java:45)

2. Only backporting the #9448 guard still fails in the task

After applying the three-line guard from #9448 to 1.3.2, the split-time IndexOutOfBoundsException disappears. The task then fails with:

Map 4 initializer / task failure

org.apache.hadoop.hive.ql.plan.DynamicValue$NoDynamicValuesException:
DynamicValueRegistry not available

    at org.apache.hadoop.hive.ql.plan.DynamicValue.getValue(DynamicValue.java:135)
    at org.apache.hadoop.hive.ql.plan.DynamicValue.getJavaValue(DynamicValue.java:97)
    at org.apache.hadoop.hive.ql.plan.DynamicValue.getLiteral(DynamicValue.java:93)
    at org.apache.hadoop.hive.ql.io.sarg.SearchArgumentImpl$PredicateLeafImpl.getLiteralList(
        SearchArgumentImpl.java:114)
    at org.apache.paimon.hive.SearchArgumentToPredicateConverter.convertLeaf(
        SearchArgumentToPredicateConverter.java:165)
    at org.apache.paimon.hive.SearchArgumentToPredicateConverter.convertTree(
        SearchArgumentToPredicateConverter.java:129)
    at org.apache.paimon.hive.SearchArgumentToPredicateConverter.convert(
        SearchArgumentToPredicateConverter.java:96)
    at org.apache.paimon.hive.utils.HiveUtils.createPredicate(HiveUtils.java:96)
    at org.apache.paimon.hive.mapred.PaimonRecordReader.createRecordReader(
        PaimonRecordReader.java:181)

3. The official 2.1.1 jar still fails

I replaced the jar with the official Maven Central paimon-hive-connector-3.1-2.1.1.jar
(SHA-256 8aa7b02e6793c63299656ce5072c0d33d87361e0d6d6fd8bde611b1294300b2c) and ran the same customer-shaped query.

Hive exit code: 2
YARN Final-State: SUCCEEDED
YARN Diagnostics: successfulDAGs=0, failedDAGs=1

org.apache.hadoop.hive.ql.plan.DynamicValue$NoDynamicValuesException:
DynamicValueRegistry not available

The task container manifest reported Implementation-Version: 2.1.1, and bytecode line 165 matches the published 2.1.1 connector, so this is not an old 1.3.2 class remaining on the classpath.

Root cause

#9448 added this guard:

List<Object> literalList = leaf.getLiteralList();
if (literalList == null || literalList.size() < 2) {
    throw new UnsupportedOperationException("BETWEEN literals are not available.");
}

However, when a Hive DynamicValue has no available registry, PredicateLeafImpl.getLiteralList() throws NoDynamicValuesException before it returns. The size check is therefore never reached.

SearchArgumentToPredicateConverter.convert() currently catches only UnsupportedOperationException, so NoDynamicValuesException escapes and fails the whole Tez DAG.

Current master still has the same behavior:

  • convert() catches only UnsupportedOperationException: code
  • the BETWEEN size guard is after getLiteralList(): code

Predicate pushdown is a best-effort optimization. An unavailable runtime value should drop only that leaf and let Hive evaluate the residual filter, instead of failing the query.

Apache Hive fixed the equivalent Parquet path in HIVE-30182 / apache/hive#6954 by catching NoDynamicValuesException and treating the leaf as “no filter”.

I also tested a targeted 1.3.2 backport that keeps the three-line #9448 guard and additionally catches NoDynamicValuesException around predicate conversion. The same forced query then completed with 20,000 rows and 20,000 distinct IDs, matching the control run with hive.tez.dynamic.semijoin.reduction=false.

Anything else?

Workaround:

SET hive.tez.dynamic.semijoin.reduction=false;

This avoids the failure but disables Tez dynamic semijoin reduction and can significantly increase data read/shuffle for large queries.

Related reports:

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions