-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Initial skeleton for the Delta Lake source #38571
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
chamikaramj
merged 1 commit into
apache:master
from
chamikaramj:initial_delta_lake_source
May 21, 2026
Merged
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| plugins { id 'org.apache.beam.module' } | ||
| applyJavaNature( | ||
| automaticModuleName: 'org.apache.beam.sdk.io.delta', | ||
| // Latest version of the Delta Kernel API requires Java 17. | ||
| requireJavaVersion: JavaVersion.VERSION_17, | ||
| ) | ||
|
|
||
| description = "Apache Beam :: SDKs :: Java :: IO :: Delta Lake" | ||
| ext.summary = "Integration with Delta Lake." | ||
|
|
||
|
|
||
| dependencies { | ||
| implementation project(path: ":sdks:java:core", configuration: "shadow") | ||
| implementation library.java.delta_kernel_api | ||
| implementation library.java.delta_kernel_defaults | ||
|
|
||
| permitUnusedDeclared library.java.delta_kernel_api | ||
| permitUnusedDeclared library.java.delta_kernel_defaults | ||
|
|
||
| testImplementation library.java.junit | ||
| } |
91 changes: 91 additions & 0 deletions
91
sdks/java/io/delta/src/main/java/org/apache/beam/sdk/io/delta/DeltaIO.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,91 @@ | ||
| /* | ||
| * 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.beam.sdk.io.delta; | ||
|
|
||
| import com.google.auto.value.AutoValue; | ||
| import java.util.Map; | ||
| import org.apache.beam.sdk.annotations.Internal; | ||
| import org.apache.beam.sdk.transforms.PTransform; | ||
| import org.apache.beam.sdk.values.PBegin; | ||
| import org.apache.beam.sdk.values.PCollection; | ||
| import org.apache.beam.sdk.values.Row; | ||
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
|
||
| /** | ||
| * A connector that reads from <a href="https://delta.io/">Delta Lake</a> tables. | ||
| * | ||
| * <p>This is work in progress. For more details and to track progress, please see <a | ||
| * href="https://github.com/apache/beam/issues/21100">Issue 21100</a>. | ||
| */ | ||
| @Internal | ||
| public class DeltaIO { | ||
|
|
||
| public static ReadRows readRows() { | ||
| return new AutoValue_DeltaIO_ReadRows.Builder().build(); | ||
| } | ||
|
|
||
| @AutoValue | ||
| public abstract static class ReadRows extends PTransform<PBegin, PCollection<Row>> { | ||
|
|
||
| public abstract @Nullable String getTablePath(); | ||
|
|
||
| public abstract @Nullable Long getVersion(); | ||
|
|
||
| public abstract @Nullable String getTimestamp(); | ||
|
|
||
| public abstract @Nullable Map<String, String> getHadoopConfig(); | ||
|
|
||
| abstract Builder toBuilder(); | ||
|
|
||
| @AutoValue.Builder | ||
| abstract static class Builder { | ||
| abstract Builder setTablePath(String tablePath); | ||
|
|
||
| abstract Builder setVersion(@Nullable Long version); | ||
|
|
||
| abstract Builder setTimestamp(@Nullable String timestamp); | ||
|
|
||
| abstract Builder setHadoopConfig(@Nullable Map<String, String> hadoopConfig); | ||
|
|
||
| abstract ReadRows build(); | ||
| } | ||
|
|
||
| public ReadRows from(String tablePath) { | ||
| return toBuilder().setTablePath(tablePath).build(); | ||
| } | ||
|
|
||
| public ReadRows withVersion(@Nullable Long version) { | ||
| return toBuilder().setVersion(version).build(); | ||
| } | ||
|
|
||
| public ReadRows withTimestamp(@Nullable String timestamp) { | ||
| return toBuilder().setTimestamp(timestamp).build(); | ||
| } | ||
|
|
||
| public ReadRows withConfig(Map<String, String> config) { | ||
| return toBuilder().setHadoopConfig(config).build(); | ||
|
chamikaramj marked this conversation as resolved.
|
||
| } | ||
|
|
||
| @Override | ||
| public PCollection<Row> expand(PBegin input) { | ||
| // TODO(https://github.com/apache/beam/issues/38551): Implement expansion for | ||
| // Delta Lake ReadRows | ||
| throw new UnsupportedOperationException("Not implemented yet."); | ||
| } | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
sdks/java/io/delta/src/main/java/org/apache/beam/sdk/io/delta/package-info.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,24 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| /** | ||
| * Transforms for reading from Delta Lake. | ||
| * | ||
| * @see org.apache.beam.sdk.io.delta.DeltaIO | ||
| */ | ||
| package org.apache.beam.sdk.io.delta; |
61 changes: 61 additions & 0 deletions
61
sdks/java/io/delta/src/test/java/org/apache/beam/sdk/io/delta/DeltaIOTest.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,61 @@ | ||
| /* | ||
| * 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.beam.sdk.io.delta; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import org.apache.beam.sdk.io.delta.DeltaIO.ReadRows; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
| import org.junit.runner.RunWith; | ||
| import org.junit.runners.JUnit4; | ||
|
|
||
| /** Unit tests for the {@link DeltaIO}. */ | ||
| @RunWith(JUnit4.class) | ||
| public class DeltaIOTest { | ||
|
|
||
| @Test | ||
| public void testReadRowsBuilderAndGetters() { | ||
| String tablePath = "/path/to/table"; | ||
| long version = 5L; | ||
| String timestamp = "2026-05-20T15:43:26Z"; | ||
| Map<String, String> hadoopConfig = new HashMap<>(); | ||
| hadoopConfig.put("fs.defaultFS", "file:///"); | ||
|
|
||
| ReadRows readRows = DeltaIO.readRows() | ||
| .from(tablePath) | ||
| .withVersion(version) | ||
| .withTimestamp(timestamp) | ||
| .withConfig(hadoopConfig); | ||
|
|
||
| Assert.assertEquals(tablePath, readRows.getTablePath()); | ||
| Assert.assertEquals(Long.valueOf(version), readRows.getVersion()); | ||
| Assert.assertEquals(timestamp, readRows.getTimestamp()); | ||
| Assert.assertEquals(hadoopConfig, readRows.getHadoopConfig()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testReadRowsNullDefaults() { | ||
| ReadRows readRows = DeltaIO.readRows(); | ||
|
|
||
| Assert.assertNull(readRows.getTablePath()); | ||
| Assert.assertNull(readRows.getVersion()); | ||
| Assert.assertNull(readRows.getTimestamp()); | ||
| Assert.assertNull(readRows.getHadoopConfig()); | ||
| } | ||
| } |
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
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.