Skip to content

[CALCITE-7541] Support Binary Arrow types#4957

Merged
caicancai merged 1 commit into
apache:mainfrom
caicancai:calcite-7541-binary-arrow-types
Jun 5, 2026
Merged

[CALCITE-7541] Support Binary Arrow types#4957
caicancai merged 1 commit into
apache:mainfrom
caicancai:calcite-7541-binary-arrow-types

Conversation

@caicancai
Copy link
Copy Markdown
Member

Jira Link

CALCITE-7541

Changes Proposed

/**
* Enumerator that reads projected Arrow value-vectors directly.
*/
class ArrowDirectEnumerator extends AbstractArrowEnumerator {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this related to the issue being addressed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, it is related. The existing projection path goes through Gandiva Projector, but Gandiva does not handle these Arrow binary vectors well in this case.

For this PR, the direct enumerator is only used for simple field projection without filters. It reads the selected Arrow vectors directly instead of asking Gandiva to project them. I added comments to make that scope clearer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought you want to get rid of Gandiva.
Do you still want to keep this new comment?
Will it be removed later?

Copy link
Copy Markdown
Member Author

@caicancai caicancai Jun 5, 2026

Choose a reason for hiding this comment

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

I will do this in another pull request. After merging this pull request, I will pull the latest branch code for modification.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

} catch (GandivaException e) {
throw Util.toUnchecked(e);
if (containsGandivaUnsupportedField(fields)) {
projector = null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you explain why is it ok for the projector to be null?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is intentional here. When there is no filter and the selected fields need direct vector projection, projector is left null and ArrowEnumerable falls back to ArrowDirectEnumerator.

So the cases are now:

  • projector: Gandiva projection
  • filter: Gandiva filter
  • neither: direct vector projection

I renamed the helper and added comments to make this contract explicit.

@caicancai caicancai force-pushed the calcite-7541-binary-arrow-types branch from b8633a7 to 8f05381 Compare June 4, 2026 03:26
@caicancai caicancai requested a review from mihaibudiu June 4, 2026 05:42
Copy link
Copy Markdown
Contributor

@mihaibudiu mihaibudiu left a comment

Choose a reason for hiding this comment

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

Since you want to get rid of Gandiva, does this PR still make sense?

/**
* Enumerator that reads projected Arrow value-vectors directly.
*/
class ArrowDirectEnumerator extends AbstractArrowEnumerator {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought you want to get rid of Gandiva.
Do you still want to keep this new comment?
Will it be removed later?


private boolean containsListField(ImmutableIntList fields) {
/** Returns whether selected fields should be projected by reading Arrow
* value-vectors directly rather than by creating a Gandiva projector.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same question

@caicancai caicancai added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Jun 5, 2026
@mihaibudiu
Copy link
Copy Markdown
Contributor

I have approved, so feel free to merge.

@caicancai caicancai force-pushed the calcite-7541-binary-arrow-types branch from 8f05381 to a36f41c Compare June 5, 2026 03:10
@caicancai
Copy link
Copy Markdown
Member Author

@mihaibudiu thank you for your review

@caicancai caicancai merged commit 39899bd into apache:main Jun 5, 2026
16 of 17 checks passed
@caicancai caicancai deleted the calcite-7541-binary-arrow-types branch June 5, 2026 03:41
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2026

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

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants