Omega359 commented on code in PR #8886:
URL: https://github.com/apache/arrow-datafusion/pull/8886#discussion_r1457833497


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -1027,18 +1420,34 @@ pub fn to_timestamp_nanos_invoke(args: 
&[ColumnarValue]) -> Result<ColumnarValue
 
 /// to_timestamp_seconds() SQL function implementation
 pub fn to_timestamp_seconds_invoke(args: &[ColumnarValue]) -> 
Result<ColumnarValue> {
-    if args.len() != 1 {
+    if args.is_empty() {
         return internal_err!(
-            "to_timestamp_seconds function requires 1 argument, got {}",
+            "to_timestamp_seconds function requires 1 or more arguments, got 
{}",
             args.len()
         );
     }
 
+    // validate that any args after the first one are Utf8
+    if args.len() > 1 {
+        for (idx, a) in args.iter().skip(1).enumerate() {
+            if a.data_type() != DataType::Utf8 {
+                return internal_err!(
+                    "to_timestamp_seconds function unsupported data type at 
index {}: {}",
+                    idx,
+                    a.data_type()
+                );
+            }
+        }
+    }

Review Comment:
   Good idea, will do.



-- 
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]

Reply via email to