Repository navigation
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the lakehouseSortFields parameter to the ParquetToLakehouse template, enabling users to define the sort order when creating new tables. The changes span the Java template interface, the YAML options configuration, and the pipeline template definition. The reviewer correctly noted a mismatch between the pull request's title/description and the actual code changes, which should be corrected to accurately reflect the addition of sorting fields.
|
|
||
| @TemplateParameter.Text( | ||
| order = 14, | ||
| name = "lakehouseSortFields", |
There was a problem hiding this comment.
Fixed in 7c422b8 — the branch now contains strictly the BigQueryToLakehouse row_restriction changes matching the PR title and description.
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #4660 +/- ##
=============================================
- Coverage 59.72% 37.99% -21.74%
+ Complexity 8220 533 -7687
=============================================
Files 1122 197 -925
Lines 72762 12055 -60707
Branches 8855 1239 -7616
=============================================
- Hits 43459 4580 -38879
+ Misses 26402 7100 -19302
+ Partials 2901 375 -2526
🚀 New features to boost your workflow:
|
…ToLakehouse" This reverts commit 72d28bb.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces an optional rowRestriction parameter to the BigQuery to Lakehouse YAML template, allowing users to specify a SQL text filtering statement when reading from BigQuery. This parameter is added to the Java interface, the Python options configuration, and the Jinja-templated YAML pipeline definition. The reviewer suggested quoting the rowRestriction variable inside the Jinja template (row_restriction: "{{ rowRestriction }}") to ensure it is properly parsed as a string and to prevent potential validation or parsing errors.
| fields: {{ fields }} | ||
| {% endif %} | ||
| {% if rowRestriction %} | ||
| row_restriction: {{ rowRestriction }} |
There was a problem hiding this comment.
In Jinja-templated YAML configurations, optional parameters like rowRestriction should be wrapped in {% if %} blocks. This ensures that both unset and empty-string inputs omit the key cleanly, preventing validation or parsing errors from empty values, while also ensuring the string is properly quoted.
{% if rowRestriction %}
row_restriction: "{{ rowRestriction }}"
{% endif %}References
- In Jinja-templated YAML configurations, wrap optional parameters in {% if %} blocks to ensure that both unset and empty-string inputs omit those keys cleanly, preventing validation or parsing errors from empty values.
There was a problem hiding this comment.
row_restriction is already wrapped in {% if rowRestriction %} ... {% endif %} here. It is intentionally left unquoted (matching filter: {{ filter }} and query: {{ query }} across the other SQL/Iceberg YAML blueprints) because BigQuery SQL expressions can legitimately contain double-quoted string literals (e.g. status = "ACTIVE"), which would cause a YAML syntax error inside double quotes.
Note: this PR was auto-generated by tooling. Before moving it out of draft, the author has done a full review of the PR, specifically evaluating it on the following criteria:
generate_yaml_java_templates.py), Spotless, Checkstyle, and unit tests have been verifiedIf you have concerns with the PR or with the underlying methodology used to generate this, please comment below - they will be addressed by the author not the tooling :)
Part of #4425 (#4425).
Summary
Exposes the optional
row_restrictionparameter onReadFromBigQueryinBigQueryToLakehouse.yaml:rowRestrictionparameter (order: 2) tobigquery_read_optionsinyaml/src/main/python/options/bigquery_options.yamlmatching Apache Beam'sReadFromBigQuery.row_restrictionspecification (optional SQLWHERE-style filter expression, up to 1 MB, no aggregates).row_restriction: {{ rowRestriction }}inside a{% if rowRestriction %}guard inyaml/src/main/yaml/BigQueryToLakehouse.yamlso existing jobs that omitrowRestrictionrender identically.yaml/src/main/java/com/google/cloud/teleport/templates/yaml/BigQueryToLakehouseYaml.javaviagenerate_yaml_java_templates.py.Verification
rowRestrictionis omitted, empty string, and populated with SQL filter expressions (including single and double quotes).generate_yaml_java_templates.pyoutput,generate_yaml_java_templates_test.py(5/5), Spotless, Checkstyle (0 violations), andmvn test-compile -pl yaml -am.