[SPARK-48833][SQL][VARIANT] Support variant in InMemoryTableScan#47252
Closed
richardc-db wants to merge 3 commits intoapache:masterfrom
Closed
[SPARK-48833][SQL][VARIANT] Support variant in InMemoryTableScan#47252richardc-db wants to merge 3 commits intoapache:masterfrom
InMemoryTableScan#47252richardc-db wants to merge 3 commits intoapache:masterfrom
Conversation
cloud-fan
reviewed
Jul 23, 2024
| override def append(v: VariantVal, buffer: ByteBuffer): Unit = { | ||
| val varLenSize: Int = 4 + v.getValue().length + v.getMetadata().length | ||
| ByteBufferHelper.putInt(buffer, varLenSize) | ||
| ByteBufferHelper.putInt(buffer, v.getValue().length) |
Contributor
There was a problem hiding this comment.
why not simply one int for value size and one int for metadata size?
Contributor
Author
There was a problem hiding this comment.
This was done initially to mimic the VariantVal unsafe row representation here. I can switch it to write one int for value and one int for metadata if you'd prefer
cloud-fan
approved these changes
Jul 24, 2024
Contributor
|
the protobuf failure is unrelated, thanks, merging to master! |
ilicmarkodb
pushed a commit
to ilicmarkodb/spark
that referenced
this pull request
Jul 29, 2024
### What changes were proposed in this pull request? adds support for variant type in `InMemoryTableScan`, or `df.cache()` by supporting writing variant values to an inmemory buffer. ### Why are the changes needed? prior to this PR, calling `df.cache()` on a df that has a variant would fail because `InMemoryTableScan` does not support reading variant types. ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? added UTs ### Was this patch authored or co-authored using generative AI tooling? no Closes apache#47252 from richardc-db/variant_dfcache_support. Authored-by: Richard Chen <r.chen@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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.
What changes were proposed in this pull request?
adds support for variant type in
InMemoryTableScan, ordf.cache()by supporting writing variant values to an inmemory buffer.Why are the changes needed?
prior to this PR, calling
df.cache()on a df that has a variant would fail becauseInMemoryTableScandoes not support reading variant types.Does this PR introduce any user-facing change?
no
How was this patch tested?
added UTs
Was this patch authored or co-authored using generative AI tooling?
no