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

[persist] Track whether or not our JSON contains a map #18807

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

bkirwi
Copy link
Contributor

@bkirwi bkirwi commented Apr 17, 2023

Motivation

materialize=> select '7'::jsonb::numeric;
 numeric 
---------
       7
(1 row)

materialize=> select '{}'::jsonb::numeric;
ERROR:  cannot cast jsonb object to type numeric

If we want to be able to push down casts on jsonb columns, it's important that we know when the column is all of a single type. However, currently totally empty jsonb objects -- {} -- don't show up in stats at all. This is a minimal change that captures them in stats in a backwards - compatible way.

Tips for reviewer

This is not how I'd do things from scratch, but it seems like the smallest change that captures the information we need. I left a TODO to revisit this code when we're cleaning up / getting ready to use this for real.

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • This PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way) and therefore is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • This PR includes the following user-facing behavior changes:

@bkirwi bkirwi marked this pull request as ready for review April 17, 2023 22:51
@bkirwi bkirwi requested review from a team April 17, 2023 22:51
@bkirwi bkirwi requested a review from a team as a code owner April 17, 2023 22:51
@bkirwi bkirwi requested a review from danhhz April 17, 2023 22:51
@bkirwi bkirwi merged commit 107aa85 into MaterializeInc:main Apr 18, 2023
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.

None yet

2 participants