Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feature/9835
Browse files Browse the repository at this point in the history
# Conflicts:
#	datafusion/expr/src/built_in_function.rs
#	datafusion/functions/src/unicode/left.rs
#	datafusion/functions/src/unicode/lpad.rs
#	datafusion/functions/src/unicode/mod.rs
#	datafusion/functions/src/unicode/reverse.rs
#	datafusion/functions/src/unicode/right.rs
#	datafusion/functions/src/unicode/rpad.rs
#	datafusion/physical-expr/src/unicode_expressions.rs
#	datafusion/proto/src/generated/pbjson.rs
#	datafusion/proto/src/generated/prost.rs
#	datafusion/proto/src/logical_plan/from_proto.rs
#	datafusion/proto/src/logical_plan/to_proto.rs
  • Loading branch information
Omega359 committed Mar 29, 2024
2 parents 9fce443 + 09f5a54 commit 7a40ac7
Show file tree
Hide file tree
Showing 14 changed files with 495 additions and 202 deletions.
30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/apache/arrow-datafusion"
rust-version = "1.72"
version = "36.0.0"
version = "37.0.0"

[workspace.dependencies]
# We turn off default-features for some dependencies here so the workspaces which inherit them can
Expand All @@ -71,20 +71,20 @@ bytes = "1.4"
chrono = { version = "0.4.34", default-features = false }
ctor = "0.2.0"
dashmap = "5.4.0"
datafusion = { path = "datafusion/core", version = "36.0.0", default-features = false }
datafusion-common = { path = "datafusion/common", version = "36.0.0", default-features = false }
datafusion-common-runtime = { path = "datafusion/common-runtime", version = "36.0.0" }
datafusion-execution = { path = "datafusion/execution", version = "36.0.0" }
datafusion-expr = { path = "datafusion/expr", version = "36.0.0" }
datafusion-functions = { path = "datafusion/functions", version = "36.0.0" }
datafusion-functions-array = { path = "datafusion/functions-array", version = "36.0.0" }
datafusion-optimizer = { path = "datafusion/optimizer", version = "36.0.0", default-features = false }
datafusion-physical-expr = { path = "datafusion/physical-expr", version = "36.0.0", default-features = false }
datafusion-physical-plan = { path = "datafusion/physical-plan", version = "36.0.0" }
datafusion-proto = { path = "datafusion/proto", version = "36.0.0" }
datafusion-sql = { path = "datafusion/sql", version = "36.0.0" }
datafusion-sqllogictest = { path = "datafusion/sqllogictest", version = "36.0.0" }
datafusion-substrait = { path = "datafusion/substrait", version = "36.0.0" }
datafusion = { path = "datafusion/core", version = "37.0.0", default-features = false }
datafusion-common = { path = "datafusion/common", version = "37.0.0", default-features = false }
datafusion-common-runtime = { path = "datafusion/common-runtime", version = "37.0.0" }
datafusion-execution = { path = "datafusion/execution", version = "37.0.0" }
datafusion-expr = { path = "datafusion/expr", version = "37.0.0" }
datafusion-functions = { path = "datafusion/functions", version = "37.0.0" }
datafusion-functions-array = { path = "datafusion/functions-array", version = "37.0.0" }
datafusion-optimizer = { path = "datafusion/optimizer", version = "37.0.0", default-features = false }
datafusion-physical-expr = { path = "datafusion/physical-expr", version = "37.0.0", default-features = false }
datafusion-physical-plan = { path = "datafusion/physical-plan", version = "37.0.0" }
datafusion-proto = { path = "datafusion/proto", version = "37.0.0" }
datafusion-sql = { path = "datafusion/sql", version = "37.0.0" }
datafusion-sqllogictest = { path = "datafusion/sqllogictest", version = "37.0.0" }
datafusion-substrait = { path = "datafusion/substrait", version = "37.0.0" }
doc-comment = "0.3"
env_logger = "0.11"
futures = "0.3"
Expand Down
24 changes: 12 additions & 12 deletions datafusion-cli/Cargo.lock

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

4 changes: 2 additions & 2 deletions datafusion-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[package]
name = "datafusion-cli"
description = "Command Line Client for DataFusion query engine."
version = "36.0.0"
version = "37.0.0"
authors = ["Apache Arrow <[email protected]>"]
edition = "2021"
keywords = ["arrow", "datafusion", "query", "sql"]
Expand All @@ -35,7 +35,7 @@ async-trait = "0.1.41"
aws-config = "0.55"
aws-credential-types = "0.55"
clap = { version = "3", features = ["derive", "cargo"] }
datafusion = { path = "../datafusion/core", version = "36.0.0", features = [
datafusion = { path = "../datafusion/core", version = "37.0.0", features = [
"avro",
"crypto_expressions",
"datetime_expressions",
Expand Down
7 changes: 4 additions & 3 deletions datafusion-examples/examples/function_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
// under the License.

use datafusion::error::Result;
use datafusion::execution::config::SessionConfig;
use datafusion::execution::context::{FunctionFactory, RegisterFunction, SessionContext};
use datafusion::execution::context::{
FunctionFactory, RegisterFunction, SessionContext, SessionState,
};
use datafusion_common::tree_node::{Transformed, TreeNode};
use datafusion_common::{exec_err, internal_err, DataFusionError};
use datafusion_expr::simplify::ExprSimplifyResult;
Expand Down Expand Up @@ -91,7 +92,7 @@ impl FunctionFactory for CustomFunctionFactory {
/// the function instance.
async fn create(
&self,
_state: &SessionConfig,
_state: &SessionState,
statement: CreateFunction,
) -> Result<RegisterFunction> {
let f: ScalarFunctionWrapper = statement.try_into()?;
Expand Down
1 change: 1 addition & 0 deletions datafusion/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# Changelog

- [37.0.0](../dev/changelog/37.0.0.md)
- [36.0.0](../dev/changelog/36.0.0.md)
- [35.0.0](../dev/changelog/35.0.0.md)
- [34.0.0](../dev/changelog/34.0.0.md)
Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/src/execution/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ impl SessionContext {
let function_factory = &state.function_factory;

match function_factory {
Some(f) => f.create(state.config(), stmt).await?,
Some(f) => f.create(&state, stmt).await?,
_ => Err(DataFusionError::Configuration(
"Function factory has not been configured".into(),
))?,
Expand Down Expand Up @@ -1288,7 +1288,7 @@ pub trait FunctionFactory: Sync + Send {
/// Handles creation of user defined function specified in [CreateFunction] statement
async fn create(
&self,
state: &SessionConfig,
state: &SessionState,
statement: CreateFunction,
) -> Result<RegisterFunction>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ struct CustomFunctionFactory {}
impl FunctionFactory for CustomFunctionFactory {
async fn create(
&self,
_state: &SessionConfig,
_state: &SessionState,
statement: CreateFunction,
) -> Result<RegisterFunction> {
let f: ScalarFunctionWrapper = statement.try_into()?;
Expand Down
47 changes: 19 additions & 28 deletions datafusion/functions/src/unicode/left.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,108 +117,99 @@ mod tests {

#[test]
fn test_functions() -> Result<()> {
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("abcde")))),
ColumnarValue::Scalar(ScalarValue::Int64(Some(2))),
ColumnarValue::Scalar(ScalarValue::from("abcde")),
ColumnarValue::Scalar(ScalarValue::from(2i64)),
],
Ok(Some("ab")),
&str,
Utf8,
StringArray
);
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("abcde")))),
ColumnarValue::Scalar(ScalarValue::Int64(Some(200))),
ColumnarValue::Scalar(ScalarValue::from("abcde")),
ColumnarValue::Scalar(ScalarValue::from(200i64)),
],
Ok(Some("abcde")),
&str,
Utf8,
StringArray
);
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("abcde")))),
ColumnarValue::Scalar(ScalarValue::Int64(Some(-2))),
ColumnarValue::Scalar(ScalarValue::from("abcde")),
ColumnarValue::Scalar(ScalarValue::from(-2i64)),
],
Ok(Some("abc")),
&str,
Utf8,
StringArray
);
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("abcde")))),
ColumnarValue::Scalar(ScalarValue::Int64(Some(-200))),
ColumnarValue::Scalar(ScalarValue::from("abcde")),
ColumnarValue::Scalar(ScalarValue::from(-200i64)),
],
Ok(Some("")),
&str,
Utf8,
StringArray
);
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("abcde")))),
ColumnarValue::Scalar(ScalarValue::Int64(Some(0))),
ColumnarValue::Scalar(ScalarValue::from("abcde")),
ColumnarValue::Scalar(ScalarValue::from(0i64)),
],
Ok(Some("")),
&str,
Utf8,
StringArray
);
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(None)),
ColumnarValue::Scalar(ScalarValue::Int64(Some(2))),
ColumnarValue::Scalar(ScalarValue::from(2i64)),
],
Ok(None),
&str,
Utf8,
StringArray
);
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("abcde")))),
ColumnarValue::Scalar(ScalarValue::from("abcde")),
ColumnarValue::Scalar(ScalarValue::Int64(None)),
],
Ok(None),
&str,
Utf8,
StringArray
);
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("joséésoj")))),
ColumnarValue::Scalar(ScalarValue::Int64(Some(5))),
ColumnarValue::Scalar(ScalarValue::from("joséésoj")),
ColumnarValue::Scalar(ScalarValue::from(5i64)),
],
Ok(Some("joséé")),
&str,
Utf8,
StringArray
);
#[cfg(feature = "unicode_expressions")]
test_function!(
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("joséésoj")))),
ColumnarValue::Scalar(ScalarValue::Int64(Some(-3))),
ColumnarValue::Scalar(ScalarValue::from("joséésoj")),
ColumnarValue::Scalar(ScalarValue::from(-3i64)),
],
Ok(Some("joséé")),
&str,
Expand All @@ -227,10 +218,10 @@ mod tests {
);
#[cfg(not(feature = "unicode_expressions"))]
test_function!(
LeftFunc::new90,
LeftFunc::new(),
&[
ColumnarValue::Scalar(ScalarValue::Utf8(Some(String::from("abcde")))),
ColumnarValue::Scalar(ScalarValue::Int64(Some(2))),
ColumnarValue::Scalar(ScalarValue::from("abcde")),
ColumnarValue::Scalar(ScalarValue::from(2i64)),
],
internal_err!(
"function left requires compilation with feature flag: unicode_expressions."
Expand Down
Loading

0 comments on commit 7a40ac7

Please sign in to comment.