Skip to content

[#12988] fix(lance): reject nonempty Arrow input before table creation - #12989

Open
yuqi1129 wants to merge 3 commits into
apache:mainfrom
yuqi1129:fix/lance-rest-create-and-errors
Open

[#12988] fix(lance): reject nonempty Arrow input before table creation#12989
yuqi1129 wants to merge 3 commits into
apache:mainfrom
yuqi1129:fix/lance-rest-create-and-errors

Conversation

@yuqi1129

@yuqi1129 yuqi1129 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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.

Copilot AI lite review requested due to automatic review settings September 8, 2026 09:06

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yuqi1129 yuqi1129 changed the title [#12988] fix(lance): reject unsupported table data and preserve backend errors [#12988] fix(lance): reject nonempty Arrow input before table creation Sep 8, 2026
@jerryshao
jerryshao requested a lite review from Copilot September 8, 2026 09:18
jerryshao
jerryshao previously approved these changes Sep 8, 2026

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.

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();
}
}
@jerryshao

Copy link
Copy Markdown
Contributor

Can you fix the comments?

@yuqi1129

yuqi1129 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Can you fix the comments?

Sure.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Code Coverage Report

Overall Project 69.58% +0.07% 🟢
Files changed 73.45% 🟢

Module Coverage
aliyun 19.74% 🔴
api 51.57% 🟢
authorization-common 85.96% 🟢
authorization-ranger 4.38% 🔴
aws 53.54% 🟢
azure 32.1% 🔴
catalog-common 22.89% +7.06% 🔴
catalog-fileset 82.17% 🟢
catalog-glue 69.8% 🟢
catalog-hive 82.96% 🟢
catalog-jdbc-common 45.09% 🟢
catalog-jdbc-doris 82.69% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-postgresql 83.83% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 76.99% 🟢
catalog-lakehouse-generic 60.88% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.9% 🟢
catalog-lakehouse-paimon 84.29% 🟢
catalog-model 77.99% 🟢
cli 44.51% 🟢
client-java 77.5% 🟢
common 56.89% 🟢
core 84.39% -0.1% 🟢
filesystem-hadoop3 76.48% 🟢
flink 0.0% 🔴
flink-common 53.22% 🟢
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 17.84% 🔴
hive-metastore-common 53.5% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 66.58% 🟢
iceberg-rest-server 76.59% 🟢
idp-basic 87.1% 🟢
integration-test-common 0.0% 🔴
jobs 62.92% 🟢
lance-common 33.3% -5.09% 🔴
lance-rest-server 68.12% 🟢
lineage 59.39% 🟢
optimizer 83.17% 🟢
optimizer-api 21.95% 🔴
server 90.11% +0.4% 🟢
server-common 81.27% -0.77% 🟢
spark 56.27% 🟢
tencent 81.78% 🟢
trino-connector 58.36% 🟢
Files
Module File Coverage
catalog-common IcebergPropertiesUtils.java 97.96% 🟢
IcebergConstants.java 0.0% 🔴
core AccessControlManager.java 100.0% 🟢
FunctionVersionMetaBaseSQLProvider.java 100.0% 🟢
FunctionMetaPostgreSQLProvider.java 100.0% 🟢
FunctionVersionMetaPostgreSQLProvider.java 100.0% 🟢
FunctionMetaService.java 100.0% 🟢
FunctionVersionMetaSQLProviderFactory.java 95.24% 🟢
AccessControlEventDispatcher.java 90.56% 🟢
FunctionMetaSQLProviderFactory.java 80.77% 🟢
NameIdentifierUtil.java 74.06% 🟢
FunctionMetaBaseSQLProvider.java 70.59% 🟢
FunctionPOStorageOps.java 40.0% 🔴
AccessControlHookDispatcher.java 34.83% 🔴
AccessControlDispatcher.java 0.0% 🔴
AzurePropertiesMetadata.java 0.0% 🔴
FunctionMetaMapper.java 0.0% 🔴
FunctionVersionMetaMapper.java 0.0% 🔴
lance-common ArrowUtils.java 90.91% 🟢
GravitinoLanceTableOperations.java 2.88% 🔴
server BulkOperations.java 98.13% 🟢
GravitinoInterceptionService.java 93.29% 🟢
server-common MetadataAuthzHelper.java 70.35% 🟢

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

Labels

branch-1.3 Automatically cherry-pick commit to branch-1.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug report] Lance REST CreateTable silently discards Arrow input rows

3 participants