You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "claudevdm (via GitHub)" <gi...@apache.org> on 2025/03/17 15:10:52 UTC

[PR] Key by paneindex and reshuffle before loading files. [beam]

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

   **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] Key by paneindex and reshuffle before loading files. [beam]

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

   > Thanks @claudevdm. I know there is context somewhere, but could you briefly explain why we need this change here? Looks like we are now getting the pane index in a separate and new DoFn prior to Reshuffle, rather than from the original DoFn.
   
   The Reshuffle implementation in python does not preserve pane index (see https://github.com/apache/beam/issues/28219)
   
   If we keep fetching pane info in the original DoFn then ALL load jobs will have pane info 0 (see linked bug) and only the very first load job will succeed.
   
   So another option is to fix the Reshuffle implementation (I have tested this too), but that is a more intrusive change that probably needs more discussion.


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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


##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -664,19 +664,14 @@ def start_bundle(self):
     self.pending_jobs = []
     self.schema_cache = {}
 
-  def process(
-      self,
-      element,
-      load_job_name_prefix,
-      pane_info=beam.DoFn.PaneInfoParam,

Review Comment:
   We are still using pane info, but just adding it earlier as part of the key that gets processed by TriggerLoadJob,=



##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -664,19 +664,14 @@ def start_bundle(self):
     self.pending_jobs = []
     self.schema_cache = {}
 
-  def process(
-      self,
-      element,
-      load_job_name_prefix,
-      pane_info=beam.DoFn.PaneInfoParam,

Review Comment:
   We are still using pane info, but just adding it earlier as part of the key that gets processed by TriggerLoadJob



-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   Reminder, please take a look at this pr: @liferoad @shunping 


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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


##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -1313,3 +1312,9 @@ def expand(self, pcoll):
         self.DESTINATION_FILE_PAIRS: all_destination_file_pairs_pc,
         self.DESTINATION_COPY_JOBID_PAIRS: destination_copy_job_ids_pc,
     }
+
+
+class KeyByPaneIndex(beam.DoFn):
+  def process(self, element, pane_info=beam.DoFn.PaneInfoParam):
+    destination, (partition_key, files) = element
+    return [(destination, (partition_key, files, pane_info.index))]

Review Comment:
   Does it make sense to do this keying by pane in the upstream `PartitionFiles` DoFn? i.e. instead of creating a new dedicated step.
   
   I think that'll make it easier to revert this quick fix when Reshuffle gets fixed (which should be the longterm solution)



-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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


##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -1104,6 +1099,8 @@ def _load_data(
     # Load data using temp tables
     trigger_loads_outputs = (
         partitions_using_temp_tables
+        | "KeyByPaneIndexWithTempTables" >> beam.ParDo(KeyByPaneIndex())

Review Comment:
   do we need to worry about the update compatibility?



-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   Reminder, please take a look at this pr: @jrmccluskey @ahmedabu98 


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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


##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -1313,3 +1312,9 @@ def expand(self, pcoll):
         self.DESTINATION_FILE_PAIRS: all_destination_file_pairs_pc,
         self.DESTINATION_COPY_JOBID_PAIRS: destination_copy_job_ids_pc,
     }
+
+
+class KeyByPaneIndex(beam.DoFn):
+  def process(self, element, pane_info=beam.DoFn.PaneInfoParam):
+    destination, (partition_key, files) = element
+    return [(destination, (partition_key, files, pane_info.index))]

Review Comment:
   One of the original concern was upgrade compatibility. However because a ReShuffle is needed, pipeline graph will be changed anyways



##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -1313,3 +1312,9 @@ def expand(self, pcoll):
         self.DESTINATION_FILE_PAIRS: all_destination_file_pairs_pc,
         self.DESTINATION_COPY_JOBID_PAIRS: destination_copy_job_ids_pc,
     }
+
+
+class KeyByPaneIndex(beam.DoFn):
+  def process(self, element, pane_info=beam.DoFn.PaneInfoParam):
+    destination, (partition_key, files) = element
+    return [(destination, (partition_key, files, pane_info.index))]

Review Comment:
   One of the original concern was upgrade compatibility. However because a ReShuffle is added here, pipeline graph will be changed anyways



-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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


##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -1313,3 +1312,9 @@ def expand(self, pcoll):
         self.DESTINATION_FILE_PAIRS: all_destination_file_pairs_pc,
         self.DESTINATION_COPY_JOBID_PAIRS: destination_copy_job_ids_pc,
     }
+
+
+class KeyByPaneIndex(beam.DoFn):
+  def process(self, element, pane_info=beam.DoFn.PaneInfoParam):
+    destination, (partition_key, files) = element
+    return [(destination, (partition_key, files, pane_info.index))]

Review Comment:
   This is very similar to a first attempt to fix the same issue in Java - #28272 add pane info in "WritePartition" so it is survived in ReShuffle. In earlier discussion it was decided to go with fixing ReShuffle itself (and that PR was closed).  Shall we go for same decision here?



-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   Fixed in https://github.com/apache/beam/pull/34657


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   Reminder, please take a look at this pr: @tvalentyn @ahmedabu98 


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   let us update the known issues with CHANGES.md and the released blogs. And also do this internally.


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @tvalentyn for label python.
   R: @ahmedabu98 for label io.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the 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] Key by paneindex and reshuffle before loading files. [beam]

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


##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -1104,6 +1099,8 @@ def _load_data(
     # Load data using temp tables
     trigger_loads_outputs = (
         partitions_using_temp_tables
+        | "KeyByPaneIndexWithTempTables" >> beam.ParDo(KeyByPaneIndex())

Review Comment:
   Yes, I will make those changes before merging this



-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   Thanks @claudevdm.  I know there is context somewhere, but could you briefly explain why we need this change here?
   Looks like we are now getting the pane index in a separate and new DoFn prior to Reshuffle now, rather than from the original DoFn.


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @jrmccluskey for label python.
   R: @ahmedabu98 for label io.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the 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] Key by paneindex and reshuffle before loading files. [beam]

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

   Stopping reviewer notifications for this pull request: requested by reviewer. If you'd like to restart, 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] Key by paneindex and reshuffle before loading files. [beam]

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

   stop reviewer notifications


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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

   Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @liferoad for label python.
   R: @shunping for label io.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
   
   The PR bot will only process comments in the main thread (not review comments).


-- 
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] Key by paneindex and reshuffle before loading files. [beam]

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


##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -664,19 +664,14 @@ def start_bundle(self):
     self.pending_jobs = []
     self.schema_cache = {}
 
-  def process(
-      self,
-      element,
-      load_job_name_prefix,
-      pane_info=beam.DoFn.PaneInfoParam,

Review Comment:
   is this safe to remove `pane_info`?



-- 
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] Key by paneindex and reshuffle before loading files. [beam]

Posted by "claudevdm (via GitHub)" <gi...@apache.org>.
claudevdm closed pull request #34324: Key by paneindex and reshuffle before loading files.
URL: https://github.com/apache/beam/pull/34324


-- 
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