You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "jon-esperanza (via GitHub)" <gi...@apache.org> on 2023/07/23 02:21:56 UTC
[GitHub] [beam] jon-esperanza opened a new pull request, #27619: use toBeamRowFieldValue for list recursion in toBeamValue
jon-esperanza opened a new pull request, #27619:
URL: https://github.com/apache/beam/pull/27619
addresses #21200
toBeamValue performs a recursion for converting List values to BeamValue. toBeamValue does not have any logic to handle nulls elements/nullable FieldType's, so we should switch the recursion to start at toBeamRowFieldValue so that null elements in lists can be handled.
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [x] 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://beam.apache.org/contribute/get-started-contributing/#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)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](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.
--
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
[GitHub] [beam] Abacn commented on a diff in pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1281258175
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
I see, toBeamRowFieldValue is a wrapper of toBeamValue with null check. Then could just rename `toBeamRowFieldValue` to sth like `toBeamMaybeNullValue` and use it in both place?
--
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
[GitHub] [beam] jon-esperanza commented on a diff in pull request #27619: merge toBeamRowFieldValue into toBeamValue for null value support
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1281389105
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
made the changes, please let me know if the commits should be more atomic
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
@Abacn I made the changes, please let me know if the commits should be more atomic
--
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
[GitHub] [beam] jon-esperanza commented on pull request #27619: merge toBeamRowFieldValue into toBeamValue for null value support
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on PR #27619:
URL: https://github.com/apache/beam/pull/27619#issuecomment-1663147420
Run Spotless PreCommit
--
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
[GitHub] [beam] Abacn commented on a diff in pull request #27619: merge toBeamRowFieldValue into toBeamValue for null value support
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1282543525
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +708,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamValue(field.withType(field.getType().getCollectionElementType()), v))
Review Comment:
```suggestion
.map(v -> toBeamValue(field.withType(fieldType.getCollectionElementType()), v))
```
LGTM: just a minor place
--
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
[GitHub] [beam] jon-esperanza commented on a diff in pull request #27619: merge toBeamRowFieldValue into toBeamValue for null value support
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1282551010
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +708,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamValue(field.withType(field.getType().getCollectionElementType()), v))
Review Comment:
ah missed it, 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
[GitHub] [beam] Abacn commented on a diff in pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1281261196
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
Merge toBeamRowFieldValue and toBeamValue sounds also a good choice. If do so we may need to change toBeamValue's signature to (Field, Object), To retain the ability to get the Field name in the error message here
https://github.com/apache/beam/blob/d658e8d141a9db7c972854ad75a140540af99aa5/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java#L639
--
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
[GitHub] [beam] github-actions[bot] commented on pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27619:
URL: https://github.com/apache/beam/pull/27619#issuecomment-1658251415
Reminder, please take a look at this pr: @Abacn @johnjcasey
--
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
[GitHub] [beam] Abacn merged pull request #27619: merge toBeamRowFieldValue into toBeamValue for null value support
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn merged PR #27619:
URL: https://github.com/apache/beam/pull/27619
--
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
[GitHub] [beam] github-actions[bot] commented on pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27619:
URL: https://github.com/apache/beam/pull/27619#issuecomment-1646733140
Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
R: @Abacn for label java.
R: @johnjcasey 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
[GitHub] [beam] jon-esperanza commented on a diff in pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1281261796
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
I like that better, I remember thinking of doing this but seemed like too big of a change 😅
--
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
[GitHub] [beam] jon-esperanza commented on pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on PR #27619:
URL: https://github.com/apache/beam/pull/27619#issuecomment-1646941638
Run Java_GCP_IO_Direct PreCommit
--
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
[GitHub] [beam] Abacn commented on a diff in pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1279379104
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
This worked in an (ad hoc) way that calling methods intended for other uses (Row values) for List values. It also adds some overhead (construct a dumb Field in place) and. Can we add support to null value in toBeamValue instead?
--
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
[GitHub] [beam] jon-esperanza commented on pull request #27619: merge toBeamRowFieldValue into toBeamValue for null value support
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on PR #27619:
URL: https://github.com/apache/beam/pull/27619#issuecomment-1663147298
Run Java_GCP_IO_Direct PreCommit
--
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
[GitHub] [beam] jon-esperanza commented on a diff in pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1281259339
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
Sounds good, will rename toBeamRowFieldValue.
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
Sounds good, will rename `toBeamRowFieldValue`.
--
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
[GitHub] [beam] jon-esperanza commented on a diff in pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1281255119
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
This means I should also remove the support for null values from `toBeamRowFieldValue`, since it will be redundant with null support in `toBeamValue`
--
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
[GitHub] [beam] jon-esperanza commented on a diff in pull request #27619: use toBeamRowFieldValue for list recursion in toBeamValue
Posted by "jon-esperanza (via GitHub)" <gi...@apache.org>.
jon-esperanza commented on code in PR #27619:
URL: https://github.com/apache/beam/pull/27619#discussion_r1281255119
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -710,7 +710,7 @@ public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jso
(!innerTypeIsMap && v instanceof Map)
? ((Map<String, Object>) v).get("v")
: v)
- .map(v -> toBeamValue(fieldType.getCollectionElementType(), v))
+ .map(v -> toBeamRowFieldValue(Field.of("v", fieldType.getCollectionElementType()), v))
Review Comment:
This means I should also remove the support for null values from `toBeamRowValue`, since it will be redundant with null support in `toBeamValue`
--
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