Skip to content

feat(workflow-core): require bucket and key in LargeBinary - #9634

Draft
Matthew-DWM wants to merge 1 commit into
apache:mainfrom
Matthew-DWM:feat/jvm-large-binary-uri-key
Draft

Matthew-DWM wants to merge 1 commit into
apache:mainfrom
Matthew-DWM:feat/jvm-large-binary-uri-key

Conversation

@Matthew-DWM

Copy link
Copy Markdown

What changes were proposed in this PR?

The JVM LargeBinary constructor only checked for null and the s3:// prefix, so s3://bucket, s3://bucket/ and s3:///object were accepted and failed later at S3 (or, once #9626 lands, in the next Python operator). It now parses the URI with java.net.URI, reading the bucket and key as the getters do, and throws IllegalArgumentException naming the URI when either is empty. As in #9626, all leading slashes are stripped first, so s3://bucket// and s3://bucket/?versionId=1 are rejected too.

Before:  new LargeBinary("s3://bucket") -> accepted, key ""  -> fails later inside S3
After:   new LargeBinary("s3://bucket") -> IllegalArgumentException: LargeBinary URI must include a bucket and object key, got: s3://bucket

Behavior changes:

  • A keyless URI now fails where it is parsed into a LARGE_BINARY field, read back from Iceberg or deserialized. URIs minted by new LargeBinary() always have a key.
  • A URI java.net.URI cannot parse, including a bare s3:// on JDK 17, gets LargeBinary URI is not a valid URI, got: ... with the parse error as the cause.
  • A bucket name with _ is rejected: java.net.URI reads no host from it, so the getters already returned null, and S3 bucket names can't contain _.

Any related issues, documentation, discussions?

Closes #9625. JVM side of #9626 (for #8279).

How was this PR tested?

In LargeBinarySpec, the case that pinned s3://bucket-only as accepted now expects rejection. New tests check the exact messages for six incomplete URIs and two unparseable ones, a keyless JSON payload, and that keys ending in / or holding non-ASCII characters are still accepted. The new tests were written before the fix and all pass with it; 3 of them fail on main with Expected exception ... but no exception was thrown.

With JDK 17 and Docker running, using CI's commands:

sbt "WorkflowCore/testOnly org.apache.texera.amber.core.tuple.LargeBinarySpec"
15 passed

sbt scalafmtCheckAll "scalafixAll --check"
sbt WorkflowCore/jacoco WorkflowOperator/jacoco WorkflowCompiler/jacoco WorkflowExecutionService/jacoco
888, 3014, 87 and 2433 passed, with AMBER_TEST_FILTER=skip-integration

sbt WorkflowOperator/test WorkflowExecutionService/test
85 and 47 passed, with AMBER_TEST_FILTER=integration-only

The service modules built on workflow-core pass too, and WorkflowCore/jacoco covers every changed line and branch.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)

The LargeBinary constructor only checked for null and the "s3://" prefix,
so references such as "s3://bucket", "s3://bucket/" or "s3:///object" were
accepted and failed later, when a stream reached S3, or, once the Python
check lands, in the next Python operator. The constructor now parses the
URI and rejects it when java.net.URI finds no host or the path is empty
after removing every leading slash, with the Python check's wording:
"LargeBinary URI must include a bucket and object key, got: <uri>".

A URI that java.net.URI cannot parse, including a bare "s3://" on JDK 17,
is rejected as "not a valid URI", with the parse error as the cause. Bucket
names containing "_", which java.net.URI reads as having no host and the
getters cannot use either, are now rejected too.
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @kunwp1, @aglinxinyuan
    You can notify them by mentioning @kunwp1, @aglinxinyuan in a comment.

@Matthew-DWM
Matthew-DWM marked this pull request as draft November 23, 2026 17:49

This branch has not been deployed

No deployments
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.

JVM large binary accepts incomplete S3 references

1 participant