Conversation
This commit changes the json vector reader to create an fused output with fusion types directly instead of using unblend to create a Dynamic. These changes get at the fundamental bottleneck of computing types over the variant/json pattern. To implement this, we added a couple methods to TypeDefs to be able to enter array and record types directly without having to have a corresponding super.Type. We also created TypeDefsMapper to efficiently create super.Types from a TypeDefs table and cache intermediary types. This is used by the loader on the vector.Fusion that is created by the JSON reader to create the subtype super.Types on demand when needed. In particular, the CSUP writer currently invokes the loader to create the super.Types then converts them to typevals that are stored in the subtypes table in the CSUP metadata. The next step to improve this write path is the store the TypeDefs in the CSUP metadata instead of type values and never materialize the subtype IDs to types if they are never otherwise needed. This means large amounts of JSON can be read, processed, and written into CSUP and the query type context does not need to be polluted with all the fusion subtypes. We also put an option into samFunc call to avoid ripping vectors when fusion vectors are passed to defuse. Finally we increased the size of fjson batch size from 1K to 10K.
nwt
approved these changes
Apr 2, 2026
| ) | ||
|
|
||
| var VecBatchSize uint32 = 1024 | ||
| var VecBatchSize uint32 = 10 * 1024 |
Member
There was a problem hiding this comment.
Is this based on measurement or intuition? If intuition, consider that DuckDB's default is 2048.
Collaborator
Author
There was a problem hiding this comment.
Let's merge and address again after measurement.
Comment on lines
+215
to
+217
| if call.Tag == "defuse" { | ||
| callExpr.NoRip = true | ||
| } |
Member
There was a problem hiding this comment.
This is fine for now but we do have an existing pattern for per-function behaviors like this (see the RipUnions interface).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit changes the json vector reader to create an fused output with fusion types directly instead of using unblend to create a Dynamic. These changes get at the fundamental bottleneck of computing types over the variant/json pattern.
To implement this, we added a couple methods to TypeDefs to be able to enter array and record types directly without having to have a corresponding super.Type. We also created TypeDefsMapper to efficiently create super.Types from a TypeDefs table and cache intermediary types. This is used by the loader on the vector.Fusion that is created by the JSON reader to create the subtype super.Types on demand when needed.
In particular, the CSUP writer currently invokes the loader to create the super.Types then converts them to typevals that are stored in the subtypes table in the CSUP metadata. The next step to improve this write path is the store the TypeDefs in the CSUP metadata instead of type values and never materialize the subtype IDs to types if they are never otherwise needed. This means large amounts of JSON can be read, processed, and written into CSUP and the query type context does not need to be polluted with all the fusion subtypes.
We also put an option into samFunc call to avoid ripping vectors when fusion vectors are passed to defuse.
Finally we increased the size of fjson batch size from 1K to 10K.