Github user windpiger commented on the issue:

    https://github.com/apache/spark/pull/15668
  
    @cloud-fan yes,It is simpler,I check the query plan, my test case 
    `sql("SELECTpercentile_approx(key, 0.99999)" +
           ", count(distinct key),sum(distinct key) FROM src LIMIT 1")`
    explain is ok as follows:
    `+- *Expand [List(null, null, 0, cast(key#29 as double)), List(key#29, 
null, 1, null), List(null, cast(key#29 as bigint), 2, null)], [src.`key`#38, 
CAST(src.`key` AS BIGINT)#39L, gid#37, CAST(src.`key` AS DOUBLE)#40]
                               +- HiveTableScan [key#29], MetastoreRelation 
default, src`
    
    But, I miss one case that the distinct on a constant like:
    `sql("SELECTpercentile_approx(key, 0.99999)" +
           ", count(distinct key),sum(distinct key),count(distinct 1) FROM src 
LIMIT 1")`
    explain with a literal expand as follows:
    `+- *Expand [List(null, null, null, 0, cast(key#69 as double)), List(1, 
null, null, 1, null), List(null, key#69, null, 2, null), List(null, null, 
cast(key#69 as bigint), 3, null)], [src.`key`#80, CAST(src.`key` AS 
BIGINT)#81L, gid#79, CAST(src.`key` AS DOUBLE)#82]
                               +- HiveTableScan [key#69], MetastoreRelation 
default, src`


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to