andygrove commented on code in PR #58:
URL: https://github.com/apache/datafusion-spark/pull/58#discussion_r4565261099
##########
crates/spark/src/function/string/substring.rs:
##########
@@ -14,21 +14,52 @@ use datafusion_common::types::{
NativeType, logical_int32, logical_int64, logical_string,
};
use datafusion_common::{Result, exec_err};
-use datafusion_expr::{Coercion, ReturnFieldArgs, TypeSignatureClass};
+use datafusion_expr::{Coercion, Documentation, ReturnFieldArgs,
TypeSignatureClass};
use datafusion_expr::{
ColumnarValue, ScalarFunctionArgs, ScalarUDFImpl, Signature, TypeSignature,
Volatility,
};
use datafusion_functions::unicode::substr::{enable_ascii_fast_path,
get_true_start_end};
use datafusion_functions::utils::make_scalar_function;
+use datafusion_macros::user_doc;
use std::sync::Arc;
/// Spark-compatible `substring` expression
/// <https://spark.apache.org/docs/latest/api/sql/index.html#substring>
-///
-/// Returns the substring from string starting at position pos with length len.
-/// Position is 1-indexed. If pos is negative, it counts from the end of the
string.
-/// Returns NULL if any input is NULL.
+#[user_doc(
+ doc_section(label = "String Functions"),
+ description = "Returns the substring of `str` that starts at `pos` and is
`length` characters long. \
+ Positions are 1-based and count characters (bytes for binary input). A
position of 0 is treated as 1. \
+ A negative position counts from the end of the string; if it reaches
past the start and no length is given, \
+ the whole string is returned. A position past the end, or a length of
0 or less, returns an empty string, \
+ and a length that runs past the end is clamped. Returns NULL if any
input is NULL.",
Review Comment:
Thanks, good feedback. Fixed.
--
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]