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

    https://github.com/apache/spark/pull/16659#discussion_r97202652
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
 ---
    @@ -115,41 +115,17 @@ class SubexpressionEliminationSuite extends 
SparkFunSuite {
         val mul2 = Multiply(mul, mul)
         val sqrt = Sqrt(mul2)
         val sum = Add(mul2, sqrt)
    -    equivalence.addExprTree(mul, true)
    -    equivalence.addExprTree(mul2, true)
    -    equivalence.addExprTree(sqrt, true)
    -    equivalence.addExprTree(sum, true)
    +    equivalence.addExprTree(mul)
    +    equivalence.addExprTree(mul2)
    +    equivalence.addExprTree(sqrt)
    +    equivalence.addExprTree(sum)
     
         // (one * two), (one * two) * (one * two) and sqrt( (one * two) * (one 
* two) ) should be found
         assert(equivalence.getAllEquivalentExprs.count(_.size > 1) == 3)
         assert(equivalence.getEquivalentExprs(mul).size == 3)
         assert(equivalence.getEquivalentExprs(mul2).size == 3)
         assert(equivalence.getEquivalentExprs(sqrt).size == 2)
         assert(equivalence.getEquivalentExprs(sum).size == 1)
    -
    -    // Some expressions inspired by TPCH-Q1
    -    // sum(l_quantity) as sum_qty,
    -    // sum(l_extendedprice) as sum_base_price,
    -    // sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
    -    // sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
    -    // avg(l_extendedprice) as avg_price,
    -    // avg(l_discount) as avg_disc
    -    equivalence = new EquivalentExpressions
    -    val quantity = Literal(1)
    -    val price = Literal(1.1)
    -    val discount = Literal(.24)
    -    val tax = Literal(0.1)
    -    equivalence.addExprTree(quantity, false)
    -    equivalence.addExprTree(price, false)
    -    equivalence.addExprTree(Multiply(price, Subtract(Literal(1), 
discount)), false)
    -    equivalence.addExprTree(
    -      Multiply(
    -        Multiply(price, Subtract(Literal(1), discount)),
    -        Add(Literal(1), tax)), false)
    -    equivalence.addExprTree(price, false)
    -    equivalence.addExprTree(discount, false)
    -    // quantity, price, discount and (price * (1 - discount))
    -    assert(equivalence.getAllEquivalentExprs.count(_.size > 1) == 4)
    --- End diff --
    
    To other reviewers: the new `addExprTree` always ignores the leaf nodes. 
Thus, these test cases are not needed. 


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