Skip to content

Check the current row's NULL flag in multi-value IN transformers - #19544

Open
amalsaidov wants to merge 1 commit into
apache:masterfrom
amalsaidov:fix-in-multi-column-null-index
Open

amalsaidov wants to merge 1 commit into
apache:masterfrom
amalsaidov:fix-in-multi-column-null-index

Conversation

@amalsaidov

Copy link
Copy Markdown
Contributor

Description

Fixes the first part of #19435 (wrong row index in the NULL check of the multi-value IN transformers). The narrowing/truncation part of that issue is left for a separate change.

When a multi-value IN list contains a non-literal item (a column, an arithmetic expression, a non-folded CAST), ColumnTransformerBuilder evaluates it per row in In*MultiColumnTransformer.satisfy(childrenColumns, index). All six subclasses checked the item's NULL flag with the operand loop variable i instead of the row index:

if (!valueColumn.isNull(i)) {                       // operand index
  if (valueType.getInt(valueColumn, index) == value) // row index

So:

  • on a block with fewer rows than IN operands that has a NULL bitmap, e.g. a one-row block for x IN (1, y), valueColumn.isNull(1) throws ArrayIndexOutOfBoundsException;
  • otherwise the flag of another row is used: a row whose item is NULL can match through the value stored in its NULL slot, and a row with a non-NULL matching item can be skipped because another row's item is NULL.

The fix uses isNull(index) in InInt32/InInt64/InFloat/InDouble/InBinary/InBooleanMultiColumnTransformer.

InMultiColumnTransformerTest (calc-commons) covers the one-row case and the wrong-row NULL flag for all six types, with and without a selection; all three tests fail on master. mvn spotless:check test -pl iotdb-core/calc-commons passes.


This PR has:

  • been self-reviewed.
  • added unit tests or modified existing tests to cover new code paths.

The In*MultiColumnTransformer subclasses looked up the NULL flag of a
non-literal IN item with the operand index instead of the row index, so
they read the wrong row's flag and threw ArrayIndexOutOfBoundsException
when the block had fewer rows than IN operands.

Part of apache#19435.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant