Skip to content

Fix correctness issue in JsonToRow, RowJsonDeserializer and RowJsonSerializer - #40769

Open
sjvanrossum wants to merge 4 commits into
apache:masterfrom
sjvanrossum:row-json-bug
Open

sjvanrossum wants to merge 4 commits into
apache:masterfrom
sjvanrossum:row-json-bug

Conversation

@sjvanrossum

Copy link
Copy Markdown
Contributor

RowJson only special-cased SQL date/time logical types by identifier and fell through to the underlying base FieldType for all other logical types without converting between the logical input type (T) and base type (BaseT), causing ClassCastExceptions on serialize and deserialize.

JsonToRowWithErrFn.expand() hardcoded the default line and err field names when registering the dead-letter PCollection schema instead of using lineField() and errorField(), causing a schema mismatch when custom field names were configured.

Adds an EnumerationType field to RowJsonTest.ValueTests.makeLogicalTypeTestCase()
to verify serialization, deserialization, and round-tripping of logical types
whose input type (EnumerationType.Value) differs from their base type (INT32).
RowJson only special-cased SQL date/time logical types by identifier and
fell through to the underlying base FieldType for all other logical types
without converting between the logical input type (T) and base type (BaseT),
causing ClassCastExceptions on serialize and deserialize.
@github-actions github-actions Bot added java core size/s S: 10-49 lines changed labels Oct 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR fixes two correctness bugs: missing toInputType/toBaseType conversions for non-SQL logical types in RowJson serialization/deserialization, and hardcoded dead-letter schema field names in JsonToRowWithErrFn when custom line or error field names are configured. Both fixes are clean, accurate, and accompanied by unit test updates.

🔍 General Feedback

  • The RowJson logical type conversion properly delegates base value extraction/serialization and applies logicalType.toInputType and logicalType.toBaseType symmetrically.
  • JsonToRowWithErrFn.getErrorSchema() cleanly resolves the configured field names while reusing the static schema instances for default configurations.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

Verifies that JsonToRow.withExtendedErrorInfo() propagates custom lineField
and errorField names to both the dead-letter PCollection schema and the
emitted error Rows.
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @damccorm for label java.
Backup reviewer: chamikaramj (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

This pull request likely touches a core component ("core" label). Please review with scrutiny.

Note: If you would like to opt out of this review, comment assign to next reviewer.

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

@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (a8d6afd) to head (454a550).
⚠️ Report is 74 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #40769       +/-   ##
===========================================
- Coverage   80.04%        0   -80.05%     
===========================================
  Files         490        0      -490     
  Lines       82916        0    -82916     
===========================================
- Hits        66373        0    -66373     
+ Misses      16543        0    -16543     
Flag Coverage Δ
python ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

`JsonToRowWithErrFn.expand()` hardcoded the default 'line' and 'err' field
names when registering the dead-letter PCollection schema instead of using
`lineField()` and `errorField()`, causing a schema mismatch when custom field
names were configured.
@sjvanrossum

Copy link
Copy Markdown
Contributor Author

Run Java Examples_Dataflow PreCommit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant