wirybeaver commented on code in PR #119:
URL: https://github.com/apache/datafusion-java/pull/119#discussion_r4659571024
##########
native/src/table_provider.rs:
##########
@@ -216,41 +355,28 @@ impl ExecutionPlan for JavaScanExec {
)
};
- // 3. Surface any Java exception.
- if env.exception_check().unwrap_or(false) {
- let throwable = env.exception_occurred().map_err(|e| {
- DataFusionError::Execution(format!("exception_occurred failed:
{}", e))
- })?;
- env.exception_clear().ok();
- return Err(DataFusionError::Execution(jthrowable_to_string(
- &mut env,
- &throwable,
- "TableProvider",
- &self.name,
- )));
- }
-
- call_result.map_err(|e| DataFusionError::Execution(format!("JNI call
failed: {}", e)))?;
+ checked_call(&mut env, call_result, &self.name)?;
// 4. Reclaim the FFI struct and import as a RecordBatchReader.
let ffi_stream: FFI_ArrowArrayStream = *ffi_box;
let reader = ArrowArrayStreamReader::try_new(ffi_stream)
.map_err(|e| DataFusionError::ArrowError(Box::new(e), None))?;
- // 5. Verify the producer's declared schema matches our registered
schema.
+ // 5. A plan can push projection into its reader or return the
registered full schema,
+ // as the default Java scanWithArgs implementation does for legacy
providers.
let reader_schema = reader.schema();
- // Schema::PartialEq compares fields AND metadata. If IPC / FFI
round-trips
- // ever normalise metadata differently between the registration path
and the
- // scan path, switch to comparing `.fields()` only.
- if reader_schema.as_ref() != self.full_schema.as_ref() {
+ let projection = if reader_schema == self.projected_schema {
Review Comment:
Done. Added a regression test that returns the projected columns in reverse
order and checks for the `expected projected schema` error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]