From 7289a3fc9bd16971af46a7de8ba9336608fbf92c Mon Sep 17 00:00:00 2001 From: marvinlanhenke Date: Thu, 30 May 2024 18:29:26 +0200 Subject: [PATCH 1/2] fix: signature fn octect_length --- datafusion/functions/src/string/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datafusion/functions/src/string/mod.rs b/datafusion/functions/src/string/mod.rs index 52411142cb8d..e931c4998115 100644 --- a/datafusion/functions/src/string/mod.rs +++ b/datafusion/functions/src/string/mod.rs @@ -128,8 +128,8 @@ pub mod expr_fn { } #[doc = "returns the number of bytes of a string"] - pub fn octet_length(args: Vec) -> Expr { - super::octet_length().call(args) + pub fn octet_length(args: Expr) -> Expr { + super::octet_length().call(vec![args]) } #[doc = "replace the substring of string that starts at the start'th character and extends for count characters with new substring"] From 4fef0913d4eac7a67bd8df45a8f3116234f6fd1d Mon Sep 17 00:00:00 2001 From: marvinlanhenke Date: Thu, 30 May 2024 20:38:13 +0200 Subject: [PATCH 2/2] chore: add test --- datafusion/core/tests/expr_api/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/datafusion/core/tests/expr_api/mod.rs b/datafusion/core/tests/expr_api/mod.rs index a69f7bd48437..1db5aa9f235a 100644 --- a/datafusion/core/tests/expr_api/mod.rs +++ b/datafusion/core/tests/expr_api/mod.rs @@ -28,6 +28,23 @@ use std::sync::{Arc, OnceLock}; mod simplification; +#[test] +fn test_octet_length() { + #[rustfmt::skip] + evaluate_expr_test( + octet_length(col("list")), + vec![ + "+------+", + "| expr |", + "+------+", + "| 5 |", + "| 18 |", + "| 6 |", + "+------+", + ], + ); +} + #[test] fn test_eq() { // id = '2'