Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3109#discussion_r20390957
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -262,7 +262,7 @@ object NullPropagation extends Rule[LogicalPlan] {
      */
     object ConstantFolding extends Rule[LogicalPlan] {
       def apply(plan: LogicalPlan): LogicalPlan = plan transform {
    -    case q: LogicalPlan => q transformExpressionsDown {
    +    case q: LogicalPlan => q transformExpressionsUp {
    --- End diff --
    
    Ah, sorry now I read the PR description more carefully and I think I 
understand.  However, this now seems kind of hacky to me.  We are now leaving 
the analysis phase with a tree that isn't actually valid and then hoping that 
constant folding is going to fix things down the road.  This breaks the 
contract that it should be safe to inspect dataTypes once analysis is done.
    
    Is this query valid in Hive?  If so, I'd almost rather add more rules/logic 
to analysis (maybe we need to have a notion of "resolved" for HiveUDFs and 
attempt to constant fold them if they aren't resolved?  What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to