Uh oh!
There was an error while loading. Please reload this page.
GH-34223: [Java] Java Substrait Consumer JNI call to ACERO C++ - #34227
Conversation
davisusanibar
commented
Feb 21, 2023
@github-actions crossbow submit java-jars |
Revision: 7500dd7c5e8ce6b0fbd3a0c800439980e508bfd8 Submitted crossbow builds: ursacomputing/crossbow @ actions-1555224742
|
Revision: 7500dd7c5e8ce6b0fbd3a0c800439980e508bfd8 Submitted crossbow builds: ursacomputing/crossbow @ actions-c5c0135c13
|
There was a problem hiding this comment.
Seems like this should be an interface?
There was a problem hiding this comment.
Plans should be byte[] or ByteBuffer?
There was a problem hiding this comment.
It seems this assumes JSON plans which is probably not what people will be working with
There was a problem hiding this comment.
Please if yu could help me, What will be my options to exchange a Substrait Plan (Java byte) to std::shared_ptr<arrow::Buffer> called by JNI?
There was a problem hiding this comment.
JNI functions can read byte arrays, you can then copy into an Arrow buffer (this is probably good anyways to avoid too many cross-boundary dependencies)
There was a problem hiding this comment.
I just create this ByteBuffer with Substrait Plan
ByteBuffer directByteBuffer = ByteBuffer.allocateDirect(64);
directByteBuffer.put("DEMO_SUBSTRAIT_PLAN".getBytes(StandardCharsets.UTF_8)); // protoPlan.toByteArray();
JNI Wrapper:
Recover ByteArray with:
jbyte *buff = (jbyte *) env->GetDirectBufferAddress(plan);
How I could transform that jbyte into std::shared_ptr<arrow::Buffer>
There was a problem hiding this comment.
Get the capacity, allocate a mutable buffer, memcpy the result
There was a problem hiding this comment.
This has to always match ARROW_DATASET so a separate variable won't make sense
7500dd7 to
92cb8d2Compare92cb8d2 to
a0aac46Comparedavisusanibar
commented
Mar 15, 2023
@github-actions crossbow submit java-jars |
Revision: e5594f8 Submitted crossbow builds: ursacomputing/crossbow @ actions-bf821d607d
|
davisusanibar
commented
Mar 16, 2023
@github-actions crossbow submit java-jars |
Revision: 223ddef Submitted crossbow builds: ursacomputing/crossbow @ actions-17d27841d2
|
kou
commented
Mar 16, 2023
Could you rebase on main to use #34480? |
lidavidm
commented
May 12, 2023
@github-actions crossbow submit java-jars |
Revision: ce7800b Submitted crossbow builds: ursacomputing/crossbow @ actions-02cc882fff
|
Uh oh!
There was an error while loading. Please reload this page.
| Map<String, String> metadataName = new HashMap<>(); | ||
| metadataName.put("ARROW:extension:name", "varchar"); | ||
| metadataName.put("ARROW:extension:metadata", "varchar{length:150}"); |
There was a problem hiding this comment.
Is the metadata actually necessary?
There was a problem hiding this comment.
Yes, it is needed, in the case of local tables we are seeing this metadata information in the response.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| * @param planInput the JSON Substrait plan. | ||
| * @param memoryAddressOutput the memory address where RecordBatchReader is exported. | ||
| */ | ||
| public native void executeSerializedPlanLocalFiles(String planInput, long memoryAddressOutput); |
Uh oh!
There was an error while loading. Please reload this page.
| try { | ||
| AutoCloseables.close(arrowArrayStream); | ||
| } catch (RuntimeException e) { | ||
| throw e; | ||
| } catch (Exception e) { | ||
| throw new RuntimeException(e); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| try { | ||
| AutoCloseables.close(arrowArrayStream); | ||
| } catch (Exception e) { | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
This method is declared to throw Exception already. Why are we catching and re-throwing this?
There was a problem hiding this comment.
Why are we catching it in the first place? Let it propagate.
| } catch (RuntimeException e) { | ||
| throw e; | ||
| } catch (Exception e) { | ||
| throw new RuntimeException(e); |
| builder.replace(builder.indexOf("FILENAME_PLACEHOLDER"), | ||
| builder.indexOf("FILENAME_PLACEHOLDER") + "FILENAME_PLACEHOLDER".length(), uri); | ||
| return builder.toString(); | ||
| return plan.replace("FILENAME_PLACEHOLDER", uri); |
There was a problem hiding this comment.
Again: why is this a whole method? Just inline it; it's only used once.
lidavidm
left a comment
There was a problem hiding this comment.
The last comments are still unaddressed.
ursabot
commented
May 30, 2023
Benchmark runs are scheduled for baseline = c4ea194 and contender = 95c33d8. 95c33d8 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
ursabot
commented
May 31, 2023
['Python', 'R'] benchmarks have high level of regressions. |
…ilter as a Substrait proto extended expression (#35570) ### Rationale for this change To close#34252 ### What changes are included in this PR? This is a proposal to try to solve: 1. Receive a list of Substrait scalar expressions and use them to Project a Dataset - [x] Draft a Substrait Extended Expression to test (this will be generated by 3rd party project such as Isthmus) - [x] Use C++ draft PR to Serialize/Deserialize Extended Expression proto messages - [x] Create JNI Wrapper for ScannerBuilder::Project - [x] Create JNI API - [x] Testing coverage - [x] Documentation Current problem is: `java.lang.RuntimeException: Inferring column projection from FieldRef FieldRef.FieldPath(0)`. Not able to infer by column position by able to infer by colum name. This problem is solved by #35798 This PR needs/use this PRs/Issues: - #34834 - #34227 - #35579 2. Receive a Boolean-valued Substrait scalar expression and use it to filter a Dataset - [x] Working to identify activities ### Are these changes tested? Initial unit test added. ### Are there any user-facing changes? No * Closes: #34252 Lead-authored-by: david dali susanibar arce <davi.sarces@gmail.com> Co-authored-by: Weston Pace <weston.pace@gmail.com> Co-authored-by: benibus <bpharks@gmx.com> Co-authored-by: David Li <li.davidm96@gmail.com> Co-authored-by: Dane Pitkin <48041712+danepitkin@users.noreply.github.com> Signed-off-by: David Li <li.davidm96@gmail.com>
…der::Filter as a Substrait proto extended expression (apache#35570) ### Rationale for this change To closeapache#34252 ### What changes are included in this PR? This is a proposal to try to solve: 1. Receive a list of Substrait scalar expressions and use them to Project a Dataset - [x] Draft a Substrait Extended Expression to test (this will be generated by 3rd party project such as Isthmus) - [x] Use C++ draft PR to Serialize/Deserialize Extended Expression proto messages - [x] Create JNI Wrapper for ScannerBuilder::Project - [x] Create JNI API - [x] Testing coverage - [x] Documentation Current problem is: `java.lang.RuntimeException: Inferring column projection from FieldRef FieldRef.FieldPath(0)`. Not able to infer by column position by able to infer by colum name. This problem is solved by apache#35798 This PR needs/use this PRs/Issues: - apache#34834 - apache#34227 - apache#35579 2. Receive a Boolean-valued Substrait scalar expression and use it to filter a Dataset - [x] Working to identify activities ### Are these changes tested? Initial unit test added. ### Are there any user-facing changes? No * Closes: apache#34252 Lead-authored-by: david dali susanibar arce <davi.sarces@gmail.com> Co-authored-by: Weston Pace <weston.pace@gmail.com> Co-authored-by: benibus <bpharks@gmx.com> Co-authored-by: David Li <li.davidm96@gmail.com> Co-authored-by: Dane Pitkin <48041712+danepitkin@users.noreply.github.com> Signed-off-by: David Li <li.davidm96@gmail.com>
The purpose of this PR is to implement: