Skip to content

[BugFix] fix arrow flight empty set column name is 'r'#71534

Merged
satanson merged 1 commit into
StarRocks:mainfrom
Wenjun7J:arrow_flight/limit_column_name
Apr 14, 2026
Merged

[BugFix] fix arrow flight empty set column name is 'r'#71534
satanson merged 1 commit into
StarRocks:mainfrom
Wenjun7J:arrow_flight/limit_column_name

Conversation

@Wenjun7J

@Wenjun7J Wenjun7J commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Why I'm doing:

For query return empty set, like select * from table.t1 limit 0, this will return column name 'r' , 'r'.

The column name is set as 'r' to be a placeholder. But if no data arrived, the jdbc driver will not replace it with correct names.

What I'm doing:

Print the correct column schema. But the jdbc driver still has a bug and will return double column names. apache/arrow-java#44
Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5
    • 3.4

@Wenjun7J Wenjun7J changed the title fix arrow flight empty set column name is 'r' [BugFix] fix arrow flight empty set column name is 'r' Apr 10, 2026
@Wenjun7J Wenjun7J force-pushed the arrow_flight/limit_column_name branch from bbaf8ae to 7889511 Compare April 13, 2026 03:15
@CelerData-Reviewer

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7889511be5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Wenjun7J Wenjun7J force-pushed the arrow_flight/limit_column_name branch from 7889511 to 1e276ea Compare April 13, 2026 03:28
Signed-off-by: SevenJ <wenjun7j@gmail.com>
@Wenjun7J Wenjun7J force-pushed the arrow_flight/limit_column_name branch from 1e276ea to 1d952a6 Compare April 13, 2026 03:36
@github-actions

Copy link
Copy Markdown
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

Copy link
Copy Markdown
Contributor

[FE Incremental Coverage Report]

pass : 31 / 32 (96.88%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/service/arrow/flight/sql/ArrowFlightSqlServiceImpl.java 31 32 96.88% [917]

@github-actions

Copy link
Copy Markdown
Contributor

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copilot AI left a comment

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.

Pull request overview

This PR fixes Arrow Flight SQL createPreparedStatement returning a placeholder column name (e.g., "r") for queries that produce empty result sets, by deriving and returning the analyzed output schema (column names/types) instead of a hard-coded placeholder.

Changes:

  • Update createPreparedStatement to analyze query statements and build an Arrow Schema from analyzed output expressions.
  • Add placeholder-schema fallback for non-query statements / analysis failures.
  • Extend unit tests to validate analyzed schema output, fallback behavior, and that ConnectContext thread-local state is restored.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
fe/fe-core/src/main/java/com/starrocks/service/arrow/flight/sql/ArrowFlightSqlServiceImpl.java Build prepared-statement dataset schema from analyzed query output instead of returning a placeholder "r" schema.
fe/fe-core/src/test/java/com/starrocks/service/arrow/flight/sql/ArrowFlightSqlServiceImplTest.java Add tests asserting prepared-statement schema matches analyzed columns/types and that thread-local ConnectContext is restored.

@satanson satanson merged commit 2535348 into StarRocks:main Apr 14, 2026
69 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@Mergifyio backport branch-4.1

@github-actions github-actions Bot removed the 4.1 label Apr 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@Mergifyio backport branch-4.0

@github-actions github-actions Bot removed the 4.0 label Apr 14, 2026
@mergify

mergify Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

backport branch-4.1

✅ Backports have been created

Details

@mergify

mergify Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

backport branch-4.0

✅ Backports have been created

Details

Cherry-pick of 2535348 has failed:

On branch mergify/bp/branch-4.0/pr-71534
Your branch is up to date with 'origin/branch-4.0'.

You are currently cherry-picking commit 25353486f7.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   fe/fe-core/src/test/java/com/starrocks/service/arrow/flight/sql/ArrowFlightSqlServiceImplTest.java

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   fe/fe-core/src/main/java/com/starrocks/service/arrow/flight/sql/ArrowFlightSqlServiceImpl.java

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

mergify Bot pushed a commit that referenced this pull request Apr 14, 2026
Signed-off-by: SevenJ <wenjun7j@gmail.com>
(cherry picked from commit 2535348)
mergify Bot pushed a commit that referenced this pull request Apr 14, 2026
Signed-off-by: SevenJ <wenjun7j@gmail.com>
(cherry picked from commit 2535348)

# Conflicts:
#	fe/fe-core/src/main/java/com/starrocks/service/arrow/flight/sql/ArrowFlightSqlServiceImpl.java
@Wenjun7J Wenjun7J deleted the arrow_flight/limit_column_name branch April 15, 2026 05:31
Wenjun7J added a commit to Wenjun7J/starrocks that referenced this pull request Apr 15, 2026
Signed-off-by: SevenJ <wenjun7j@gmail.com>
(cherry picked from commit 2535348)
Wenjun7J added a commit to Wenjun7J/starrocks that referenced this pull request Apr 15, 2026
Signed-off-by: SevenJ <wenjun7j@gmail.com>
(cherry picked from commit 2535348)
Wenjun7J added a commit to Wenjun7J/starrocks that referenced this pull request Apr 21, 2026
Signed-off-by: SevenJ <wenjun7j@gmail.com>
(cherry picked from commit 2535348)
Signed-off-by: SevenJ <wenjun7j@gmail.com>
Wenjun7J added a commit to Wenjun7J/starrocks that referenced this pull request Apr 21, 2026
Signed-off-by: SevenJ <wenjun7j@gmail.com>
(cherry picked from commit 2535348)
Signed-off-by: SevenJ <wenjun7j@gmail.com>
satanson pushed a commit that referenced this pull request Apr 22, 2026
…) (#71736)

Signed-off-by: SevenJ <wenjun7j@gmail.com>
satanson pushed a commit that referenced this pull request Apr 22, 2026
…) (#71735)

Signed-off-by: SevenJ <wenjun7j@gmail.com>
wanpengfei-git pushed a commit that referenced this pull request Apr 30, 2026
…) (#71632)

Signed-off-by: SevenJ <wenjun7j@gmail.com>
Co-authored-by: SevenJ <166966490+Wenjun7J@users.noreply.github.com>
wanpengfei-git pushed a commit that referenced this pull request May 5, 2026
…) (backport #71736) (#72747)

Signed-off-by: SevenJ <wenjun7j@gmail.com>
Co-authored-by: SevenJ <166966490+Wenjun7J@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants