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

    https://github.com/apache/spark/pull/21403#discussion_r198911203
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
 ---
    @@ -161,33 +161,38 @@ case class Not(child: Expression)
            true
       """)
     // scalastyle:on line.size.limit
    -case class In(value: Expression, list: Seq[Expression]) extends Predicate {
    +case class In(values: Seq[Expression], list: Seq[Expression]) extends 
Predicate {
    --- End diff --
    
    I am not sure which Postgres version you're using but that seems a bug. I 
am using version 10 and it works as expected, ie.:
    
    ```
    mgaido=# select 1 from (select (1, 'a') as col1) tab1 where col1 = (1, 'a');
    ERROR:  could not identify an equality operator for type unknown
    mgaido=# select 1 from (select 1 as col1, 'a' as col2) tab1 where (col1, 
col2) = (1, 'a');
     ?column? 
    ----------
            1
    (1 row)
    ```
    
    Anyway, in Presto, both work:
    
    ```
    presto> select 1 from (select (1, 'a') as col1) tab1 where col1 in ((1, 
'a'));
     _col0 
    -------
         1 
    (1 row)
    
    Query 20180628_163550_00000_gkbmf, FINISHED, 1 node
    Splits: 17 total, 17 done (100.00%)
    0:01 [0 rows, 0B] [0 rows/s, 0B/s]
    
    presto> select 1 from (select (1, 'a') as col1) tab1 where (1, 'a') in ((1, 
'a'));
     _col0 
    -------
         1 
    (1 row)
    Query 20180628_163600_00001_gkbmf, FINISHED, 1 node
    Splits: 17 total, 17 done (100.00%)
    0:00 [0 rows, 0B] [0 rows/s, 0B/s]
    
    presto> select 1 from (select (1, 'a') as col1) tab1 where col1 in (select 
(1, 'a'));
     _col0 
    -------
         1 
    (1 row)
    
    Query 20180628_163607_00002_gkbmf, FINISHED, 1 node
    Splits: 83 total, 83 done (100.00%)
    0:01 [0 rows, 0B] [0 rows/s, 0B/s]
    
    presto> select 1 from (select (1, 'a') as col1) tab1 where (1, 'a') in 
(select (1, 'a'));
     _col0 
    -------
         1 
    (1 row)
    ```



---

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

Reply via email to