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 ColumnarToRowExec cannot pass CometBuffer safety check #1059

Open
viirya opened this issue Nov 5, 2024 · 1 comment
Open

Spark ColumnarToRowExec cannot pass CometBuffer safety check #1059

viirya opened this issue Nov 5, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@viirya
Copy link
Member

viirya commented Nov 5, 2024

Describe the bug

This was found during debugging CI failures of #1050.

One example of failed test is date_add with int scalars in CometExpressionSuite. The query is "SELECT _20 + CAST(2 as $intType) from tbl which has simply a CometScan + CometProject + Spark ColumnarToRowExec.

CometProject (i.e., DataFusion ProjectExec) doesn't store arrays internally. The only possibility that fails the safety check is that the arrays are not released before we fill next values into the CometBuffers.

In Spark ColumnarToRowExec, once it pulls out all rows from current ColumnarBatch, it simply assigns it to null to release the JVM object, but close is never called on the batch object to release vector resources (e.g., for Comet, Arrow arrays). It is more complicated than just add a close call there because Spark uses WritableColumnVector there for some components (e.g., Parquet reader). Once close is called on a WritableColumnVector, it will make the vector "not" writable anymore.

To completely fix it, we need some changes in Spark. I did a quick experiment locally in Spark and verified that if a close is properly called on non WritableColumnVector there, failed tests can pass without failing the safety check.

Steps to reproduce

No response

Expected behavior

No response

Additional context

No response

@viirya viirya added the bug Something isn't working label Nov 5, 2024
@viirya viirya self-assigned this Nov 5, 2024
@viirya
Copy link
Member Author

viirya commented Nov 5, 2024

The Spark fix: apache/spark#48767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant