You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "derrickaw (via GitHub)" <gi...@apache.org> on 2026/06/21 17:54:34 UTC

[PR] [wip] delta lake yaml [beam]

derrickaw opened a new pull request, #39052:
URL: https://github.com/apache/beam/pull/39052

   **Please** add a meaningful description for your change here
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/actions/workflows/build_wheels.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/actions/workflows/python_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/actions/workflows/java_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/actions/workflows/go_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] delta lake python/yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on PR #39052:
URL: https://github.com/apache/beam/pull/39052#issuecomment-4859652080

   Ok, Precommit Java and Code Completion failures are finally resolved. :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] delta lake python/yaml [beam]

Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3464439706


##########
.github/workflows/beam_PostCommit_Yaml_Xlang_Direct.yml:
##########
@@ -75,8 +75,8 @@ jobs:
         with:
           python-version: default
           java-version: |
-            17

Review Comment:
   "11 17" is effectively same as "17". Either change to 17 (and remove java17Home parameter) or add a "testJavaVersion=17" parameter and make the target honors it (like in https://github.com/apache/beam/pull/39064/changes#diff-0435a83a413ec063bf7e682cadcd56776cd18fc878f197cc99a65fc231ef2047)



##########
.github/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml:
##########
@@ -103,8 +103,8 @@ jobs:
         uses: ./.github/actions/setup-environment-action
         with:
           java-version: |
-            17
             11
+            17

Review Comment:
   Same as above



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462306831


##########
sdks/java/io/delta/src/test/java/org/apache/beam/sdk/io/delta/DeltaReadSchemaTransformProviderTest.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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 static org.apache.beam.sdk.io.delta.DeltaReadSchemaTransformProvider.Configuration;
+import static org.apache.beam.sdk.io.delta.DeltaReadSchemaTransformProvider.OUTPUT_TAG;
+
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import org.apache.avro.generic.GenericRecord;
+import org.apache.beam.sdk.extensions.avro.coders.AvroCoder;
+import org.apache.beam.sdk.extensions.avro.schemas.utils.AvroUtils;
+import org.apache.beam.sdk.io.Compression;
+import org.apache.beam.sdk.io.FileIO;
+import org.apache.beam.sdk.io.parquet.ParquetIO;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.transforms.windowing.PaneInfo;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PCollectionRowTuple;
+import org.apache.beam.sdk.values.Row;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link DeltaReadSchemaTransformProvider}. */
+@RunWith(JUnit4.class)
+public class DeltaReadSchemaTransformProviderTest {
+
+  @Rule public TestPipeline writePipeline = TestPipeline.create();
+  @Rule public TestPipeline readPipeline = TestPipeline.create();
+  @Rule public TemporaryFolder tempFolder = new TemporaryFolder();
+
+  @Test
+  public void testBuildTransformWithRow() {
+    java.util.Map<String, String> hadoopConfig = new java.util.HashMap<>();
+    hadoopConfig.put("fs.gs.project.id", "test-project");
+
+    Row config =
+        Row.withSchema(new DeltaReadSchemaTransformProvider().configurationSchema())
+            .withFieldValue("table", "/path/to/table")
+            .withFieldValue("version", 5L)
+            .withFieldValue("timestamp", "2026-06-04T12:00:00Z")
+            .withFieldValue("hadoop_config", hadoopConfig)
+            .build();
+
+    new DeltaReadSchemaTransformProvider().from(config);
+  }
+
+  @Test
+  public void testSimpleScan() throws Exception {
+    File tableDir = tempFolder.newFolder("delta-table-simple");
+
+    // 1. Write a Parquet file using Beam
+    Schema schema = Schema.builder().addField("name", Schema.FieldType.STRING).build();
+    Row row = Row.withSchema(schema).addValues("test-name").build();
+
+    org.apache.avro.Schema avroSchema = AvroUtils.toAvroSchema(schema);
+    GenericRecord record = AvroUtils.toGenericRecord(row, avroSchema);
+
+    writePipeline
+        .apply("Create Input", Create.of(record).withCoder(AvroCoder.of(avroSchema)))
+        .apply(
+            "Write Parquet",
+            FileIO.<GenericRecord>write()
+                .via(ParquetIO.sink(avroSchema))
+                .to(tableDir.getAbsolutePath() + "/")
+                .withNaming(
+                    (BoundedWindow window,
+                        PaneInfo paneInfo,
+                        int numShards,
+                        int shardIndex,
+                        Compression compression) -> "part-00000.parquet"));
+
+    writePipeline.run().waitUntilFinish();
+
+    File parquetFile = new File(tableDir, "part-00000.parquet");
+    byte[] fileBytes = Files.readAllBytes(parquetFile.toPath());
+
+    // 2. Create the Delta log
+    File logDir = new File(tableDir, "_delta_log");
+    logDir.mkdirs();

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `File.mkdirs()` ignores the return value, which can lead to silent failures if directory creation fails. It is safer and more idiomatic to use `Files.createDirectories(logDir.toPath())` which throws an `IOException` on failure.
   
   ```suggestion
       Files.createDirectories(logDir.toPath());
   ```



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -68,6 +69,8 @@ def get_impl(self):
     None, lambda payload, components, context: BigEndianIntegerCoder())
 
 import psycopg2
+import pyarrow as pa
+import pyarrow.parquet as pq

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Importing `pyarrow` at the module level can cause `ImportError` when running other tests in environments where `pyarrow` is not installed. It is safer to import them lazily inside the `temp_delta_table` function.
   
   ```suggestion
   # pyarrow is imported lazily inside temp_delta_table
   ```



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Import `pyarrow` and `pyarrow.parquet` lazily inside the context manager to avoid module-level import errors when these optional dependencies are not installed.
   
   ```suggestion
   @contextlib.contextmanager
   def temp_delta_table():
     import pyarrow as pa
     import pyarrow.parquet as pq
     with tempfile.TemporaryDirectory() as temp_dir:
   ```



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:
+    log_dir = os.path.join(temp_dir, "_delta_log")
+    os.makedirs(log_dir, exist_ok=True)
+    table_data = pa.table({"name": ["a", "b", "c"]})
+    parquet_path = os.path.join(temp_dir, "part-00000.parquet")
+    pq.write_table(table_data, parquet_path)
+    file_size = os.path.getsize(parquet_path)
+    commit_content = (
+        '{"protocol":{"minReaderVersion":1,"minWriterVersion":2}}\n'
+        '{"metaData":{"id":"test-id","format":{"provider":"parquet","options":{}},"schemaString":"{\\"type\\":\\"struct\\",\\"fields\\":[{\\"name\\":\\"name\\",\\"type\\":\\"string\\",\\"nullable\\":true,\\"metadata\\":{}}]}","partitionColumns":[],"configuration":{},"createdAt":123456789}}\n'
+        f'{{"add":{{"path":"part-00000.parquet","partitionValues":{{}},"size":{file_size},"modificationTime":123456789,"dataChange":true}}}}\n'
+    )
+    commit_file = os.path.join(log_dir, "00000000000000000000.json")
+    with open(commit_file, "w") as f:

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Specify `encoding="utf-8"` when opening files for writing to ensure consistent behavior across different platforms (e.g., Windows, where the default encoding might not be UTF-8).
   
   ```suggestion
       with open(commit_file, "w", encoding="utf-8") as f:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462322787


##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -68,6 +69,8 @@ def get_impl(self):
     None, lambda payload, components, context: BigEndianIntegerCoder())
 
 import psycopg2
+import pyarrow as pa
+import pyarrow.parquet as pq

Review Comment:
   ignore



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:

Review Comment:
   ignore



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #39052:
URL: https://github.com/apache/beam/pull/39052#issuecomment-4782607470

   ## Summary of Changes
   
   Hello, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
   
   This pull request introduces support for reading Delta Lake tables in Apache Beam's YAML SDK. It adds the necessary infrastructure to manage Delta Lake read transforms, including updating the expansion service, defining the read transform, and providing comprehensive integration tests to ensure functionality.
   
   ### Highlights
   
   * **Delta Lake Integration**: Added support for reading Delta Lake tables within the Beam YAML SDK.
   * **Testing Infrastructure**: Implemented a new integration test for Delta Lake reading and added a corresponding temporary table fixture.
   * **Expansion Service**: Updated the expansion service configuration to include the Delta Lake IO module.
   
   <details>
   <summary><b>New Features</b></summary>
   
   🧠 You can now enable **Memory** (public preview) to help **Gemini Code Assist** learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. **Click [here](https://codeassist.google/code-review/login) to enable Memory in your admin console.**
   </details>
   
   <details>
   <summary><b>Ignored Files</b></summary>
   
   *   **Ignored by pattern:** `.github/workflows/**` (3)
       *   .github/workflows/beam_PostCommit_Yaml_Xlang_Direct.yml
       *   .github/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml
       *   .github/workflows/beam_PreCommit_Yaml_Xlang_Direct.yml
   </details>
   
   <details>
   <summary><b>Using Gemini Code Assist</b></summary>
   <br>
   
   The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.
   
   <b>Invoking Gemini</b>
   
   You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page.
   
   Feature | Command | Description
   --- | --- | ---
   Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
   Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
   Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments.
   Help | `/gemini help` | Displays a list of available commands.
   
   <b>Customization</b>
   
   To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   <b>Limitations & Feedback</b>
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up [here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   </details>
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462350237


##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:
+    log_dir = os.path.join(temp_dir, "_delta_log")
+    os.makedirs(log_dir, exist_ok=True)
+    table_data = pa.table({"name": ["a", "b", "c"]})
+    parquet_path = os.path.join(temp_dir, "part-00000.parquet")
+    pq.write_table(table_data, parquet_path)
+    file_size = os.path.getsize(parquet_path)
+    commit_content = (
+        '{"protocol":{"minReaderVersion":1,"minWriterVersion":2}}\n'
+        '{"metaData":{"id":"test-id","format":{"provider":"parquet","options":{}},"schemaString":"{\\"type\\":\\"struct\\",\\"fields\\":[{\\"name\\":\\"name\\",\\"type\\":\\"string\\",\\"nullable\\":true,\\"metadata\\":{}}]}","partitionColumns":[],"configuration":{},"createdAt":123456789}}\n'
+        f'{{"add":{{"path":"part-00000.parquet","partitionValues":{{}},"size":{file_size},"modificationTime":123456789,"dataChange":true}}}}\n'
+    )
+    commit_file = os.path.join(log_dir, "00000000000000000000.json")
+    with open(commit_file, "w") as f:

Review Comment:
   will update in next PR



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:
+    log_dir = os.path.join(temp_dir, "_delta_log")
+    os.makedirs(log_dir, exist_ok=True)
+    table_data = pa.table({"name": ["a", "b", "c"]})
+    parquet_path = os.path.join(temp_dir, "part-00000.parquet")
+    pq.write_table(table_data, parquet_path)
+    file_size = os.path.getsize(parquet_path)
+    commit_content = (
+        '{"protocol":{"minReaderVersion":1,"minWriterVersion":2}}\n'
+        '{"metaData":{"id":"test-id","format":{"provider":"parquet","options":{}},"schemaString":"{\\"type\\":\\"struct\\",\\"fields\\":[{\\"name\\":\\"name\\",\\"type\\":\\"string\\",\\"nullable\\":true,\\"metadata\\":{}}]}","partitionColumns":[],"configuration":{},"createdAt":123456789}}\n'
+        f'{{"add":{{"path":"part-00000.parquet","partitionValues":{{}},"size":{file_size},"modificationTime":123456789,"dataChange":true}}}}\n'
+    )
+    commit_file = os.path.join(log_dir, "00000000000000000000.json")
+    with open(commit_file, "w") as f:
+      f.write(commit_content)

Review Comment:
   will update in next PR



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462314845


##########
sdks/python/apache_beam/yaml/yaml_io.py:
##########
@@ -565,6 +565,29 @@ def read_from_iceberg(
           config_properties=config_properties))
 
 
+def read_from_delta(
+    table: str,
+    version: Optional[int] = None,
+    timestamp: Optional[str] = None,
+    hadoop_config: Optional[Mapping[str, str]] = None,
+):

Review Comment:
   ignore



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] delta lake python/yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on PR #39052:
URL: https://github.com/apache/beam/pull/39052#issuecomment-4836948287

   Precommit Java failure doesn't seem related and Code Completion failure seems like a flakey test that is also not related.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] delta lake python/yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3469181647


##########
.github/workflows/beam_PostCommit_Yaml_Xlang_Direct.yml:
##########
@@ -75,8 +75,8 @@ jobs:
         with:
           python-version: default
           java-version: |
-            17

Review Comment:
   done, thanks



##########
.github/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml:
##########
@@ -103,8 +103,8 @@ jobs:
         uses: ./.github/actions/setup-environment-action
         with:
           java-version: |
-            17
             11
+            17

Review Comment:
   done, thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462645676


##########
sdks/java/io/delta/src/test/java/org/apache/beam/sdk/io/delta/DeltaReadSchemaTransformProviderTest.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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 static org.apache.beam.sdk.io.delta.DeltaReadSchemaTransformProvider.Configuration;
+import static org.apache.beam.sdk.io.delta.DeltaReadSchemaTransformProvider.OUTPUT_TAG;
+
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import org.apache.avro.generic.GenericRecord;
+import org.apache.beam.sdk.extensions.avro.coders.AvroCoder;
+import org.apache.beam.sdk.extensions.avro.schemas.utils.AvroUtils;
+import org.apache.beam.sdk.io.Compression;
+import org.apache.beam.sdk.io.FileIO;
+import org.apache.beam.sdk.io.parquet.ParquetIO;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.transforms.windowing.PaneInfo;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PCollectionRowTuple;
+import org.apache.beam.sdk.values.Row;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link DeltaReadSchemaTransformProvider}. */
+@RunWith(JUnit4.class)
+public class DeltaReadSchemaTransformProviderTest {
+
+  @Rule public TestPipeline writePipeline = TestPipeline.create();
+  @Rule public TestPipeline readPipeline = TestPipeline.create();
+  @Rule public TemporaryFolder tempFolder = new TemporaryFolder();
+
+  @Test
+  public void testBuildTransformWithRow() {
+    java.util.Map<String, String> hadoopConfig = new java.util.HashMap<>();
+    hadoopConfig.put("fs.gs.project.id", "test-project");
+
+    Row config =
+        Row.withSchema(new DeltaReadSchemaTransformProvider().configurationSchema())
+            .withFieldValue("table", "/path/to/table")
+            .withFieldValue("version", 5L)
+            .withFieldValue("timestamp", "2026-06-04T12:00:00Z")
+            .withFieldValue("hadoop_config", hadoopConfig)
+            .build();
+
+    new DeltaReadSchemaTransformProvider().from(config);
+  }
+
+  @Test
+  public void testSimpleScan() throws Exception {
+    File tableDir = tempFolder.newFolder("delta-table-simple");
+
+    // 1. Write a Parquet file using Beam
+    Schema schema = Schema.builder().addField("name", Schema.FieldType.STRING).build();
+    Row row = Row.withSchema(schema).addValues("test-name").build();
+
+    org.apache.avro.Schema avroSchema = AvroUtils.toAvroSchema(schema);
+    GenericRecord record = AvroUtils.toGenericRecord(row, avroSchema);
+
+    writePipeline
+        .apply("Create Input", Create.of(record).withCoder(AvroCoder.of(avroSchema)))
+        .apply(
+            "Write Parquet",
+            FileIO.<GenericRecord>write()
+                .via(ParquetIO.sink(avroSchema))
+                .to(tableDir.getAbsolutePath() + "/")
+                .withNaming(
+                    (BoundedWindow window,
+                        PaneInfo paneInfo,
+                        int numShards,
+                        int shardIndex,
+                        Compression compression) -> "part-00000.parquet"));

Review Comment:
   ignore



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462308356


##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -68,6 +69,8 @@ def get_impl(self):
     None, lambda payload, components, context: BigEndianIntegerCoder())
 
 import psycopg2
+import pyarrow as pa
+import pyarrow.parquet as pq

Review Comment:
   ignore



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:

Review Comment:
   ignore



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on PR #39052:
URL: https://github.com/apache/beam/pull/39052#issuecomment-4782607734

   /gemini review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] delta lake python/yaml [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #39052:
URL: https://github.com/apache/beam/pull/39052#issuecomment-4836835454

   Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] delta lake python/yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw merged PR #39052:
URL: https://github.com/apache/beam/pull/39052


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462339127


##########
sdks/java/io/delta/src/test/java/org/apache/beam/sdk/io/delta/DeltaReadSchemaTransformProviderTest.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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 static org.apache.beam.sdk.io.delta.DeltaReadSchemaTransformProvider.Configuration;
+import static org.apache.beam.sdk.io.delta.DeltaReadSchemaTransformProvider.OUTPUT_TAG;
+
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import org.apache.avro.generic.GenericRecord;
+import org.apache.beam.sdk.extensions.avro.coders.AvroCoder;
+import org.apache.beam.sdk.extensions.avro.schemas.utils.AvroUtils;
+import org.apache.beam.sdk.io.Compression;
+import org.apache.beam.sdk.io.FileIO;
+import org.apache.beam.sdk.io.parquet.ParquetIO;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.transforms.windowing.PaneInfo;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PCollectionRowTuple;
+import org.apache.beam.sdk.values.Row;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link DeltaReadSchemaTransformProvider}. */
+@RunWith(JUnit4.class)
+public class DeltaReadSchemaTransformProviderTest {
+
+  @Rule public TestPipeline writePipeline = TestPipeline.create();
+  @Rule public TestPipeline readPipeline = TestPipeline.create();
+  @Rule public TemporaryFolder tempFolder = new TemporaryFolder();
+
+  @Test
+  public void testBuildTransformWithRow() {
+    java.util.Map<String, String> hadoopConfig = new java.util.HashMap<>();
+    hadoopConfig.put("fs.gs.project.id", "test-project");
+
+    Row config =
+        Row.withSchema(new DeltaReadSchemaTransformProvider().configurationSchema())
+            .withFieldValue("table", "/path/to/table")
+            .withFieldValue("version", 5L)
+            .withFieldValue("timestamp", "2026-06-04T12:00:00Z")
+            .withFieldValue("hadoop_config", hadoopConfig)
+            .build();
+
+    new DeltaReadSchemaTransformProvider().from(config);
+  }
+
+  @Test
+  public void testSimpleScan() throws Exception {
+    File tableDir = tempFolder.newFolder("delta-table-simple");
+
+    // 1. Write a Parquet file using Beam
+    Schema schema = Schema.builder().addField("name", Schema.FieldType.STRING).build();
+    Row row = Row.withSchema(schema).addValues("test-name").build();
+
+    org.apache.avro.Schema avroSchema = AvroUtils.toAvroSchema(schema);
+    GenericRecord record = AvroUtils.toGenericRecord(row, avroSchema);
+
+    writePipeline
+        .apply("Create Input", Create.of(record).withCoder(AvroCoder.of(avroSchema)))
+        .apply(
+            "Write Parquet",
+            FileIO.<GenericRecord>write()
+                .via(ParquetIO.sink(avroSchema))
+                .to(tableDir.getAbsolutePath() + "/")
+                .withNaming(
+                    (BoundedWindow window,
+                        PaneInfo paneInfo,
+                        int numShards,
+                        int shardIndex,
+                        Compression compression) -> "part-00000.parquet"));
+
+    writePipeline.run().waitUntilFinish();
+
+    File parquetFile = new File(tableDir, "part-00000.parquet");
+    byte[] fileBytes = Files.readAllBytes(parquetFile.toPath());
+
+    // 2. Create the Delta log
+    File logDir = new File(tableDir, "_delta_log");
+    logDir.mkdirs();

Review Comment:
   ignore



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #39052:
URL: https://github.com/apache/beam/pull/39052#issuecomment-4782771994

   ## [Codecov](https://app.codecov.io/gh/apache/beam/pull/39052?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `14.28571%` with `18 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 55.89%. Comparing base ([`e948ef6`](https://app.codecov.io/gh/apache/beam/commit/e948ef62041f966da74fe40c7868bf2bf31a66b3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`b2d710e`](https://app.codecov.io/gh/apache/beam/commit/b2d710eb4da448274a1335cf1738866b9d29abf5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 11 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/beam/pull/39052?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [sdks/python/apache\_beam/yaml/integration\_tests.py](https://app.codecov.io/gh/apache/beam/pull/39052?src=pr&el=tree&filepath=sdks%2Fpython%2Fapache_beam%2Fyaml%2Fintegration_tests.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0veWFtbC9pbnRlZ3JhdGlvbl90ZXN0cy5weQ==) | 0.00% | [17 Missing :warning: ](https://app.codecov.io/gh/apache/beam/pull/39052?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [sdks/python/apache\_beam/yaml/yaml\_io.py](https://app.codecov.io/gh/apache/beam/pull/39052?src=pr&el=tree&filepath=sdks%2Fpython%2Fapache_beam%2Fyaml%2Fyaml_io.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0veWFtbC95YW1sX2lvLnB5) | 50.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/beam/pull/39052?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff            @@
   ##             master   #39052   +/-   ##
   =========================================
     Coverage     55.89%   55.89%           
     Complexity     3913     3913           
   =========================================
     Files          1320     1320           
     Lines        180971   181029   +58     
     Branches       2671     2671           
   =========================================
   + Hits         101148   101187   +39     
   - Misses        76931    76950   +19     
     Partials       2892     2892           
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/beam/pull/39052/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [python](https://app.codecov.io/gh/apache/beam/pull/39052/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `79.28% <14.28%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/beam/pull/39052?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "derrickaw (via GitHub)" <gi...@apache.org>.
derrickaw commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462643278


##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -68,6 +69,8 @@ def get_impl(self):
     None, lambda payload, components, context: BigEndianIntegerCoder())
 
 import psycopg2
+import pyarrow as pa
+import pyarrow.parquet as pq
 import pytds

Review Comment:
   ignore



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:
+    log_dir = os.path.join(temp_dir, "_delta_log")
+    os.makedirs(log_dir, exist_ok=True)
+    table_data = pa.table({"name": ["a", "b", "c"]})

Review Comment:
   ignore



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462616636


##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -68,6 +69,8 @@ def get_impl(self):
     None, lambda payload, components, context: BigEndianIntegerCoder())
 
 import psycopg2
+import pyarrow as pa
+import pyarrow.parquet as pq
 import pytds

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Importing `pyarrow` at the module level can cause `ImportError` in environments where `pyarrow` is not installed, even if Delta tests are not being run. It is safer to import optional dependencies locally within the functions that use them.
   
   ```suggestion
   import psycopg2
   import pytds
   ```



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:
+    log_dir = os.path.join(temp_dir, "_delta_log")
+    os.makedirs(log_dir, exist_ok=True)
+    table_data = pa.table({"name": ["a", "b", "c"]})

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Import `pyarrow` and `pyarrow.parquet` locally inside `temp_delta_table` to avoid module-level import errors when `pyarrow` is not installed.
   
   ```suggestion
   @contextlib.contextmanager
   def temp_delta_table():
     import pyarrow as pa
     import pyarrow.parquet as pq
     with tempfile.TemporaryDirectory() as temp_dir:
       log_dir = os.path.join(temp_dir, "_delta_log")
       os.makedirs(log_dir, exist_ok=True)
       table_data = pa.table({"name": ["a", "b", "c"]})
   ```



##########
sdks/java/io/delta/src/test/java/org/apache/beam/sdk/io/delta/DeltaReadSchemaTransformProviderTest.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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 static org.apache.beam.sdk.io.delta.DeltaReadSchemaTransformProvider.Configuration;
+import static org.apache.beam.sdk.io.delta.DeltaReadSchemaTransformProvider.OUTPUT_TAG;
+
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import org.apache.avro.generic.GenericRecord;
+import org.apache.beam.sdk.extensions.avro.coders.AvroCoder;
+import org.apache.beam.sdk.extensions.avro.schemas.utils.AvroUtils;
+import org.apache.beam.sdk.io.Compression;
+import org.apache.beam.sdk.io.FileIO;
+import org.apache.beam.sdk.io.parquet.ParquetIO;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.transforms.windowing.PaneInfo;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PCollectionRowTuple;
+import org.apache.beam.sdk.values.Row;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link DeltaReadSchemaTransformProvider}. */
+@RunWith(JUnit4.class)
+public class DeltaReadSchemaTransformProviderTest {
+
+  @Rule public TestPipeline writePipeline = TestPipeline.create();
+  @Rule public TestPipeline readPipeline = TestPipeline.create();
+  @Rule public TemporaryFolder tempFolder = new TemporaryFolder();
+
+  @Test
+  public void testBuildTransformWithRow() {
+    java.util.Map<String, String> hadoopConfig = new java.util.HashMap<>();
+    hadoopConfig.put("fs.gs.project.id", "test-project");
+
+    Row config =
+        Row.withSchema(new DeltaReadSchemaTransformProvider().configurationSchema())
+            .withFieldValue("table", "/path/to/table")
+            .withFieldValue("version", 5L)
+            .withFieldValue("timestamp", "2026-06-04T12:00:00Z")
+            .withFieldValue("hadoop_config", hadoopConfig)
+            .build();
+
+    new DeltaReadSchemaTransformProvider().from(config);
+  }
+
+  @Test
+  public void testSimpleScan() throws Exception {
+    File tableDir = tempFolder.newFolder("delta-table-simple");
+
+    // 1. Write a Parquet file using Beam
+    Schema schema = Schema.builder().addField("name", Schema.FieldType.STRING).build();
+    Row row = Row.withSchema(schema).addValues("test-name").build();
+
+    org.apache.avro.Schema avroSchema = AvroUtils.toAvroSchema(schema);
+    GenericRecord record = AvroUtils.toGenericRecord(row, avroSchema);
+
+    writePipeline
+        .apply("Create Input", Create.of(record).withCoder(AvroCoder.of(avroSchema)))
+        .apply(
+            "Write Parquet",
+            FileIO.<GenericRecord>write()
+                .via(ParquetIO.sink(avroSchema))
+                .to(tableDir.getAbsolutePath() + "/")
+                .withNaming(
+                    (BoundedWindow window,
+                        PaneInfo paneInfo,
+                        int numShards,
+                        int shardIndex,
+                        Compression compression) -> "part-00000.parquet"));

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   When using a custom naming configuration that returns a constant filename (`part-00000.parquet`), it is important to restrict the number of shards to 1 using `.withNumShards(1)`. Otherwise, if the pipeline runs with multiple shards, they will attempt to write to the same file, leading to race conditions or data loss.
   
   ```suggestion
           .apply(
               "Write Parquet",
               FileIO.<GenericRecord>write()
                   .via(ParquetIO.sink(avroSchema))
                   .to(tableDir.getAbsolutePath() + "/")
                   .withNumShards(1)
                   .withNaming(
                       (BoundedWindow window,
                           PaneInfo paneInfo,
                           int numShards,
                           int shardIndex,
                           Compression compression) -> "part-00000.parquet"));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] delta lake python/yaml [beam]

Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3520675456


##########
sdks/java/io/expansion-service/build.gradle:
##########
@@ -97,6 +97,7 @@ dependencies {
 
   runtimeOnly project(":sdks:java:io:datadog")
   runtimeOnly project(":sdks:java:io:mongodb")
+  runtimeOnly project(":sdks:java:io:delta")

Review Comment:
   There are tests using io-expansion service started failing due to that it's still on Java11
   
   beam_PostCommit_XVR_Flink
   
   https://github.com/apache/beam/actions/runs/28555665426/job/84662439012
   
   ```
   2026-07-02T00:22:15.3212656Z PASS
   2026-07-02T00:22:15.3213209Z ok  	github.com/apache/beam/sdks/v2/go/test/integration/io/xlang/jdbc	72.073s
   2026-07-02T00:22:49.7211983Z time=2026-07-02T00:22:49.643Z level=INFO msg="skipping missing expansion service: expansion service labeled \"io\" failed to start after 30 retries: dial tcp 127.0.0.1:39605: connect: connection refused"
   2026-07-02T00:22:49.7213249Z === RUN   TestKafkaIO_BasicReadWrite
   2026-07-02T00:22:49.7213733Z --- FAIL: TestKafkaIO_BasicReadWrite (0.00s)
   ```
   
   Working on moving CI to Java21 by default: #39205 should fix these issues



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] delta lake python/yaml [beam]

Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3521476743


##########
sdks/java/io/expansion-service/build.gradle:
##########
@@ -97,6 +97,7 @@ dependencies {
 
   runtimeOnly project(":sdks:java:io:datadog")
   runtimeOnly project(":sdks:java:io:mongodb")
+  runtimeOnly project(":sdks:java:io:delta")

Review Comment:
   Tested #39205: https://github.com/apache/beam/actions/runs/28668730433



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [wip] delta lake yaml [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #39052:
URL: https://github.com/apache/beam/pull/39052#discussion_r3462300695


##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -68,6 +69,8 @@ def get_impl(self):
     None, lambda payload, components, context: BigEndianIntegerCoder())
 
 import psycopg2
+import pyarrow as pa
+import pyarrow.parquet as pq

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Top-level imports of optional dependencies like `pyarrow` can cause `ImportError` when the module is imported in environments where these dependencies are not installed. It is safer to import them lazily inside the functions or context managers where they are actually used.



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:
+    log_dir = os.path.join(temp_dir, "_delta_log")
+    os.makedirs(log_dir, exist_ok=True)
+    table_data = pa.table({"name": ["a", "b", "c"]})
+    parquet_path = os.path.join(temp_dir, "part-00000.parquet")
+    pq.write_table(table_data, parquet_path)
+    file_size = os.path.getsize(parquet_path)
+    commit_content = (
+        '{"protocol":{"minReaderVersion":1,"minWriterVersion":2}}\n'
+        '{"metaData":{"id":"test-id","format":{"provider":"parquet","options":{}},"schemaString":"{\\"type\\":\\"struct\\",\\"fields\\":[{\\"name\\":\\"name\\",\\"type\\":\\"string\\",\\"nullable\\":true,\\"metadata\\":{}}]}","partitionColumns":[],"configuration":{},"createdAt":123456789}}\n'
+        f'{{"add":{{"path":"part-00000.parquet","partitionValues":{{}},"size":{file_size},"modificationTime":123456789,"dataChange":true}}}}\n'
+    )
+    commit_file = os.path.join(log_dir, "00000000000000000000.json")
+    with open(commit_file, "w") as f:
+      f.write(commit_content)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Specify `encoding="utf-8"` when opening the file to write the JSON content. This ensures cross-platform compatibility and avoids potential encoding issues on systems where the default encoding is not UTF-8 (e.g., Windows).
   
   ```suggestion
       with open(commit_file, "w", encoding="utf-8") as f:
         f.write(commit_content)
   ```



##########
sdks/python/apache_beam/yaml/yaml_io.py:
##########
@@ -565,6 +565,29 @@ def read_from_iceberg(
           config_properties=config_properties))
 
 
+def read_from_delta(
+    table: str,
+    version: Optional[int] = None,
+    timestamp: Optional[str] = None,
+    hadoop_config: Optional[Mapping[str, str]] = None,
+):

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `Mapping` might raise a `NameError` if it is not imported in this file. It is safer to use `Dict` (which is already imported and widely used in this module) for the type hint of `hadoop_config`.
   
   ```suggestion
   def read_from_delta(
       table: str,
       version: Optional[int] = None,
       timestamp: Optional[str] = None,
       hadoop_config: Optional[Dict[str, str]] = None,
   ):
   ```



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -618,6 +621,26 @@ def temp_pubsub_emulator(project_id="apache-beam-testing"):
     yield created_topic_object.name
 
 
+@contextlib.contextmanager
+def temp_delta_table():
+  with tempfile.TemporaryDirectory() as temp_dir:

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Import `pyarrow` and `pyarrow.parquet` lazily inside the context manager to avoid top-level import issues when `pyarrow` is not installed in the environment.
   
   ```suggestion
   @contextlib.contextmanager
   def temp_delta_table():
     import pyarrow as pa
     import pyarrow.parquet as pq
     with tempfile.TemporaryDirectory() as temp_dir:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org