[GLUTEN-12535][CORE] Support backend-specific JNI input adapters - #12535
Conversation
bee9bdd to
c436dce
Compare
|
@jackylee-ch Can you review this PR? |
|
hi @wangxinshuo-bolt is this also part of refactor work in #12456? |
| std::unique_ptr<gluten::ColumnarBatchIterator> gluten::Runtime::createJniInputIterator( | ||
| const JniInputIteratorContext& context) { | ||
| return std::make_unique<JniColumnarBatchIterator>( | ||
| context.env, context.jColumnarBatchIterator, this, context.iteratorIndex); | ||
| } |
There was a problem hiding this comment.
Should this be defined in Runtime.cc?
| return dumper_.get(); | ||
| } | ||
|
|
||
| virtual std::unique_ptr<ColumnarBatchIterator> createJniInputIterator(const JniInputIteratorContext& context); |
There was a problem hiding this comment.
JniInputIteratorContext::env is of type JNIEnv* which requires jni.h, while the Runtime API is currently isolated from the JNI layer. Does it look like a design issue in the PR?
|
|
||
| namespace gluten { | ||
|
|
||
| std::shared_ptr<StreamReader> makeShuffleStreamReader(JNIEnv* env, jobject jShuffleStreamReader) { |
There was a problem hiding this comment.
We don't need to keep ShuffleStreamReader private. Would it make sense to move ShuffleStreamReader into JniCommon.h?
Yes |
| } | ||
| std::shared_ptr<arrow::io::InputStream> in = std::make_shared<JavaInputStreamAdaptor>(env, pool, jniIn); | ||
| return in; | ||
| ShuffleStreamReader::ShuffleStreamReader(JNIEnv* env, jobject reader) { |
There was a problem hiding this comment.
The implementation should be placed in JniCommon.cc
There was a problem hiding this comment.
The implementation should be placed in
JniCommon.cc
ok. I will fix it.
What changes are proposed in this pull request?
This PR provides backend-extensible JNI input adapters in Core as part of #12456.
The implementation:
JniInputIteratorFactoryregistry keyed by runtime kind.JniColumnarBatchIteratoras the default when no backend-specific factory is registered.ShuffleStreamReaderand Java input-stream adapter inJniCommon.JniCommonState.Backends can register their own JNI input iterator factory while continuing to use the common plan-evaluation and shuffle-stream interfaces.
How was this patch tested?
libgluten.so.Was this patch authored or co-authored using generative AI tooling?
Yes.
Generated-by: Codex GPT-5
Related issue: #12535