Skip to content

Conversation

@hdikeman
Copy link
Contributor

@hdikeman hdikeman commented Dec 10, 2025

Summary:
Since BIGINT ranges can sometimes be converted to values filters (i.e. if all the range filters are single value), sequential merging of several BIGINT ranges can cause a generic MultiRange filter to be created, which cannot be evaluated.

e.g. (id = 100 OR id = 200 OR id = 300)

is converted by HiveConnectorUtil::extractFiltersFromRemainingFilter in the following stages:

I1209 13:29:11.955765 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:584] tryMergeBigintRanges called with 2 disjuncts
I1209 13:29:11.955819 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:586]   Disjunct 0: BigintRange: [100, 100] no nulls
I1209 13:29:11.955826 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:586]   Disjunct 1: BigintRange: [200, 200] no nulls
I1209 13:29:11.955830 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:602] Creating BigintValues with 2 values
I1209 13:29:11.955852 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:584] tryMergeBigintRanges called with 2 disjuncts
I1209 13:29:11.955862 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:586]   Disjunct 0: Filter(BigintValuesUsingBitmask, deterministic, no nulls)
I1209 13:29:11.955871 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:586]   Disjunct 1: BigintRange: [300, 300] no nulls
W1209 13:29:11.955875 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:609] tryMergeBigintRanges returning nullptr - not all disjuncts are BigintRange/BigintMultiRange

The filter is instead merged into a generic MultiRange filter with bigint ranges, which cannot be evaluated:

Filter(MultiRange, deterministic, no nulls): testInt64Range() is not supported.

It appeared intentional that the generic MultiRange cannot support BigintRange evaluation, since there is a BigintMultiRange for that purpose. But an alternate fix could be to add evaluation support for bigint to MultiRange

Instead of converting to a MultiRange, merge logic should have explicit handling for BIGINT value filters so it can handle these gracefully

Also adding support for the following negative filters:

kNegatedBigintRange
kNegatedBigintValuesUsingHashTable
kNegatedBigintValuesUsingBitmask
Which can be converted to positive ranges before merge.

Differential Revision: D88789308

@netlify
Copy link

netlify bot commented Dec 10, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 1a77f08
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/6939e76fb2aa7c00088a0672

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 10, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 10, 2025

@hdikeman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88789308.

…r#15738)

Summary:

Since BIGINT ranges can sometimes be converted to values filters (i.e. if all the range filters are single value), sequential merging of several BIGINT ranges can cause a generic MultiRange filter to be created, which cannot be evaluated.

e.g. `(id = 100 OR id = 200 OR id = 300)`

is converted by HiveConnectorUtil::extractFiltersFromRemainingFilter in the following stages:
```
I1209 13:29:11.955765 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:584] tryMergeBigintRanges called with 2 disjuncts
I1209 13:29:11.955819 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:586]   Disjunct 0: BigintRange: [100, 100] no nulls
I1209 13:29:11.955826 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:586]   Disjunct 1: BigintRange: [200, 200] no nulls
I1209 13:29:11.955830 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:602] Creating BigintValues with 2 values
I1209 13:29:11.955852 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:584] tryMergeBigintRanges called with 2 disjuncts
I1209 13:29:11.955862 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:586]   Disjunct 0: Filter(BigintValuesUsingBitmask, deterministic, no nulls)
I1209 13:29:11.955871 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:586]   Disjunct 1: BigintRange: [300, 300] no nulls
W1209 13:29:11.955875 1472505 [CPUThreadPool0] ExprToSubfieldFilter.cpp:609] tryMergeBigintRanges returning nullptr - not all disjuncts are BigintRange/BigintMultiRange
```

The filter is instead merged into a generic MultiRange filter with bigint ranges, which cannot be evaluated:
```
Filter(MultiRange, deterministic, no nulls): testInt64Range() is not supported.
```
Generic MultiRange does not support BIGINT type by design. Instead of converting to a MultiRange, merge logic should have explicit handling for BIGINT value filters so it can handle these gracefully

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant