-
Notifications
You must be signed in to change notification settings - Fork 113
feat: Add BigObject Support for Handling Data Larger Than 2GB in Java #4067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
48a366c
Add BIG_OBJECT type support for Java
kunwp1 de199bd
Improve user-facing APIs
kunwp1 b1cd9a4
Fix unit tests
kunwp1 c3c8b35
Update APIs
kunwp1 f9a090f
Merge branch 'main' into chris-big-object-java
kunwp1 5ccf191
Merge branch 'main' into chris-big-object-java
kunwp1 b70292c
Merge branch 'main' into chris-big-object-java
kunwp1 e84fd4a
Add stream APIs
kunwp1 4a8d9b4
Remove execution id and tables
kunwp1 8e79ec9
Revert SQL
kunwp1 8c58a04
Fix test
kunwp1 633fe78
Merge branch 'main' into chris-big-object-java
kunwp1 3f04532
Update comments and rename function
kunwp1 437832b
Address comments
kunwp1 a226771
Merge branch 'main' into chris-big-object-java
kunwp1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
109 changes: 109 additions & 0 deletions
109
common/workflow-core/src/main/scala/org/apache/amber/core/tuple/BigObject.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.amber.core.tuple; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.annotation.JsonValue; | ||
| import org.apache.amber.core.executor.OperatorExecutor; | ||
| import org.apache.texera.service.util.BigObjectManager; | ||
|
|
||
| import java.net.URI; | ||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * BigObject represents a reference to a large object stored in S3. | ||
| * | ||
| * Each BigObject is identified by an S3 URI (s3://bucket/path/to/object). | ||
| * BigObjects are automatically tracked and cleaned up when the workflow execution completes. | ||
| */ | ||
| public class BigObject { | ||
|
|
||
| private final String uri; | ||
|
|
||
| /** | ||
| * Creates a BigObject from an existing S3 URI. | ||
| * Used primarily for deserialization from JSON. | ||
| * | ||
| * @param uri S3 URI in the format s3://bucket/path/to/object | ||
| * @throws IllegalArgumentException if URI is null or doesn't start with "s3://" | ||
| */ | ||
| @JsonCreator | ||
| public BigObject(@JsonProperty("uri") String uri) { | ||
| if (uri == null) { | ||
| throw new IllegalArgumentException("BigObject URI cannot be null"); | ||
| } | ||
| if (!uri.startsWith("s3://")) { | ||
| throw new IllegalArgumentException( | ||
| "BigObject URI must start with 's3://', got: " + uri | ||
| ); | ||
| } | ||
| this.uri = uri; | ||
| } | ||
|
|
||
| /** | ||
| * Creates a new BigObject for writing data. | ||
| * Generates a unique S3 URI. | ||
| * | ||
| * Usage example: | ||
| * | ||
| * BigObject bigObject = new BigObject(); | ||
| * try (BigObjectOutputStream out = new BigObjectOutputStream(bigObject)) { | ||
| * out.write(data); | ||
| * } | ||
| * // bigObject is now ready to be added to tuples | ||
| * | ||
| */ | ||
| public BigObject() { | ||
| this(BigObjectManager.create()); | ||
| } | ||
|
|
||
| @JsonValue | ||
| public String getUri() { | ||
| return uri; | ||
| } | ||
|
|
||
| public String getBucketName() { | ||
| return URI.create(uri).getHost(); | ||
| } | ||
|
|
||
| public String getObjectKey() { | ||
| String path = URI.create(uri).getPath(); | ||
| return path.startsWith("/") ? path.substring(1) : path; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return uri; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) return true; | ||
| if (!(obj instanceof BigObject)) return false; | ||
| BigObject that = (BigObject) obj; | ||
| return Objects.equals(uri, that.uri); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(uri); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.