Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade deps to datafusion 41 #802

Merged
merged 12 commits into from
Aug 23, 2024
108 changes: 72 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ tokio = { version = "1.39", features = ["macros", "rt", "rt-multi-thread", "sync
rand = "0.8"
pyo3 = { version = "0.21", features = ["extension-module", "abi3", "abi3-py38"] }
arrow = { version = "52", feature = ["pyarrow"] }
datafusion = { version = "40.0.0", features = ["pyarrow", "avro", "unicode_expressions"] }
datafusion-common = { version = "40.0.0", features = ["pyarrow"] }
datafusion-expr = "40.0.0"
datafusion-functions-array = "40.0.0"
datafusion-optimizer = "40.0.0"
datafusion-sql = "40.0.0"
datafusion-substrait = { version = "40.0.0", optional = true }
datafusion = { version = "41.0.0", features = ["pyarrow", "avro", "unicode_expressions"] }
datafusion-common = { version = "41.0.0", features = ["pyarrow"] }
datafusion-expr = { version = "41.0.0" }
datafusion-functions-nested = { version = "41.0.0" }
datafusion-optimizer = { version = "41.0.0" }
datafusion-sql = { version = "41.0.0" }
datafusion-substrait = { version = "41.0.0", optional = true }
prost = "0.12" # keep in line with `datafusion-substrait`
prost-types = "0.12" # keep in line with `datafusion-substrait`
uuid = { version = "1.9", features = ["v4"] }
Expand All @@ -56,7 +56,6 @@ parking_lot = "0.12"
regex-syntax = "0.8"
syn = "2.0.68"
url = "2"
sqlparser = "0.47.0"

[build-dependencies]
pyo3-build-config = "0.21"
Expand Down
6 changes: 3 additions & 3 deletions python/datafusion/tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ def test_regr_funcs_sql(df):

assert result[0].column(0) == pa.array([None], type=pa.float64())
assert result[0].column(1) == pa.array([None], type=pa.float64())
assert result[0].column(2) == pa.array([1], type=pa.float64())
assert result[0].column(2) == pa.array([1], type=pa.uint64())
assert result[0].column(3) == pa.array([None], type=pa.float64())
assert result[0].column(4) == pa.array([1], type=pa.float64())
assert result[0].column(5) == pa.array([1], type=pa.float64())
Expand Down Expand Up @@ -840,7 +840,7 @@ def test_regr_funcs_sql_2():
# Assertions for SQL results
assert result_sql[0].column(0) == pa.array([2], type=pa.float64())
assert result_sql[0].column(1) == pa.array([0], type=pa.float64())
assert result_sql[0].column(2) == pa.array([3], type=pa.float64()) # todo: i would not expect this to be float
assert result_sql[0].column(2) == pa.array([3], type=pa.uint64())
assert result_sql[0].column(3) == pa.array([1], type=pa.float64())
assert result_sql[0].column(4) == pa.array([2], type=pa.float64())
assert result_sql[0].column(5) == pa.array([4], type=pa.float64())
Expand All @@ -852,7 +852,7 @@ def test_regr_funcs_sql_2():
@pytest.mark.parametrize("func, expected", [
pytest.param(f.regr_slope, pa.array([2], type=pa.float64()), id="regr_slope"),
pytest.param(f.regr_intercept, pa.array([0], type=pa.float64()), id="regr_intercept"),
pytest.param(f.regr_count, pa.array([3], type=pa.float64()), id="regr_count"), # TODO: I would expect this to return an int array
pytest.param(f.regr_count, pa.array([3], type=pa.uint64()), id="regr_count"),
pytest.param(f.regr_r2, pa.array([1], type=pa.float64()), id="regr_r2"),
pytest.param(f.regr_avgx, pa.array([2], type=pa.float64()), id="regr_avgx"),
pytest.param(f.regr_avgy, pa.array([4], type=pa.float64()), id="regr_avgy"),
Expand Down
2 changes: 1 addition & 1 deletion src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::errors::DataFusionError;
use crate::utils::wait_for_future;
use datafusion::{
arrow::pyarrow::ToPyArrow,
catalog::{schema::SchemaProvider, CatalogProvider},
catalog::{CatalogProvider, SchemaProvider},
datasource::{TableProvider, TableType},
};

Expand Down
17 changes: 9 additions & 8 deletions src/common/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use datafusion::arrow::array::Array;
use datafusion::arrow::datatypes::{DataType, IntervalUnit, TimeUnit};
use datafusion_common::{DataFusionError, ScalarValue};
use datafusion_expr::sqlparser::ast::NullTreatment as DFNullTreatment;
use pyo3::{exceptions::PyValueError, prelude::*};

use crate::errors::py_datafusion_err;
Expand Down Expand Up @@ -775,20 +776,20 @@ pub enum NullTreatment {
RESPECT_NULLS,
}

impl From<NullTreatment> for sqlparser::ast::NullTreatment {
fn from(null_treatment: NullTreatment) -> sqlparser::ast::NullTreatment {
impl From<NullTreatment> for DFNullTreatment {
fn from(null_treatment: NullTreatment) -> DFNullTreatment {
match null_treatment {
NullTreatment::IGNORE_NULLS => sqlparser::ast::NullTreatment::IgnoreNulls,
NullTreatment::RESPECT_NULLS => sqlparser::ast::NullTreatment::RespectNulls,
NullTreatment::IGNORE_NULLS => DFNullTreatment::IgnoreNulls,
NullTreatment::RESPECT_NULLS => DFNullTreatment::RespectNulls,
}
}
}

impl From<sqlparser::ast::NullTreatment> for NullTreatment {
fn from(null_treatment: sqlparser::ast::NullTreatment) -> NullTreatment {
impl From<DFNullTreatment> for NullTreatment {
fn from(null_treatment: DFNullTreatment) -> NullTreatment {
match null_treatment {
sqlparser::ast::NullTreatment::IgnoreNulls => NullTreatment::IGNORE_NULLS,
sqlparser::ast::NullTreatment::RespectNulls => NullTreatment::RESPECT_NULLS,
DFNullTreatment::IgnoreNulls => NullTreatment::IGNORE_NULLS,
DFNullTreatment::RespectNulls => NullTreatment::RESPECT_NULLS,
}
}
}
Loading
Loading