matthewgapp commented on code in PR #7638:
URL: https://github.com/apache/arrow-datafusion/pull/7638#discussion_r1335255123


##########
datafusion/expr/src/window_function.rs:
##########
@@ -114,19 +114,35 @@ pub enum BuiltInWindowFunction {
 
 impl BuiltInWindowFunction {
     fn name(&self) -> &str {
-        use BuiltInWindowFunction::*;
+        use BuiltInWindowFunction as F;
         match self {
-            RowNumber => "ROW_NUMBER",
-            Rank => "RANK",
-            DenseRank => "DENSE_RANK",
-            PercentRank => "PERCENT_RANK",
-            CumeDist => "CUME_DIST",
-            Ntile => "NTILE",
-            Lag => "LAG",
-            Lead => "LEAD",
-            FirstValue => "FIRST_VALUE",
-            LastValue => "LAST_VALUE",
-            NthValue => "NTH_VALUE",
+            F::RowNumber => "ROW_NUMBER",
+            F::Rank => "RANK",
+            F::DenseRank => "DENSE_RANK",
+            F::PercentRank => "PERCENT_RANK",
+            F::CumeDist => "CUME_DIST",
+            F::Ntile => "NTILE",
+            F::Lag => "LAG",
+            F::Lead => "LEAD",
+            F::FirstValue => "FIRST_VALUE",
+            F::LastValue => "LAST_VALUE",
+            F::NthValue => "NTH_VALUE",
+        }
+    }
+
+    // these values need to stay in sync with the `field` value defined on the 
physical expressions
+    pub fn nullable(&self) -> bool {
+        use BuiltInWindowFunction as F;
+        match self {
+            F::RowNumber | F::Ntile | F::Rank | F::CumeDist => false,
+            // the rest are assumed to be nullable

Review Comment:
   not sure if there is a way that we can derive this from the definitions of 
the physical plans or elsewhere? Kinda sucks to have this information hardcoded 
this information in two places (right now, it exists also in the `field` method 
definition on the `BuildInWindowFunctionExpr` trait 
([example](https://github.com/apache/arrow-datafusion/blob/78d9613e81557ca5e5db8b75e5c7dec47ccee0a1/datafusion/physical-expr/src/window/row_number.rs#L54))



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