Skip to content

[BLAZE-747][FOLLOW-UP] Fix user changed in FFI NextBatch#769

Merged
richox merged 1 commit intoapache:masterfrom
Flyangz:feature/fix-user-changed-in-native
Jan 16, 2025
Merged

[BLAZE-747][FOLLOW-UP] Fix user changed in FFI NextBatch#769
richox merged 1 commit intoapache:masterfrom
Flyangz:feature/fix-user-changed-in-native

Conversation

@Flyangz
Copy link
Contributor

@Flyangz Flyangz commented Jan 16, 2025

Which issue does this PR close?

follow-up #748
Closes #747

Rationale for this change

When executing ConvertToNativeExec, from native to JVM (calling exportNextBatch in Rust), the user has already exited the context initially set by runAsSparkUser in CoarseGrainedExecutorBackend.run. Therefore, it is necessary to re-enter the PrivilegedExceptionAction to execute exportNextBatch.

What changes are included in this PR?

We found the error occur in ArrowFFIExporter at line 64, so the change wraps this code in PrivilegedExceptionAction as well. Alternatively, instead of checking if the user has changed, always execute in PrivilegedExceptionAction. This makes the code simpler and maintains consistency with the runAsSparkUser.
https://github.com/kwai/blaze/blob/ba86c7ae438f90ab8ec1fe0752067e1c8d7f5d67/spark-extension/src/main/scala/org/apache/spark/sql/execution/blaze/arrowio/ArrowFFIExporter.scala#L64
image

Are there any user-facing changes?

No

@Flyangz
Copy link
Contributor Author

Flyangz commented Jan 16, 2025

@richox Would you mind reviewing this pr?

@merrily01
Copy link
Member

LGTM,thanks for your contribution

@richox richox merged commit 2747e66 into apache:master Jan 16, 2025
1236 checks passed
@richox richox mentioned this pull request Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permission issue in text table join leads to failure

3 participants