2010YOUY01 commented on code in PR #7726:
URL: https://github.com/apache/arrow-datafusion/pull/7726#discussion_r1343054607


##########
datafusion/expr/src/signature.rs:
##########
@@ -20,35 +20,77 @@
 
 use arrow::datatypes::DataType;
 
+/// Constant that is used as a placeholder for any valid timezone.
+/// This is used where a function can accept a timestamp type with any
+/// valid timezone, it exists to avoid the need to enumerate all possible
+/// timezones. See [`TypeSignature`] for more details.
+///
+/// Type coercion always ensures that functions will be executed using
+/// timestamp arrays that have a valid time zone. Functions must never
+/// return results with this timezone.
+pub const TIMEZONE_WILDCARD: &str = "+TZ";
+
 ///A function's volatility, which defines the functions eligibility for 
certain optimizations
 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
 pub enum Volatility {
-    /// Immutable - An immutable function will always return the same output 
when given the same
-    /// input. An example of this is [super::BuiltinScalarFunction::Cos].
+    /// An immutable function will always return the same output when given 
the same
+    /// input. An example of this is [super::BuiltinScalarFunction::Cos]. 
DataFusion
+    /// will attempt to inline immutable functions during planning.
     Immutable,
-    /// Stable - A stable function may return different values given the same 
input across different
+    /// A stable function may return different values given the same input 
across different
     /// queries but must return the same value for a given input within a 
query. An example of
-    /// this is [super::BuiltinScalarFunction::Now].
+    /// this is [super::BuiltinScalarFunction::Now]. DataFusion
+    /// will attempt to inline immutable functions during planning, when 
possible.
     Stable,
-    /// Volatile - A volatile function may change the return value from 
evaluation to evaluation.
+    /// A volatile function may change the return value from evaluation to 
evaluation.
     /// Multiple invocations of a volatile function may return different 
results when used in the
-    /// same query. An example of this is 
[super::BuiltinScalarFunction::Random].
+    /// same query. An example of this is 
[super::BuiltinScalarFunction::Random]. DataFusion
+    /// can not evaluate such functions during planning.

Review Comment:
   ```suggestion
       /// can not evaluate such functions during planning.
       /// In the query `select col1, random() from t1`, `random()` function 
will be evaluated
       /// for each output row, resulting in a unique random value for each row.
   ```



##########
datafusion/expr/src/signature.rs:
##########
@@ -20,35 +20,77 @@
 
 use arrow::datatypes::DataType;
 
+/// Constant that is used as a placeholder for any valid timezone.
+/// This is used where a function can accept a timestamp type with any
+/// valid timezone, it exists to avoid the need to enumerate all possible
+/// timezones. See [`TypeSignature`] for more details.
+///
+/// Type coercion always ensures that functions will be executed using
+/// timestamp arrays that have a valid time zone. Functions must never
+/// return results with this timezone.
+pub const TIMEZONE_WILDCARD: &str = "+TZ";
+
 ///A function's volatility, which defines the functions eligibility for 
certain optimizations
 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
 pub enum Volatility {
-    /// Immutable - An immutable function will always return the same output 
when given the same
-    /// input. An example of this is [super::BuiltinScalarFunction::Cos].
+    /// An immutable function will always return the same output when given 
the same
+    /// input. An example of this is [super::BuiltinScalarFunction::Cos]. 
DataFusion
+    /// will attempt to inline immutable functions during planning.
     Immutable,
-    /// Stable - A stable function may return different values given the same 
input across different
+    /// A stable function may return different values given the same input 
across different
     /// queries but must return the same value for a given input within a 
query. An example of
-    /// this is [super::BuiltinScalarFunction::Now].
+    /// this is [super::BuiltinScalarFunction::Now]. DataFusion
+    /// will attempt to inline immutable functions during planning, when 
possible.

Review Comment:
   ```suggestion
       /// will attempt to inline `Stable` functions during planning, when 
possible.
       /// For query `select col1, now() from t1`, it might take a while to 
execute but
       /// `now()` column will be the same for each output row, which is 
evaluated
       /// during planning.
   ```



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