Skip to content

[Bug] Query Hive catalog fails with NullPointerException after enabling enable_binary_search_filtering_partitions #64800

Description

@liutang123

Search before asking

  • I had searched in the issues and found no similar issues.

Version

3.1
maybe 4.0 and 4.1

What's Wrong?

After enabling the session variable enable_binary_search_filtering_partitions, queries against Hive external catalogs fail with a NullPointerException.
Error stack trace:

java.lang.NullPointerException: null value in entry: dt=2026-06-22=null
    at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)
    at com.google.common.collect.RegularImmutableMap.fromEntryArrayCheckingBucketOverflow(RegularImmutableMap.java:132)
    at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:98)
    at com.google.common.collect.RegularImmutableMap.fromEntries(RegularImmutableMap.java:81)
    at com.google.common.collect.ImmutableMap.copyOf(ImmutableMap.java:729)
    at com.google.common.collect.ImmutableMap.copyOf(ImmutableMap.java:702)
    at org.apache.doris.nereids.trees.plans.logical.LogicalFileScan$SelectedPartitions.<init>(LogicalFileScan.java:173)
    at org.apache.doris.nereids.rules.rewrite.PruneFileScanPartition.pruneExternalPartitions(PruneFileScanPartition.java:107)
    at org.apache.doris.nereids.rules.rewrite.PruneFileScanPartition.lambda$build$1(PruneFileScanPartition.java:64)
    ...

Root Cause:

In PruneFileScanPartition.java, the SortedPartitionRanges retrieved at partition pruning time differs from the partition list captured at query start — extra partitions (with null values) appear, causing ImmutableMap.copyOf() to throw NullPointerException when constructing SelectedPartitions.

What You Expected?

No NPE.

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions