[#12988] fix(lance): reject nonempty Arrow input before table creation - #12989
Open
yuqi1129 wants to merge 3 commits into
Open
[#12988] fix(lance): reject nonempty Arrow input before table creation#12989yuqi1129 wants to merge 3 commits into
yuqi1129 wants to merge 3 commits into
Conversation
jerryshao
previously approved these changes
Sep 8, 2026
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comment on lines
78
to
90
| try (BufferAllocator allocator = new RootAllocator(); | ||
| ByteArrayInputStream bais = new ByteArrayInputStream(stream); | ||
| ArrowStreamReader reader = new ArrowStreamReader(bais, allocator)) { | ||
| schema = reader.getVectorSchemaRoot().getSchema(); | ||
| if (requireEmpty) { | ||
| while (reader.loadNextBatch()) { | ||
| if (reader.getVectorSchemaRoot().getRowCount() > 0) { | ||
| containsRows = true; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| } catch (Exception e) { |
Comment on lines
+1034
to
+1048
| private byte[] arrowStreamWithRecord() throws IOException { | ||
| try (VectorSchemaRoot root = VectorSchemaRoot.of(new IntVector("id", allocator)); | ||
| ByteArrayOutputStream output = new ByteArrayOutputStream(); | ||
| ArrowStreamWriter writer = new ArrowStreamWriter(root, null, output)) { | ||
| root.allocateNew(); | ||
| root.setRowCount(0); | ||
| writer.start(); | ||
| writer.writeBatch(); | ||
| ((IntVector) root.getVector("id")).setSafe(0, 42); | ||
| root.setRowCount(1); | ||
| writer.writeBatch(); | ||
| writer.end(); | ||
| return output.toByteArray(); | ||
| } | ||
| } |
Contributor
|
Can you fix the comments? |
Contributor
Author
Sure. |
Code Coverage Report
Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Reject Arrow IPC streams containing rows before CreateTable changes metadata or storage, including exist_ok and overwrite requests. Preserve schema-only and zero-row batch support.
Add parser unit tests and a CreateTable regression test in LanceRESTServiceIT, which is also present on branch-1.3.
Why are the changes needed?
CreateTable silently discards supplied rows and can overwrite an existing table with unsupported input.
Fix: #12988
Authentication, authorization, and error-response fixes remain in #12954. This PR contains only the Arrow fix so it can be backported independently of main's authentication changes.
Does this PR introduce any user-facing change?
Nonempty CreateTable streams return HTTP 406 before mutation. No authentication or configuration changes.
How was this patch tested?
All 71 lance-common unit tests passed (Gradle reused the unchanged passing results), and the relocated LanceRESTServiceIT regression passed, covering create, exist_ok, and overwrite without side effects.
Relevant Spotless formatting passed. The complete patch applies cleanly to branch-1.3 in a Git index check; it has not been run on that branch. Docker tests were not run.