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

Fix unable to sync json column with value is an array #44465

Merged
merged 7 commits into from
Jun 20, 2024

Conversation

qnkhuat
Copy link
Contributor

@qnkhuat qnkhuat commented Jun 20, 2024

a json column with values is an array or an atom should not have nested fields

Closes #44459

@qnkhuat qnkhuat requested a review from camsaul as a code owner June 20, 2024 09:50
@metabase-bot metabase-bot bot added the .Team/BackendComponents also known as BEC label Jun 20, 2024
(recur path key (assoc! res next-path clojure.lang.PersistentVector)))
JsonToken/END_ARRAY (recur path key res)))))))
;; only parse if the value is an object, ignore arrays, strings, numbers, etc.
(and (zero? token-cnt)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

jackson doesn't have a peek method :(

Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we check (seq res) here, seems like it should give the same result? Nothing collected and not a start of the object -> goodbye.

res (transient {})]
(let [token (.nextToken p)
next-path (cond-> path key (conj key))]
(loop [path (or path [])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fix here is reverese https://github.com/metabase/metabase/pull/43812/files, then add a check to make sure we return nil if the value is not an object.

@qnkhuat
Copy link
Contributor Author

qnkhuat commented Jun 20, 2024

Thread for context

@qnkhuat qnkhuat added the backport Automatically create PR on current release branch on merge label Jun 20, 2024
Copy link

replay-io bot commented Jun 20, 2024

Status Complete ↗︎
Commit 4c46107
Results
⚠️ 5 Flaky
2650 Passed

@qnkhuat
Copy link
Contributor Author

qnkhuat commented Jun 20, 2024

need to backport to 49 too

Copy link
Contributor

@piranha piranha left a comment

Choose a reason for hiding this comment

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

Except I'd love and to become when :)

@qnkhuat qnkhuat enabled auto-merge (squash) June 20, 2024 10:56
@qnkhuat qnkhuat merged commit 4a03070 into master Jun 20, 2024
109 checks passed
@qnkhuat qnkhuat deleted the ngoc-fix-unable-to-sync-naked-json-column branch June 20, 2024 14:05
github-automation-metabase added a commit that referenced this pull request Jun 20, 2024
@qnkhuat
Copy link
Contributor Author

qnkhuat commented Jun 21, 2024

@metabase-bot backport release-x.49.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Automatically create PR on current release branch on merge .Team/BackendComponents also known as BEC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't sync array columns
2 participants