Skip to content

Commit 2dd8909

Browse files
authored
chore: [df52] fix index out of bounds for native_datafusion scan (#3485)
1 parent ad18b1c commit 2dd8909

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

native/core/src/parquet/parquet_exec.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ pub(crate) fn init_datasource_exec(
8484

8585
// Determine the schema to use for ParquetSource
8686
// // Use data_schema only if both data_schema and data_filters are set
87-
// let base_schema = match (&data_schema, &data_filters) {
88-
// (Some(schema), Some(_)) => Arc::clone(schema),
89-
// _ => Arc::clone(&required_schema),
90-
// };
91-
let base_schema = required_schema;
87+
let base_schema = match (&data_schema, &projection_vector) {
88+
(Some(schema), Some(_)) => Arc::clone(schema),
89+
_ => Arc::clone(&required_schema),
90+
};
91+
//let base_schema = required_schema;
9292
// dbg!(&base_schema);
9393
// dbg!(&data_schema);
9494
// dbg!(&data_filters);

native/spark-expr/src/conversion_funcs/cast.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,10 @@ pub fn spark_cast(
906906
data_type: &DataType,
907907
cast_options: &SparkCastOptions,
908908
) -> DataFusionResult<ColumnarValue> {
909-
let input_type = match &arg {
910-
ColumnarValue::Array(array) => array.data_type().clone(),
911-
ColumnarValue::Scalar(scalar) => scalar.data_type(),
912-
};
909+
// let input_type = match &arg {
910+
// ColumnarValue::Array(array) => array.data_type().clone(),
911+
// ColumnarValue::Scalar(scalar) => scalar.data_type(),
912+
// };
913913

914914
let result = match arg {
915915
ColumnarValue::Array(array) => {
@@ -927,10 +927,10 @@ pub fn spark_cast(
927927
}
928928
};
929929

930-
let result_type = match &result {
931-
ColumnarValue::Array(array) => array.data_type().clone(),
932-
ColumnarValue::Scalar(scalar) => scalar.data_type(),
933-
};
930+
// let result_type = match &result {
931+
// ColumnarValue::Array(array) => array.data_type().clone(),
932+
// ColumnarValue::Scalar(scalar) => scalar.data_type(),
933+
// };
934934

935935
// println!(
936936
// "spark_cast: {} -> {} (requested: {})",

native/spark-expr/src/csv_funcs/to_csv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ impl PhysicalExpr for ToCsv {
115115
)))
116116
}
117117

118-
fn fmt_sql(&self, _: &mut Formatter<'_>) -> std::fmt::Result {
119-
unimplemented!()
118+
fn fmt_sql(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
119+
Display::fmt(self, f)
120120
}
121121
}
122122

native/spark-expr/src/unbound.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use arrow::datatypes::{DataType, Schema};
2020
use datafusion::common::{internal_err, Result};
2121
use datafusion::physical_expr::PhysicalExpr;
2222
use datafusion::physical_plan::ColumnarValue;
23-
use std::fmt::Formatter;
23+
use std::fmt::{Display, Formatter};
2424
use std::{hash::Hash, sync::Arc};
2525

2626
/// This is similar to `UnKnownColumn` in DataFusion, but it has data type.
@@ -64,8 +64,8 @@ impl PhysicalExpr for UnboundColumn {
6464
self
6565
}
6666

67-
fn fmt_sql(&self, _: &mut Formatter<'_>) -> std::fmt::Result {
68-
unimplemented!()
67+
fn fmt_sql(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
68+
Display::fmt(self, f)
6969
}
7070

7171
/// Get the data type of this expression, given the schema of the input

0 commit comments

Comments
 (0)