Jefffrey commented on code in PR #17965:
URL: https://github.com/apache/datafusion/pull/17965#discussion_r2413707276
##########
datafusion/functions/src/string/ascii.rs:
##########
@@ -186,6 +184,8 @@ mod tests {
test_ascii!(Some(String::from("a")), Ok(Some(97)));
test_ascii!(Some(String::from("")), Ok(Some(0)));
test_ascii!(Some(String::from("🚀")), Ok(Some(128640)));
+ test_ascii!(Some(String::from("\n")), Ok(Some(10)));
+ test_ascii!(Some(String::from("\t")), Ok(Some(9)));
Review Comment:
Consolidating the tests here, removing from Spark unit test (Spark slt still
remains)
##########
datafusion/spark/src/function/string/ascii.rs:
##########
@@ -15,21 +15,23 @@
// specific language governing permissions and limitations
// under the License.
-use arrow::array::{ArrayAccessor, ArrayIter, ArrayRef, AsArray, Int32Array};
use arrow::datatypes::DataType;
-use arrow::error::ArrowError;
-use datafusion_common::{internal_err, plan_err, Result};
+use datafusion_common::Result;
use datafusion_expr::ColumnarValue;
use datafusion_expr::{ScalarFunctionArgs, ScalarUDFImpl, Signature,
Volatility};
+use datafusion_functions::string::ascii::ascii;
use datafusion_functions::utils::make_scalar_function;
use std::any::Any;
-use std::sync::Arc;
-/// <https://spark.apache.org/docs/latest/api/sql/index.html#ascii>
+/// Spark compatible version of the [ascii] function. Differs from the
[default ascii function]
+/// in that it is more permissive of input types, for example casting numeric
input to string
+/// before executing the function (default version doesn't allow numeric
input).
+///
+/// [ascii]: https://spark.apache.org/docs/latest/api/sql/index.html#ascii
+/// [default ascii function]: datafusion_functions::string::ascii::AsciiFunc
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct SparkAscii {
Review Comment:
I considered removing this entirely and making AsciiFunc have a toggleable
behaviour for this, but keeping it like this was easier to work with
considering existing macros used to export the udf's
--
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]