Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable TableRow converted from BQ types #5536

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RustedBones
Copy link
Contributor

@RustedBones RustedBones commented Dec 19, 2024

Coder[TableRow] is destructive (it is a dummy JSON serializer), we should make sure that the TableRow object converted from a BQ model is stable after serialization.

We currently have an issue with

  • long that are serialized as string to avoid overflow
  • float that are read back as double
  • json that is read as nested TableRow

As side effect, I needed to avoid toString conversion when converting back a BQ typed model from a TableRow

Coder[TableRow] is destructive (it is a dummy JSON serializer), we
should make sure that the TableRow object converted from a BQ model is
stable after serialization.

We currently have an issue with
- long that are serialized as string to avoid overflow
- float that are read back as double
- json that is read as nested TableRow
val provider: OverrideTypeProvider =
OverrideTypeProviderFinder.getProvider
val s = q"$tree.toString"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we were forcing toString before converting back to desired type

@RustedBones RustedBones force-pushed the bq-typed-stable-table-row branch from fdd4fbb to d8d30c8 Compare December 19, 2024 15:50
Comment on lines +56 to +58
// f is a field from TableRow.
// Jackson ObjectMapper will fail with such key
key <- Gen.alphaStr.retryUntil(_ != "f")
Copy link
Contributor Author

@RustedBones RustedBones Dec 19, 2024

Choose a reason for hiding this comment

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

I'm wondering what happens if a BQ table has a field named f. It's probable that we can't use the TableRow API

@RustedBones RustedBones force-pushed the bq-typed-stable-table-row branch from d8d30c8 to d76d226 Compare December 19, 2024 16:12
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.45%. Comparing base (4d701c1) to head (a820b88).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5536      +/-   ##
==========================================
+ Coverage   61.43%   61.45%   +0.01%     
==========================================
  Files         312      312              
  Lines       11106    11106              
  Branches      750      748       -2     
==========================================
+ Hits         6823     6825       +2     
+ Misses       4283     4281       -2     

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

Copy link
Contributor Author

@RustedBones RustedBones left a comment

Choose a reason for hiding this comment

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

Ideally all the TableRow -> scala cast logic should be shared with TableRowOps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant