Skip to content

[ES|QL] Change equals and hashcode for ConstantNullBlock #131817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

limotova
Copy link
Contributor

@limotova limotova commented Jul 24, 2025

Currently in ES|QL if you have a ConstantNullBlock and a DoubleBlock (or
any other standard block type: Boolean, BytesRef, Float, Int, Long) and
your DoubleBlock can be represented as a ConstantNullBlock, then
doubleBlock.equals(constantNullBlock) can evaluate as true (if
position count is the same).

However, constantNullBlock.equals(anyDoubleBlock) is always false.
Likewise, the hashcodes of these two blocks are different, even if
doubleBlock.equals(constantNullBlock) returns true.
This PR addresses that by making the hashcodes equivalent and the equals
functions symmetric in returning true.

@limotova limotova marked this pull request as ready for review July 24, 2025 20:00
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jul 24, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @limotova, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@limotova limotova requested review from dnhatn and nik9000 July 24, 2025 20:01
Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks Larisa!

@nik9000
Copy link
Member

nik9000 commented Jul 24, 2025

However, constantNullBlock.equals(anyDoubleBlock) is always false.

💀

@limotova limotova added auto-backport Automatically create backport pull requests when merged v9.1.1 v8.19.1 labels Jul 24, 2025
@limotova limotova merged commit 80ae7ec into elastic:main Jul 24, 2025
33 checks passed
@limotova limotova deleted the match-equals-and-hashcodes-for-null-blocks branch July 24, 2025 23:39
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.1
8.19

limotova added a commit to limotova/elasticsearch that referenced this pull request Jul 24, 2025
)

Currently in ES|QL if you have a ConstantNullBlock and a DoubleBlock (or
any other standard block type: Boolean, BytesRef, Float, Int, Long) and
your DoubleBlock can be represented as a ConstantNullBlock, then
`doubleBlock.equals(constantNullBlock)` can evaluate as `true` (if
position count is the same).

However, `constantNullBlock.equals(anyDoubleBlock)` is always false.
Likewise, the hashcodes of these two blocks are different, even if
`doubleBlock.equals(constantNullBlock)` returns true.
This PR addresses that by making the hashcodes equivalent and the equals
functions symmetric in returning true.
szybia added a commit to szybia/elasticsearch that referenced this pull request Jul 25, 2025
…king

* upstream/main: (90 commits)
  Register a blob cache long counter metric for total evicted regions (elastic#131862)
  Move plan attribute resolution to its own component (elastic#131830)
  Make restore support multi-project (elastic#131661)
  Use logically more correct expression (elastic#131869)
  [ES|QL] Change equals and hashcode for ConstantNullBlock (elastic#131817)
  Update `TransportVersion` to support a new model (elastic#131488)
  Correct slow log user for RCS 2.0 (elastic#130140)
  Revert "Remove 8.17 from dev branches"
  Mute org.elasticsearch.compute.aggregation.ValuesBytesRefGroupingAggregatorFunctionTests testSomeFiltered elastic#131878
  Remove 8.17 from dev branches
  Revert "CompressorFactory.compressor (elastic#131655)" (elastic#131866)
  Add fast path for single value in VALUES aggregator (elastic#130510)
  Resolve inference release tests failing due to missing feature flag  (elastic#131841)
  [Docs] Replace placeholder URLs (elastic#131309)
  CompressorFactory.compressor (elastic#131655)
  add availability info for speed loading setting (elastic#131714)
  [Logstash] Move `elastic_integration` plugin usage to ES logstash-bridge. (elastic#131486)
  Migrate x-pack-enrich legacy rest tests to new test framework (elastic#131743)
  Fix plugin example test failures due to deprecation warning (elastic#131819)
  Remove deprecated function isNotNullAndFoldable (elastic#130944)
  ...
elasticsearchmachine pushed a commit that referenced this pull request Jul 25, 2025
…131892)

Currently in ES|QL if you have a ConstantNullBlock and a DoubleBlock (or
any other standard block type: Boolean, BytesRef, Float, Int, Long) and
your DoubleBlock can be represented as a ConstantNullBlock, then
`doubleBlock.equals(constantNullBlock)` can evaluate as `true` (if
position count is the same).

However, `constantNullBlock.equals(anyDoubleBlock)` is always false.
Likewise, the hashcodes of these two blocks are different, even if
`doubleBlock.equals(constantNullBlock)` returns true.
This PR addresses that by making the hashcodes equivalent and the equals
functions symmetric in returning true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.1 v9.1.1 v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy