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

[SPARK-48833][SQL][VARIANT] Support variant in InMemoryTableScan #47252

Closed

Conversation

richardc-db
Copy link
Contributor

@richardc-db richardc-db commented Jul 8, 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

@github-actions github-actions bot added the SQL label Jul 8, 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)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not simply one int for value size and one int for metadata size?

Copy link
Contributor Author

@richardc-db richardc-db Jul 23, 2024

Choose a reason for hiding this comment

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

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
Copy link
Contributor

the protobuf failure is unrelated, thanks, merging to master!

@cloud-fan cloud-fan closed this in 0c9b072 Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants