You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/08/06 21:43:00 UTC

[GitHub] [spark] huaxingao opened a new pull request #25371: [SPARK-28393][SQL][PYTHON][TESTS] Convert and port 'pgSQL/join.sql' into UDF test base

huaxingao opened a new pull request #25371: [SPARK-28393][SQL][PYTHON][TESTS] Convert and port 'pgSQL/join.sql' into UDF test base
URL: https://github.com/apache/spark/pull/25371
 
 
   
   
   ## What changes were proposed in this pull request?
   
   This PR adds some tests converted from ```pgSQL/join.sql``` to test UDFs. Please see contribution guide of this umbrella ticket - [SPARK-27921](https://issues.apache.org/jira/browse/SPARK-27921).
   <details><summary>Diff comparing to 'join.sql'</summary>
   <p>
   
   ```diff
   diff --git a/sql/core/src/test/resources/sql-tests/results/pgSQL/join.sql.out b/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-join.sql.out
   index 0730066719..4e8ab9d71a 100644
   --- a/sql/core/src/test/resources/sql-tests/results/pgSQL/join.sql.out
   +++ b/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-join.sql.out
   @@ -240,10 +240,10 @@ struct<>
    
    
    -- !query 27
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t)
      FROM J1_TBL AS tx
    -- !query 27 schema
   -struct<xxx:string,i:int,j:int,t:string>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string>
    -- !query 27 output
           0       NULL    zero
           1       4       one
   @@ -259,10 +259,10 @@ struct<xxx:string,i:int,j:int,t:string>
    
    
    -- !query 28
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t)
      FROM J1_TBL tx
    -- !query 28 schema
   -struct<xxx:string,i:int,j:int,t:string>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string>
    -- !query 28 output
           0       NULL    zero
           1       4       one
   @@ -278,10 +278,10 @@ struct<xxx:string,i:int,j:int,t:string>
    
    
    -- !query 29
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(a), udf(b), udf(c)
      FROM J1_TBL AS t1 (a, b, c)
    -- !query 29 schema
   -struct<xxx:string,a:int,b:int,c:string>
   +struct<xxx:string,CAST(udf(cast(a as string)) AS INT):int,CAST(udf(cast(b as string)) AS INT):int,CAST(udf(cast(c as string)) AS STRING):string>
    -- !query 29 output
           0       NULL    zero
           1       4       one
   @@ -297,10 +297,10 @@ struct<xxx:string,a:int,b:int,c:string>
    
    
    -- !query 30
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(a), udf(b), udf(c)
      FROM J1_TBL t1 (a, b, c)
    -- !query 30 schema
   -struct<xxx:string,a:int,b:int,c:string>
   +struct<xxx:string,CAST(udf(cast(a as string)) AS INT):int,CAST(udf(cast(b as string)) AS INT):int,CAST(udf(cast(c as string)) AS STRING):string>
    -- !query 30 output
           0       NULL    zero
           1       4       one
   @@ -316,10 +316,10 @@ struct<xxx:string,a:int,b:int,c:string>
    
    
    -- !query 31
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(a), udf(b), udf(c), udf(d), udf(e)
      FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e)
    -- !query 31 schema
   -struct<xxx:string,a:int,b:int,c:string,d:int,e:int>
   +struct<xxx:string,CAST(udf(cast(a as string)) AS INT):int,CAST(udf(cast(b as string)) AS INT):int,CAST(udf(cast(c as string)) AS STRING):string,CAST(udf(cast(d as string)) AS INT):int,CAST(udf(cast(e as string)) AS INT):int>
    -- !query 31 output
           0       NULL    zero    0       NULL
           0       NULL    zero    1       -1
   @@ -423,7 +423,7 @@ struct<xxx:string,a:int,b:int,c:string,d:int,e:int>
    
    
    -- !query 32
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, *
      FROM J1_TBL CROSS JOIN J2_TBL
    -- !query 32 schema
    struct<xxx:string,i:int,j:int,t:string,i:int,k:int>
   @@ -530,20 +530,20 @@ struct<xxx:string,i:int,j:int,t:string,i:int,k:int>
    
    
    -- !query 33
   -SELECT '' AS `xxx`, i, k, t
   +SELECT udf('') AS `xxx`, udf(i), udf(k), udf(t)
      FROM J1_TBL CROSS JOIN J2_TBL
    -- !query 33 schema
    struct<>
    -- !query 33 output
    org.apache.spark.sql.AnalysisException
   -Reference 'i' is ambiguous, could be: default.j1_tbl.i, default.j2_tbl.i.; line 1 pos 20
   +Reference 'i' is ambiguous, could be: default.j1_tbl.i, default.j2_tbl.i.; line 1 pos 29
    
    
    -- !query 34
   -SELECT '' AS `xxx`, t1.i, k, t
   +SELECT udf('') AS `xxx`, udf(t1.i), udf(k), udf(t)
      FROM J1_TBL t1 CROSS JOIN J2_TBL t2
    -- !query 34 schema
   -struct<xxx:string,i:int,k:int,t:string>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(k as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string>
    -- !query 34 output
           0       -1      zero
           0       -3      zero
   @@ -647,11 +647,11 @@ struct<xxx:string,i:int,k:int,t:string>
    
    
    -- !query 35
   -SELECT '' AS `xxx`, ii, tt, kk
   +SELECT udf('') AS `xxx`, udf(ii), udf(tt), udf(kk)
      FROM (J1_TBL CROSS JOIN J2_TBL)
        AS tx (ii, jj, tt, ii2, kk)
    -- !query 35 schema
   -struct<xxx:string,ii:int,tt:string,kk:int>
   +struct<xxx:string,CAST(udf(cast(ii as string)) AS INT):int,CAST(udf(cast(tt as string)) AS STRING):string,CAST(udf(cast(kk as string)) AS INT):int>
    -- !query 35 output
           0       zero    -1
           0       zero    -3
   @@ -755,10 +755,10 @@ struct<xxx:string,ii:int,tt:string,kk:int>
    
    
    -- !query 36
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(j1_tbl.i), udf(j), udf(t), udf(a.i), udf(a.k), udf(b.i),  udf(b.k)
      FROM J1_TBL CROSS JOIN J2_TBL a CROSS JOIN J2_TBL b
    -- !query 36 schema
   -struct<xxx:string,i:int,j:int,t:string,i:int,k:int,i:int,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(k as string)) AS INT):int,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 36 output
           0       NULL    zero    0       NULL    0       NULL
           0       NULL    zero    0       NULL    1       -1
   @@ -1654,10 +1654,10 @@ struct<xxx:string,i:int,j:int,t:string,i:int,k:int,i:int,k:int>
    
    
    -- !query 37
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL INNER JOIN J2_TBL USING (i)
    -- !query 37 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 37 output
           0       NULL    zero    NULL
           1       4       one     -1
   @@ -1669,10 +1669,10 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 38
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL JOIN J2_TBL USING (i)
    -- !query 38 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 38 output
           0       NULL    zero    NULL
           1       4       one     -1
   @@ -1684,9 +1684,9 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 39
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, *
      FROM J1_TBL t1 (a, b, c) JOIN J2_TBL t2 (a, d) USING (a)
   -  ORDER BY a, d
   +  ORDER BY udf(a), udf(d)
    -- !query 39 schema
    struct<xxx:string,a:int,b:int,c:string,d:int>
    -- !query 39 output
   @@ -1700,10 +1700,10 @@ struct<xxx:string,a:int,b:int,c:string,d:int>
    
    
    -- !query 40
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL NATURAL JOIN J2_TBL
    -- !query 40 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 40 output
           0       NULL    zero    NULL
           1       4       one     -1
   @@ -1715,10 +1715,10 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 41
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(a), udf(b), udf(c), udf(d)
      FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (a, d)
    -- !query 41 schema
   -struct<xxx:string,a:int,b:int,c:string,d:int>
   +struct<xxx:string,CAST(udf(cast(a as string)) AS INT):int,CAST(udf(cast(b as string)) AS INT):int,CAST(udf(cast(c as string)) AS STRING):string,CAST(udf(cast(d as string)) AS INT):int>
    -- !query 41 output
           0       NULL    zero    NULL
           1       4       one     -1
   @@ -1730,10 +1730,10 @@ struct<xxx:string,a:int,b:int,c:string,d:int>
    
    
    -- !query 42
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(a), udf(b), udf(c), udf(d)
      FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (d, a)
    -- !query 42 schema
   -struct<xxx:string,a:int,b:int,c:string,d:int>
   +struct<xxx:string,CAST(udf(cast(a as string)) AS INT):int,CAST(udf(cast(b as string)) AS INT):int,CAST(udf(cast(c as string)) AS STRING):string,CAST(udf(cast(d as string)) AS INT):int>
    -- !query 42 output
           0       NULL    zero    NULL
           2       3       two     2
   @@ -1741,10 +1741,10 @@ struct<xxx:string,a:int,b:int,c:string,d:int>
    
    
    -- !query 43
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(J1_TBL.i), udf(J1_TBL.j), udf(J1_TBL.t), udf(J2_TBL.i), udf(J2_TBL.k)
      FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.i)
    -- !query 43 schema
   -struct<xxx:string,i:int,j:int,t:string,i:int,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 43 output
           0       NULL    zero    0       NULL
           1       4       one     1       -1
   @@ -1756,10 +1756,10 @@ struct<xxx:string,i:int,j:int,t:string,i:int,k:int>
    
    
    -- !query 44
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(J1_TBL.i), udf(J1_TBL.j), udf(J1_TBL.t), J2_TBL.i, J2_TBL.k
      FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.k)
    -- !query 44 schema
   -struct<xxx:string,i:int,j:int,t:string,i:int,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,i:int,k:int>
    -- !query 44 output
           0       NULL    zero    NULL    0
           2       3       two     2       2
   @@ -1767,10 +1767,10 @@ struct<xxx:string,i:int,j:int,t:string,i:int,k:int>
    
    
    -- !query 45
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(J1_TBL.i), udf(J1_TBL.j), udf(J1_TBL.t), udf(J2_TBL.i), udf(J2_TBL.k)
      FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i <= J2_TBL.k)
    -- !query 45 schema
   -struct<xxx:string,i:int,j:int,t:string,i:int,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 45 output
           0       NULL    zero    2       2
           0       NULL    zero    2       4
   @@ -1784,11 +1784,11 @@ struct<xxx:string,i:int,j:int,t:string,i:int,k:int>
    
    
    -- !query 46
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL LEFT OUTER JOIN J2_TBL USING (i)
   -  ORDER BY i, k, t
   +  ORDER BY udf(i), udf(k), udf(t)
    -- !query 46 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 46 output
           NULL    NULL    null    NULL
           NULL    0       zero    NULL
   @@ -1806,11 +1806,11 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 47
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL LEFT JOIN J2_TBL USING (i)
   -  ORDER BY i, k, t
   +  ORDER BY udf(i), udf(k), udf(t)
    -- !query 47 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 47 output
           NULL    NULL    null    NULL
           NULL    0       zero    NULL
   @@ -1828,10 +1828,10 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 48
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL RIGHT OUTER JOIN J2_TBL USING (i)
    -- !query 48 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 48 output
           0       NULL    zero    NULL
           1       4       one     -1
   @@ -1845,10 +1845,10 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 49
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL RIGHT JOIN J2_TBL USING (i)
    -- !query 49 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 49 output
           0       NULL    zero    NULL
           1       4       one     -1
   @@ -1862,11 +1862,11 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 50
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL FULL OUTER JOIN J2_TBL USING (i)
   -  ORDER BY i, k, t
   +  ORDER BY udf(i), udf(k), udf(t)
    -- !query 50 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 50 output
           NULL    NULL    NULL    NULL
           NULL    NULL    null    NULL
   @@ -1886,11 +1886,11 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 51
   -SELECT '' AS `xxx`, *
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
      FROM J1_TBL FULL JOIN J2_TBL USING (i)
   -  ORDER BY i, k, t
   +  ORDER BY udf(i), udf(k), udf(t)
    -- !query 51 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 51 output
           NULL    NULL    NULL    NULL
           NULL    NULL    null    NULL
   @@ -1910,19 +1910,19 @@ struct<xxx:string,i:int,j:int,t:string,k:int>
    
    
    -- !query 52
   -SELECT '' AS `xxx`, *
   -  FROM J1_TBL LEFT JOIN J2_TBL USING (i) WHERE (k = 1)
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
   +  FROM J1_TBL LEFT JOIN J2_TBL USING (i) WHERE (udf(k) = 1)
    -- !query 52 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 52 output
    
    
    
    -- !query 53
   -SELECT '' AS `xxx`, *
   -  FROM J1_TBL LEFT JOIN J2_TBL USING (i) WHERE (i = 1)
   +SELECT udf('') AS `xxx`, udf(i), udf(j), udf(t), udf(k)
   +  FROM J1_TBL LEFT JOIN J2_TBL USING (i) WHERE (udf(i) = 1)
    -- !query 53 schema
   -struct<xxx:string,i:int,j:int,t:string,k:int>
   +struct<xxx:string,CAST(udf(cast(i as string)) AS INT):int,CAST(udf(cast(j as string)) AS INT):int,CAST(udf(cast(t as string)) AS STRING):string,CAST(udf(cast(k as string)) AS INT):int>
    -- !query 53 output
           1       4       one     -1
    
   @@ -2020,9 +2020,9 @@ ee        NULL    42      NULL
    
    -- !query 65
    SELECT * FROM
   -(SELECT * FROM t2) as s2
   +(SELECT udf(name) as name, t2.n FROM t2) as s2
    INNER JOIN
   -(SELECT * FROM t3) s3
   +(SELECT udf(name) as name, t3.n FROM t3) s3
    USING (name)
    -- !query 65 schema
    struct<name:string,n:int,n:int>
   @@ -2033,9 +2033,9 @@ cc        22      23
    
    -- !query 66
    SELECT * FROM
   -(SELECT * FROM t2) as s2
   +(SELECT udf(name) as name, t2.n FROM t2) as s2
    LEFT JOIN
   -(SELECT * FROM t3) s3
   +(SELECT udf(name) as name, t3.n FROM t3) s3
    USING (name)
    -- !query 66 schema
    struct<name:string,n:int,n:int>
   @@ -2046,13 +2046,13 @@ ee      42      NULL
    
    
    -- !query 67
   -SELECT * FROM
   +SELECT udf(name), udf(s2.n), udf(s3.n) FROM
    (SELECT * FROM t2) as s2
    FULL JOIN
    (SELECT * FROM t3) s3
    USING (name)
    -- !query 67 schema
   -struct<name:string,n:int,n:int>
   +struct<CAST(udf(cast(name as string)) AS STRING):string,CAST(udf(cast(n as string)) AS INT):int,CAST(udf(cast(n as string)) AS INT):int>
    -- !query 67 output
    bb     12      13
    cc     22      23
   @@ -2062,11 +2062,11 @@ ee      42      NULL
    
    -- !query 68
    SELECT * FROM
   -(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2
   +(SELECT udf(name), udf(n) as s2_n, udf(2) as s2_2 FROM t2) as s2
    NATURAL INNER JOIN
   -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3
   +(SELECT udf(name), udf(n) as s3_n, udf(3) as s3_2 FROM t3) s3
    -- !query 68 schema
   -struct<name:string,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
   +struct<CAST(udf(cast(name as string)) AS STRING):string,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
    -- !query 68 output
    bb     12      2       13      3
    cc     22      2       23      3
   @@ -2074,11 +2074,11 @@ cc      22      2       23      3
    
    -- !query 69
    SELECT * FROM
   -(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2
   +(SELECT udf(name), udf(n) as s2_n, 2 as s2_2 FROM t2) as s2
    NATURAL LEFT JOIN
   -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3
   +(SELECT udf(name), udf(n) as s3_n, 3 as s3_2 FROM t3) s3
    -- !query 69 schema
   -struct<name:string,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
   +struct<CAST(udf(cast(name as string)) AS STRING):string,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
    -- !query 69 output
    bb     12      2       13      3
    cc     22      2       23      3
   @@ -2087,11 +2087,11 @@ ee      42      2       NULL    NULL
    
    -- !query 70
    SELECT * FROM
   -(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2
   +(SELECT udf(name), udf(n) as s2_n, 2 as s2_2 FROM t2) as s2
    NATURAL FULL JOIN
   -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3
   +(SELECT udf(name), udf(n) as s3_n, 3 as s3_2 FROM t3) s3
    -- !query 70 schema
   -struct<name:string,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
   +struct<CAST(udf(cast(name as string)) AS STRING):string,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
    -- !query 70 output
    bb     12      2       13      3
    cc     22      2       23      3
   @@ -2101,26 +2101,26 @@ ee      42      2       NULL    NULL
    
    -- !query 71
    SELECT * FROM
   -(SELECT name, n as s1_n, 1 as s1_1 FROM t1) as s1
   +(SELECT udf(name), udf(n) as s1_n, 1 as s1_1 FROM t1) as s1
    NATURAL INNER JOIN
   -(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2
   +(SELECT udf(name), udf(n) as s2_n, 2 as s2_2 FROM t2) as s2
    NATURAL INNER JOIN
   -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3
   +(SELECT udf(name), udf(n) as s3_n, 3 as s3_2 FROM t3) s3
    -- !query 71 schema
   -struct<name:string,s1_n:int,s1_1:int,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
   +struct<CAST(udf(cast(name as string)) AS STRING):string,s1_n:int,s1_1:int,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
    -- !query 71 output
    bb     11      1       12      2       13      3
    
    
    -- !query 72
    SELECT * FROM
   -(SELECT name, n as s1_n, 1 as s1_1 FROM t1) as s1
   +(SELECT udf(name), udf(n) as s1_n, udf(1) as s1_1 FROM t1) as s1
    NATURAL FULL JOIN
   -(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2
   +(SELECT udf(name), udf(n) as s2_n, udf(2) as s2_2 FROM t2) as s2
    NATURAL FULL JOIN
   -(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3
   +(SELECT udf(name), udf(n) as s3_n, udf(3) as s3_2 FROM t3) s3
    -- !query 72 schema
   -struct<name:string,s1_n:int,s1_1:int,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
   +struct<CAST(udf(cast(name as string)) AS STRING):string,s1_n:int,s1_1:int,s2_n:int,s2_2:int,s3_n:int,s3_2:int>
    -- !query 72 output
    bb     11      1       12      2       13      3
    cc     NULL    NULL    22      2       23      3
   @@ -2129,16 +2129,16 @@ ee      NULL    NULL    42      2       NULL    NULL
    
    
    -- !query 73
   -SELECT * FROM
   -(SELECT name, n as s1_n FROM t1) as s1
   +SELECT name, udf(s1_n), udf(s2_n), udf(s3_n) FROM
   +(SELECT name, udf(n) as s1_n FROM t1) as s1
    NATURAL FULL JOIN
      (SELECT * FROM
   -    (SELECT name, n as s2_n FROM t2) as s2
   +    (SELECT name, udf(n) as s2_n FROM t2) as s2
        NATURAL FULL JOIN
   -    (SELECT name, n as s3_n FROM t3) as s3
   +    (SELECT name, udf(n) as s3_n FROM t3) as s3
      ) ss2
    -- !query 73 schema
   -struct<name:string,s1_n:int,s2_n:int,s3_n:int>
   +struct<name:string,CAST(udf(cast(s1_n as string)) AS INT):int,CAST(udf(cast(s2_n as string)) AS INT):int,CAST(udf(cast(s3_n as string)) AS INT):int>
    -- !query 73 output
    bb     11      12      13
    cc     NULL    22      23
   @@ -2151,9 +2151,9 @@ SELECT * FROM
    (SELECT name, n as s1_n FROM t1) as s1
    NATURAL FULL JOIN
      (SELECT * FROM
   -    (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2
   +    (SELECT name, udf(n) as s2_n, 2 as s2_2 FROM t2) as s2
        NATURAL FULL JOIN
   -    (SELECT name, n as s3_n FROM t3) as s3
   +    (SELECT name, udf(n) as s3_n FROM t3) as s3
      ) ss2
    -- !query 74 schema
    struct<name:string,s1_n:int,s2_n:int,s2_2:int,s3_n:int>
   @@ -2165,13 +2165,13 @@ ee      NULL    42      2       NULL
    
    
    -- !query 75
   -SELECT * FROM
   -  (SELECT name, n as s1_n FROM t1) as s1
   +SELECT s1.name, udf(s1_n), s2.name, udf(s2_n) FROM
   +  (SELECT name, udf(n) as s1_n FROM t1) as s1
    FULL JOIN
   -  (SELECT name, 2 as s2_n FROM t2) as s2
   -ON (s1_n = s2_n)
   +  (SELECT name, udf(2) as s2_n FROM t2) as s2
   +ON (udf(s1_n) = udf(s2_n))
    -- !query 75 schema
   -struct<name:string,s1_n:int,name:string,s2_n:int>
   +struct<name:string,CAST(udf(cast(s1_n as string)) AS INT):int,name:string,CAST(udf(cast(s2_n as string)) AS INT):int>
    -- !query 75 output
    NULL   NULL    bb      2
    NULL   NULL    cc      2
   @@ -2200,9 +2200,9 @@ struct<>
    
    
    -- !query 78
   -select * from x
   +select udf(x1), udf(x2) from x
    -- !query 78 schema
   -struct<x1:int,x2:int>
   +struct<CAST(udf(cast(x1 as string)) AS INT):int,CAST(udf(cast(x2 as string)) AS INT):int>
    -- !query 78 output
    1      11
    2      22
   @@ -2212,9 +2212,9 @@ struct<x1:int,x2:int>
    
    
    -- !query 79
   -select * from y
   +select udf(y1), udf(y2) from y
    -- !query 79 schema
   -struct<y1:int,y2:int>
   +struct<CAST(udf(cast(y1 as string)) AS INT):int,CAST(udf(cast(y2 as string)) AS INT):int>
    -- !query 79 output
    1      111
    2      222
   @@ -2223,7 +2223,7 @@ struct<y1:int,y2:int>
    
    
    -- !query 80
   -select * from x left join y on (x1 = y1 and x2 is not null)
   +select * from x left join y on (udf(x1) = udf(y1) and udf(x2) is not null)
    -- !query 80 schema
    struct<x1:int,x2:int,y1:int,y2:int>
    -- !query 80 output
   @@ -2235,7 +2235,7 @@ struct<x1:int,x2:int,y1:int,y2:int>
    
    
    -- !query 81
   -select * from x left join y on (x1 = y1 and y2 is not null)
   +select * from x left join y on (udf(x1) = udf(y1) and udf(y2) is not null)
    -- !query 81 schema
    struct<x1:int,x2:int,y1:int,y2:int>
    -- !query 81 output
   @@ -2247,8 +2247,8 @@ struct<x1:int,x2:int,y1:int,y2:int>
    
    
    -- !query 82
   -select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2)
   -on (x1 = xx1)
   +select * from (x left join y on (udf(x1) = udf(y1))) left join x xx(xx1,xx2)
   +on (udf(x1) = udf(xx1))
    -- !query 82 schema
    struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    -- !query 82 output
   @@ -2260,8 +2260,8 @@ struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    
    
    -- !query 83
   -select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2)
   -on (x1 = xx1 and x2 is not null)
   +select * from (x left join y on (udf(x1) = udf(y1))) left join x xx(xx1,xx2)
   +on (udf(x1) = udf(xx1) and udf(x2) is not null)
    -- !query 83 schema
    struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    -- !query 83 output
   @@ -2273,8 +2273,8 @@ struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    
    
    -- !query 84
   -select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2)
   -on (x1 = xx1 and y2 is not null)
   +select * from (x left join y on (udf(x1) = udf(y1))) left join x xx(xx1,xx2)
   +on (udf(x1) = udf(xx1) and udf(y2) is not null)
    -- !query 84 schema
    struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    -- !query 84 output
   @@ -2286,8 +2286,8 @@ struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    
    
    -- !query 85
   -select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2)
   -on (x1 = xx1 and xx2 is not null)
   +select * from (x left join y on (udf(x1) = udf(y1))) left join x xx(xx1,xx2)
   +on (udf(x1) = udf(xx1) and udf(xx2) is not null)
    -- !query 85 schema
    struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    -- !query 85 output
   @@ -2299,8 +2299,8 @@ struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    
    
    -- !query 86
   -select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2)
   -on (x1 = xx1) where (x2 is not null)
   +select * from (x left join y on (udf(x1) = udf(y1))) left join x xx(xx1,xx2)
   +on (udf(x1) = udf(xx1)) where (udf(x2) is not null)
    -- !query 86 schema
    struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    -- !query 86 output
   @@ -2310,8 +2310,8 @@ struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    
    
    -- !query 87
   -select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2)
   -on (x1 = xx1) where (y2 is not null)
   +select * from (x left join y on (udf(x1) = udf(y1))) left join x xx(xx1,xx2)
   +on (udf(x1) = udf(xx1)) where (udf(y2) is not null)
    -- !query 87 schema
    struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    -- !query 87 output
   @@ -2321,8 +2321,8 @@ struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    
    
    -- !query 88
   -select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2)
   -on (x1 = xx1) where (xx2 is not null)
   +select * from (x left join y on (udf(x1) = udf(y1))) left join x xx(xx1,xx2)
   +on (udf(x1) = udf(xx1)) where (udf(xx2) is not null)
    -- !query 88 schema
    struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    -- !query 88 output
   @@ -2332,75 +2332,75 @@ struct<x1:int,x2:int,y1:int,y2:int,xx1:int,xx2:int>
    
    
    -- !query 89
   -select count(*) from tenk1 a where unique1 in
   -  (select unique1 from tenk1 b join tenk1 c using (unique1)
   -   where b.unique2 = 42)
   +select udf(count(*)) from tenk1 a where udf(unique1) in
   +  (select udf(unique1) from tenk1 b join tenk1 c using (unique1)
   +   where udf(b.unique2) = udf(42))
    -- !query 89 schema
   -struct<count(1):bigint>
   +struct<CAST(udf(cast(count(1) as string)) AS BIGINT):bigint>
    -- !query 89 output
    1
    
    
    -- !query 90
   -select count(*) from tenk1 x where
   -  x.unique1 in (select a.f1 from int4_tbl a,float8_tbl b where a.f1=b.f1) and
   -  x.unique1 = 0 and
   -  x.unique1 in (select aa.f1 from int4_tbl aa,float8_tbl bb where aa.f1=bb.f1)
   +select udf(count(*)) from tenk1 x where
   +  udf(x.unique1) in (select udf(a.f1) from int4_tbl a,float8_tbl b where udf(a.f1)=udf(b.f1)) and
   +  udf(x.unique1) = 0 and
   +  udf(x.unique1) in (select aa.f1 from int4_tbl aa,float8_tbl bb where udf(aa.f1)=udf(bb.f1))
    -- !query 90 schema
   -struct<count(1):bigint>
   +struct<CAST(udf(cast(count(1) as string)) AS BIGINT):bigint>
    -- !query 90 output
    1
    
    
    -- !query 91
   -select count(*) from tenk1 x where
   -  x.unique1 in (select a.f1 from int4_tbl a,float8_tbl b where a.f1=b.f1) and
   -  x.unique1 = 0 and
   -  x.unique1 in (select aa.f1 from int4_tbl aa,float8_tbl bb where aa.f1=bb.f1)
   +select udf(count(*)) from tenk1 x where
   +  udf(x.unique1) in (select udf(a.f1) from int4_tbl a,float8_tbl b where udf(a.f1)=udf(b.f1)) and
   +  udf(x.unique1) = 0 and
   +  udf(x.unique1) in (select udf(aa.f1) from int4_tbl aa,float8_tbl bb where udf(aa.f1)=udf(bb.f1))
    -- !query 91 schema
   -struct<count(1):bigint>
   +struct<CAST(udf(cast(count(1) as string)) AS BIGINT):bigint>
    -- !query 91 output
    1
    
    
    -- !query 92
    select * from int8_tbl i1 left join (int8_tbl i2 join
   -  (select 123 as x) ss on i2.q1 = x) on i1.q2 = i2.q2
   -order by 1, 2
   +  (select udf(123) as x) ss on udf(i2.q1) = udf(x)) on udf(i1.q2) = udf(i2.q2)
   +order by udf(1), 2
    -- !query 92 schema
    struct<q1:bigint,q2:bigint,q1:bigint,q2:bigint,x:int>
    -- !query 92 output
   -123    456     123     456     123
   -123    4567890123456789        123     4567890123456789        123
    4567890123456789       -4567890123456789       NULL    NULL    NULL
    4567890123456789       123     NULL    NULL    NULL
   +123    456     123     456     123
   +123    4567890123456789        123     4567890123456789        123
    4567890123456789       4567890123456789        123     4567890123456789        123
    -- !query 92 schema
    struct<q1:bigint,q2:bigint,q1:bigint,q2:bigint,x:int>
    -- !query 92 output
   -123    456     123     456     123
   -123    4567890123456789        123     4567890123456789        123
    4567890123456789       -4567890123456789       NULL    NULL    NULL
    4567890123456789       123     NULL    NULL    NULL
   +123    456     123     456     123
   +123    4567890123456789        123     4567890123456789        123
    4567890123456789       4567890123456789        123     4567890123456789        123
    
    
    -- !query 93
   -select count(*)
   +select udf(count(*))
    from
   -  (select t3.tenthous as x1, coalesce(t1.stringu1, t2.stringu1) as x2
   +  (select udf(t3.tenthous) as x1, udf(coalesce(udf(t1.stringu1), udf(t2.stringu1))) as x2
       from tenk1 t1
   -   left join tenk1 t2 on t1.unique1 = t2.unique1
   +   left join tenk1 t2 on udf(t1.unique1) = udf(t2.unique1)
       join tenk1 t3 on t1.unique2 = t3.unique2) ss,
      tenk1 t4,
      tenk1 t5
   -where t4.thousand = t5.unique1 and ss.x1 = t4.tenthous and ss.x2 = t5.stringu1
   +where udf(t4.thousand) = udf(t5.unique1) and udf(ss.x1) = udf(t4.tenthous) and udf(ss.x2) = udf(t5.stringu1)
    -- !query 93 schema
   -struct<count(1):bigint>
   +struct<CAST(udf(cast(count(1) as string)) AS BIGINT):bigint>
    -- !query 93 output
    1000
    
    
    -- !query 94
   -select a.f1, b.f1, t.thousand, t.tenthous from
   +select udf(a.f1), udf(b.f1), udf(t.thousand), udf(t.tenthous) from
      tenk1 t,
   -  (select sum(f1)+1 as f1 from int4_tbl i4a) a,
   -  (select sum(f1) as f1 from int4_tbl i4b) b
   -where b.f1 = t.thousand and a.f1 = b.f1 and (a.f1+b.f1+999) = t.tenthous
   +  (select udf(sum(udf(f1))+1) as f1 from int4_tbl i4a) a,
   +  (select udf(sum(udf(f1))) as f1 from int4_tbl i4b) b
   +where udf(b.f1) = udf(t.thousand) and udf(a.f1) = udf(b.f1) and udf((udf(a.f1)+udf(b.f1)+999)) = udf(t.tenthous)
    -- !query 94 schema
   -struct<f1:bigint,f1:bigint,thousand:int,tenthous:int>
   +struct<CAST(udf(cast(f1 as string)) AS BIGINT):bigint,CAST(udf(cast(f1 as string)) AS BIGINT):bigint,CAST(udf(cast(thousand as string)) AS INT):int,CAST(udf(cast(tenthous as string)) AS INT):int>
    -- !query 94 output
    
    
   @@ -2408,8 +2408,8 @@ struct<f1:bigint,f1:bigint,thousand:int,tenthous:int>
    -- !query 95
    select * from
      j1_tbl full join
   -  (select * from j2_tbl order by j2_tbl.i desc, j2_tbl.k asc) j2_tbl
   -  on j1_tbl.i = j2_tbl.i and j1_tbl.i = j2_tbl.k
   +  (select * from j2_tbl order by udf(j2_tbl.i) desc, udf(j2_tbl.k) asc) j2_tbl
   +  on udf(j1_tbl.i) = udf(j2_tbl.i) and udf(j1_tbl.i) = udf(j2_tbl.k)
    -- !query 95 schema
    struct<i:int,j:int,t:string,i:int,k:int>
    -- !query 95 output
   @@ -2435,13 +2435,13 @@ NULL    NULL    null    NULL    NULL
    
    
    -- !query 96
   -select count(*) from
   -  (select * from tenk1 x order by x.thousand, x.twothousand, x.fivethous) x
   +select udf(count(*)) from
   +  (select * from tenk1 x order by udf(x.thousand), udf(x.twothousand), x.fivethous) x
      left join
   -  (select * from tenk1 y order by y.unique2) y
   -  on x.thousand = y.unique2 and x.twothousand = y.hundred and x.fivethous = y.unique2
   +  (select * from tenk1 y order by udf(y.unique2)) y
   +  on udf(x.thousand) = y.unique2 and x.twothousand = udf(y.hundred) and x.fivethous = y.unique2
    -- !query 96 schema
   -struct<count(1):bigint>
   +struct<CAST(udf(cast(count(1) as string)) AS BIGINT):bigint>
    -- !query 96 output
    10000
    
   @@ -2507,7 +2507,7 @@ struct<>
    
    
    -- !query 104
   -select tt1.*, tt2.* from tt1 left join tt2 on tt1.joincol = tt2.joincol
   +select tt1.*, tt2.* from tt1 left join tt2 on udf(tt1.joincol) = udf(tt2.joincol)
    -- !query 104 schema
    struct<tt1_id:int,joincol:int,tt2_id:int,joincol:int>
    -- !query 104 output
   @@ -2517,7 +2517,7 @@ struct<tt1_id:int,joincol:int,tt2_id:int,joincol:int>
    
    
    -- !query 105
   -select tt1.*, tt2.* from tt2 right join tt1 on tt1.joincol = tt2.joincol
   +select tt1.*, tt2.* from tt2 right join tt1 on udf(tt1.joincol) = udf(tt2.joincol)
    -- !query 105 schema
    struct<tt1_id:int,joincol:int,tt2_id:int,joincol:int>
    -- !query 105 output
   @@ -2527,10 +2527,10 @@ struct<tt1_id:int,joincol:int,tt2_id:int,joincol:int>
    
    
    -- !query 106
   -select count(*) from tenk1 a, tenk1 b
   -  where a.hundred = b.thousand and (b.fivethous % 10) < 10
   +select udf(count(*)) from tenk1 a, tenk1 b
   +  where udf(a.hundred) = udf(b.thousand) and udf(udf((b.fivethous % 10)) < 10)
    -- !query 106 schema
   -struct<count(1):bigint>
   +struct<CAST(udf(cast(count(1) as string)) AS BIGINT):bigint>
    -- !query 106 output
    100000
    
   @@ -2584,14 +2584,14 @@ struct<>
    
    
    -- !query 113
   -SELECT a.f1
   +SELECT udf(a.f1) as f1
    FROM tt4 a
    LEFT JOIN (
            SELECT b.f1
   -        FROM tt3 b LEFT JOIN tt3 c ON (b.f1 = c.f1)
   -        WHERE c.f1 IS NULL
   -) AS d ON (a.f1 = d.f1)
   -WHERE d.f1 IS NULL
   +        FROM tt3 b LEFT JOIN tt3 c ON udf(b.f1) = udf(c.f1)
   +        WHERE udf(c.f1) IS NULL
   +) AS d ON udf(a.f1) = udf(d.f1)
   +WHERE udf(d.f1) IS NULL
    -- !query 113 schema
    struct<f1:int>
    -- !query 113 output
   @@ -2621,7 +2621,7 @@ struct<>
    
    
    -- !query 116
   -select * from tt5,tt6 where tt5.f1 = tt6.f1 and tt5.f1 = tt5.f2 - tt6.f2
   +select * from tt5,tt6 where udf(tt5.f1) = udf(tt6.f1) and udf(tt5.f1) = udf(tt5.f2 - tt6.f2)
    -- !query 116 schema
    struct<f1:int,f2:int,f1:int,f2:int>
    -- !query 116 output
   @@ -2649,12 +2649,12 @@ struct<>
    
    
    -- !query 119
   -select yy.pkyy as yy_pkyy, yy.pkxx as yy_pkxx, yya.pkyy as yya_pkyy,
   -       xxa.pkxx as xxa_pkxx, xxb.pkxx as xxb_pkxx
   +select udf(yy.pkyy) as yy_pkyy, udf(yy.pkxx) as yy_pkxx, udf(yya.pkyy) as yya_pkyy,
   +       udf(xxa.pkxx) as xxa_pkxx, udf(xxb.pkxx) as xxb_pkxx
    from yy
   -     left join (SELECT * FROM yy where pkyy = 101) as yya ON yy.pkyy = yya.pkyy
   -     left join xx xxa on yya.pkxx = xxa.pkxx
   -     left join xx xxb on coalesce (xxa.pkxx, 1) = xxb.pkxx
   +     left join (SELECT * FROM yy where pkyy = 101) as yya ON udf(yy.pkyy) = udf(yya.pkyy)
   +     left join xx xxa on udf(yya.pkxx) = udf(xxa.pkxx)
   +     left join xx xxb on udf(coalesce (xxa.pkxx, 1)) = udf(xxb.pkxx)
    -- !query 119 schema
    struct<yy_pkyy:int,yy_pkxx:int,yya_pkyy:int,xxa_pkxx:int,xxb_pkxx:int>
    -- !query 119 output
   @@ -2693,9 +2693,9 @@ struct<>
    
    -- !query 123
    select * from
   -  zt2 left join zt3 on (f2 = f3)
   -      left join zt1 on (f3 = f1)
   -where f2 = 53
   +  zt2 left join zt3 on (udf(f2) = udf(f3))
   +      left join zt1 on (udf(f3) = udf(f1))
   +where udf(f2) = 53
    -- !query 123 schema
    struct<f2:int,f3:int,f1:int>
    -- !query 123 output
   @@ -2712,9 +2712,9 @@ struct<>
    
    -- !query 125
    select * from
   -  zt2 left join zt3 on (f2 = f3)
   -      left join zv1 on (f3 = f1)
   -where f2 = 53
   +  zt2 left join zt3 on (udf(f2) = udf(f3))
   +      left join zv1 on (udf(f3) = udf(f1))
   +where udf(f2) = udf(53)
    -- !query 125 schema
    struct<f2:int,f3:int,f1:int,junk:string>
    -- !query 125 output
   @@ -2722,12 +2722,12 @@ struct<f2:int,f3:int,f1:int,junk:string>
    
    
    -- !query 126
   -select a.unique2, a.ten, b.tenthous, b.unique2, b.hundred
   -from tenk1 a left join tenk1 b on a.unique2 = b.tenthous
   -where a.unique1 = 42 and
   -      ((b.unique2 is null and a.ten = 2) or b.hundred = 3)
   +select udf(a.unique2), udf(a.ten), udf(b.tenthous), udf(b.unique2), udf(b.hundred)
   +from tenk1 a left join tenk1 b on udf(a.unique2) = udf(b.tenthous)
   +where udf(a.unique1) = 42 and
   +      ((udf(b.unique2) is null and udf(a.ten) = 2) or udf(b.hundred) = udf(3))
    -- !query 126 schema
   -struct<unique2:int,ten:int,tenthous:int,unique2:int,hundred:int>
   +struct<CAST(udf(cast(unique2 as string)) AS INT):int,CAST(udf(cast(ten as string)) AS INT):int,CAST(udf(cast(tenthous as string)) AS INT):int,CAST(udf(cast(unique2 as string)) AS INT):int,CAST(udf(cast(hundred as string)) AS INT):int>
    -- !query 126 output
    
    
   @@ -2749,7 +2749,7 @@ struct<>
    
    
    -- !query 129
   -select * from a left join b on i = x and i = y and x = i
   +select * from a left join b on udf(i) = udf(x) and udf(i) = udf(y) and udf(x) = udf(i)
    -- !query 129 schema
    struct<i:int,x:int,y:int>
    -- !query 129 output
   @@ -2757,11 +2757,11 @@ struct<i:int,x:int,y:int>
    
    
    -- !query 130
   -select t1.q2, count(t2.*)
   -from int8_tbl t1 left join int8_tbl t2 on (t1.q2 = t2.q1)
   -group by t1.q2 order by 1
   +select udf(t1.q2), udf(count(t2.*))
   +from int8_tbl t1 left join int8_tbl t2 on (udf(t1.q2) = udf(t2.q1))
   +group by udf(t1.q2) order by 1
    -- !query 130 schema
   -struct<q2:bigint,count(q1, q2):bigint>
   +struct<CAST(udf(cast(q2 as string)) AS BIGINT):bigint,CAST(udf(cast(count(q1, q2) as string)) AS BIGINT):bigint>
    -- !query 130 output
    -4567890123456789      0
    123    2
   @@ -2770,11 +2770,11 @@ struct<q2:bigint,count(q1, q2):bigint>
    
    
    -- !query 131
   -select t1.q2, count(t2.*)
   -from int8_tbl t1 left join (select * from int8_tbl) t2 on (t1.q2 = t2.q1)
   -group by t1.q2 order by 1
   +select udf(t1.q2), udf(count(t2.*))
   +from int8_tbl t1 left join (select * from int8_tbl) t2 on (udf(t1.q2) = udf(t2.q1))
   +group by udf(t1.q2) order by 1
    -- !query 131 schema
   -struct<q2:bigint,count(q1, q2):bigint>
   +struct<CAST(udf(cast(q2 as string)) AS BIGINT):bigint,CAST(udf(cast(count(q1, q2) as string)) AS BIGINT):bigint>
    -- !query 131 output
    -4567890123456789      0
    123    2
   @@ -2783,13 +2783,13 @@ struct<q2:bigint,count(q1, q2):bigint>
    
    
    -- !query 132
   -select t1.q2, count(t2.*)
   +select udf(t1.q2) as q2, udf(count(t2.*))
    from int8_tbl t1 left join
   -  (select q1, case when q2=1 then 1 else q2 end as q2 from int8_tbl) t2
   -  on (t1.q2 = t2.q1)
   +  (select udf(q1) as q1, case when q2=1 then 1 else q2 end as q2 from int8_tbl) t2
   +  on (udf(t1.q2) = udf(t2.q1))
    group by t1.q2 order by 1
    -- !query 132 schema
   -struct<q2:bigint,count(q1, q2):bigint>
   +struct<q2:bigint,CAST(udf(cast(count(q1, q2) as string)) AS BIGINT):bigint>
    -- !query 132 output
    -4567890123456789      0
    123    2
   @@ -2828,17 +2828,17 @@ struct<>
    
    
    -- !query 136
   -select c.name, ss.code, ss.b_cnt, ss.const
   +select udf(c.name), udf(ss.code), udf(ss.b_cnt), udf(ss.const)
    from c left join
      (select a.code, coalesce(b_grp.cnt, 0) as b_cnt, -1 as const
       from a left join
   -     (select count(1) as cnt, b.a from b group by b.a) as b_grp
   -     on a.code = b_grp.a
   +     (select udf(count(1)) as cnt, b.a as a from b group by b.a) as b_grp
   +     on udf(a.code) = udf(b_grp.a)
      ) as ss
   -  on (c.a = ss.code)
   +  on (udf(c.a) = udf(ss.code))
    order by c.name
    -- !query 136 schema
   -struct<name:string,code:string,b_cnt:bigint,const:int>
   +struct<CAST(udf(cast(name as string)) AS STRING):string,CAST(udf(cast(code as string)) AS STRING):string,CAST(udf(cast(b_cnt as string)) AS BIGINT):bigint,CAST(udf(cast(const as string)) AS INT):int>
    -- !query 136 output
    A      p       2       -1
    B      q       0       -1
   @@ -2852,15 +2852,15 @@ LEFT JOIN
    ( SELECT sub3.key3, sub4.value2, COALESCE(sub4.value2, 66) as value3 FROM
        ( SELECT 1 as key3 ) sub3
        LEFT JOIN
   -    ( SELECT sub5.key5, COALESCE(sub6.value1, 1) as value2 FROM
   +    ( SELECT udf(sub5.key5) as key5, udf(COALESCE(sub6.value1, 1)) as value2 FROM
            ( SELECT 1 as key5 ) sub5
    order by c.name
    -- !query 136 schema
   -struct<name:string,code:string,b_cnt:bigint,const:int>
   +struct<CAST(udf(cast(name as string)) AS STRING):string,CAST(udf(cast(code as strin
   g)) AS STRING):string,CAST(udf(cast(b_cnt as string)) AS BIGINT):bigint,CAST(udf(cas
   t(const as string)) AS INT):int>
    -- !query 136 output
    A      p       2       -1
    B      q       0       -1
   @@ -2852,15 +2852,15 @@ LEFT JOIN
    ( SELECT sub3.key3, sub4.value2, COALESCE(sub4.value2, 66) as value3 FROM
        ( SELECT 1 as key3 ) sub3
        LEFT JOIN
   -    ( SELECT sub5.key5, COALESCE(sub6.value1, 1) as value2 FROM
   +    ( SELECT udf(sub5.key5) as key5, udf(COALESCE(sub6.value1, 1)) as value2 FROM
            ( SELECT 1 as key5 ) sub5
            LEFT JOIN
            ( SELECT 2 as key6, 42 as value1 ) sub6
   -        ON sub5.key5 = sub6.key6
   +        ON udf(sub5.key5) = udf(sub6.key6)
        ) sub4
   -    ON sub4.key5 = sub3.key3
   +    ON udf(sub4.key5) = udf(sub3.key3)
    ) sub2
   -ON sub1.key1 = sub2.key3
   +ON udf(sub1.key1) = udf(sub2.key3)
    -- !query 137 schema
    struct<key1:int,key3:int,value2:int,value3:int>
    -- !query 137 output
   @@ -2871,7 +2871,7 @@ struct<key1:int,key3:int,value2:int,value3:int>
    SELECT * FROM
    ( SELECT 1 as key1 ) sub1
    LEFT JOIN
   -( SELECT sub3.key3, value2, COALESCE(value2, 66) as value3 FROM
   +( SELECT udf(sub3.key3) as key3, udf(value2), udf(COALESCE(value2, 66)) as value3 FROM
        ( SELECT 1 as key3 ) sub3
        LEFT JOIN
        ( SELECT sub5.key5, COALESCE(sub6.value1, 1) as value2 FROM
   @@ -2884,21 +2884,21 @@ LEFT JOIN
    ) sub2
    ON sub1.key1 = sub2.key3
    -- !query 138 schema
   -struct<key1:int,key3:int,value2:int,value3:int>
   +struct<key1:int,key3:int,CAST(udf(cast(value2 as string)) AS INT):int,value3:int>
    -- !query 138 output
    1      1       1       1
    
    
    -- !query 139
   -SELECT qq, unique1
   +SELECT udf(qq), udf(unique1)
      FROM
   -  ( SELECT COALESCE(q1, 0) AS qq FROM int8_tbl a ) AS ss1
   +  ( SELECT udf(COALESCE(q1, 0)) AS qq FROM int8_tbl a ) AS ss1
      FULL OUTER JOIN
   -  ( SELECT COALESCE(q2, -1) AS qq FROM int8_tbl b ) AS ss2
   +  ( SELECT udf(COALESCE(q2, -1)) AS qq FROM int8_tbl b ) AS ss2
      USING (qq)
   -  INNER JOIN tenk1 c ON qq = unique2
   +  INNER JOIN tenk1 c ON udf(qq) = udf(unique2)
    -- !query 139 schema
   -struct<qq:bigint,unique1:int>
   +struct<CAST(udf(cast(qq as string)) AS BIGINT):bigint,CAST(udf(cast(unique1 as string)) AS INT):int>
    -- !query 139 output
    123    4596
    123    4596
   @@ -2936,19 +2936,19 @@ struct<>
    
    
    -- !query 143
   -select nt3.id
   +select udf(nt3.id)
    from nt3 as nt3
      left join
   -    (select nt2.*, (nt2.b1 and ss1.a3) AS b3
   +    (select nt2.*, (udf(nt2.b1) and udf(ss1.a3)) AS b3
         from nt2 as nt2
           left join
   -         (select nt1.*, (nt1.id is not null) as a3 from nt1) as ss1
   -         on ss1.id = nt2.nt1_id
   +         (select nt1.*, (udf(nt1.id) is not null) as a3 from nt1) as ss1
   +         on udf(ss1.id) = udf(nt2.nt1_id)
        ) as ss2
   -    on ss2.id = nt3.nt2_id
   -where nt3.id = 1 and ss2.b3
   +    on udf(ss2.id) = udf(nt3.nt2_id)
   +where udf(nt3.id) = 1 and udf(ss2.b3)
    -- !query 143 schema
   -struct<id:int>
   +struct<CAST(udf(cast(id as string)) AS INT):int>
    -- !query 143 output
    1
    
   @@ -3003,73 +3003,73 @@ NULL    2147483647
    
    
    -- !query 146
   -select count(*) from
   -  tenk1 a join tenk1 b on a.unique1 = b.unique2
   -  left join tenk1 c on a.unique2 = b.unique1 and c.thousand = a.thousand
   -  join int4_tbl on b.thousand = f1
   +select udf(count(*)) from
   +  tenk1 a join tenk1 b on udf(a.unique1) = udf(b.unique2)
   +  left join tenk1 c on udf(a.unique2) = udf(b.unique1) and udf(c.thousand) = udf(a.thousand)
   +  join int4_tbl on udf(b.thousand) = udf(f1)
    -- !query 146 schema
   -struct<count(1):bigint>
   +struct<CAST(udf(cast(count(1) as string)) AS BIGINT):bigint>
    -- !query 146 output
    10
    
    
    -- !query 147
   -select b.unique1 from
   -  tenk1 a join tenk1 b on a.unique1 = b.unique2
   -  left join tenk1 c on b.unique1 = 42 and c.thousand = a.thousand
   -  join int4_tbl i1 on b.thousand = f1
   -  right join int4_tbl i2 on i2.f1 = b.tenthous
   -  order by 1
   +select udf(b.unique1) from
   +  tenk1 a join tenk1 b on udf(a.unique1) = udf(b.unique2)
   +  left join tenk1 c on udf(b.unique1) = udf(42) and udf(c.thousand) = udf(a.thousand)
   +  join int4_tbl i1 on udf(b.thousand) = udf(f1)
   +  right join int4_tbl i2 on udf(i2.f1) = udf(b.tenthous)
   +  order by udf(1)
    -- !query 147 schema
   -struct<unique1:int>
   +struct<CAST(udf(cast(unique1 as string)) AS INT):int>
    -- !query 147 output
    NULL
    NULL
   +0
    NULL
    NULL
   -0
    
    
    -- !query 148
    select * from
    (
   -  select unique1, q1, coalesce(unique1, -1) + q1 as fault
   -  from int8_tbl left join tenk1 on (q2 = unique2)
   +  select udf(unique1), udf(q1), udf(coalesce(unique1, -1)) + udf(q1) as fault
   +  from int8_tbl left join tenk1 on (udf(q2) = udf(unique2))
    ) ss
   -where fault = 122
   -order by fault
   +where udf(fault) = udf(122)
   +order by udf(fault)
    -- !query 148 schema
   -struct<unique1:int,q1:bigint,fault:bigint>
   +struct<CAST(udf(cast(unique1 as string)) AS INT):int,CAST(udf(cast(q1 as string)) AS BIGINT):bigint,fault:bigint>
    -- !query 148 output
    NULL   123     122
    
    
    -- !query 149
   -select q1, unique2, thousand, hundred
   -  from int8_tbl a left join tenk1 b on q1 = unique2
   -  where coalesce(thousand,123) = q1 and q1 = coalesce(hundred,123)
   +select udf(q1), udf(unique2), udf(thousand), udf(hundred)
   +  from int8_tbl a left join tenk1 b on udf(q1) = udf(unique2)
   +  where udf(coalesce(thousand,123)) = udf(q1) and udf(q1) = udf(coalesce(hundred,123))
    -- !query 149 schema
   -struct<q1:bigint,unique2:int,thousand:int,hundred:int>
   +struct<CAST(udf(cast(q1 as string)) AS BIGINT):bigint,CAST(udf(cast(unique2 as string)) AS INT):int,CAST(udf(cast(thousand as string)) AS INT):int,CAST(udf(cast(hundred as string)) AS INT):int>
    -- !query 149 output
    
    
    
    -- !query 150
   -select f1, unique2, case when unique2 is null then f1 else 0 end
   -  from int4_tbl a left join tenk1 b on f1 = unique2
   -  where (case when unique2 is null then f1 else 0 end) = 0
   +select udf(f1), udf(unique2), case when udf(unique2) is null then udf(f1) else 0 end
   +  from int4_tbl a left join tenk1 b on udf(f1) = udf(unique2)
   +  where (case when udf(unique2) is null then udf(f1) else 0 end) = 0
    -- !query 150 schema
   -struct<f1:int,unique2:int,CASE WHEN (unique2 IS NULL) THEN f1 ELSE 0 END:int>
   +struct<CAST(udf(cast(f1 as string)) AS INT):int,CAST(udf(cast(unique2 as string)) AS INT):int,CASE WHEN (CAST(udf(cast(unique2 as string)) AS INT) IS NULL) THEN CAST(udf(cast(f1 as string)) AS INT) ELSE 0 END:int>
    -- !query 150 output
    0      0       0
    
    
    -- !query 151
   -select a.unique1, b.unique1, c.unique1, coalesce(b.twothousand, a.twothousand)
   -  from tenk1 a left join tenk1 b on b.thousand = a.unique1                        left join tenk1 c on c.unique2 = coalesce(b.twothousand, a.twothousand)
   -  where a.unique2 < 10 and coalesce(b.twothousand, a.twothousand) = 44
   +select udf(a.unique1), udf(b.unique1), udf(c.unique1), udf(coalesce(b.twothousand, a.twothousand))
   +  from tenk1 a left join tenk1 b on udf(b.thousand) = udf(a.unique1)                        left join tenk1 c on udf(c.unique2) = udf(coalesce(b.twothousand, a.twothousand))
   +  where udf(a.unique2) < udf(10) and udf(coalesce(b.twothousand, a.twothousand)) = udf(44)
    -- !query 151 schema
   -struct<unique1:int,unique1:int,unique1:int,coalesce(twothousand, twothousand):int>
   +struct<CAST(udf(cast(unique1 as string)) AS INT):int,CAST(udf(cast(unique1 as string)) AS INT):int,CAST(udf(cast(unique1 as string)) AS INT):int,CAST(udf(cast(coalesce(twothousand, twothousand) as string)) AS INT):int>
    -- !query 151 output
    
    
   @@ -3078,11 +3078,11 @@ struct<unique1:int,unique1:int,unique1:int,coalesce(twothousand, twothousand):in
    select * from
      text_tbl t1
      inner join int8_tbl i8
   -  on i8.q2 = 456
   +  on udf(i8.q2) = udf(456)
      right join text_tbl t2
   -  on t1.f1 = 'doh!'
   +  on udf(t1.f1) = udf('doh!')
      left join int4_tbl i4
   -  on i8.q1 = i4.f1
   +  on udf(i8.q1) = udf(i4.f1)
    -- !query 152 schema
    struct<f1:string,q1:bigint,q2:bigint,f1:string,f1:int>
    -- !query 152 output
   @@ -3092,10 +3092,10 @@ doh!    123     456     hi de ho neighbor       NULL
    
    -- !query 153
    select * from
   -  (select 1 as id) as xx
   +  (select udf(1) as id) as xx
      left join
   -    (tenk1 as a1 full join (select 1 as id) as yy on (a1.unique1 = yy.id))
   -  on (xx.id = coalesce(yy.id))
   +    (tenk1 as a1 full join (select udf(1) as id) as yy on (udf(a1.unique1) = udf(yy.id)))
   +  on (udf(xx.id) = udf(coalesce(yy.id)))
    -- !query 153 schema
    struct<id:int,unique1:int,unique2:int,two:int,four:int,ten:int,twenty:int,hundred:int,thousand:int,twothousand:int,fivethous:int,tenthous:int,odd:int,even:int,stringu1:string,stringu2:string,string4:string,id:int>
    -- !query 153 output
   @@ -3103,11 +3103,11 @@ struct<id:int,unique1:int,unique2:int,two:int,four:int,ten:int,twenty:int,hundre
    
    
    -- !query 154
   -select a.q2, b.q1
   -  from int8_tbl a left join int8_tbl b on a.q2 = coalesce(b.q1, 1)
   -  where coalesce(b.q1, 1) > 0
   +select udf(a.q2), udf(b.q1)
   +  from int8_tbl a left join int8_tbl b on udf(a.q2) = udf(coalesce(b.q1, 1))
   +  where udf(coalesce(b.q1, 1)) > 0
    -- !query 154 schema
   -struct<q2:bigint,q1:bigint>
   +struct<CAST(udf(cast(q2 as string)) AS BIGINT):bigint,CAST(udf(cast(q1 as string)) AS BIGINT):bigint>
    -- !query 154 output
    -4567890123456789      NULL
    123    123
   @@ -3142,7 +3142,7 @@ struct<>
    
    
    -- !query 157
   -select p.* from parent p left join child c on (p.k = c.k)
   +select p.* from parent p left join child c on (udf(p.k) = udf(c.k))
    -- !query 157 schema
    struct<k:int,pd:int>
    -- !query 157 output
   @@ -3153,8 +3153,8 @@ struct<k:int,pd:int>
    
    -- !query 158
    select p.*, linked from parent p
   -  left join (select c.*, true as linked from child c) as ss
   -  on (p.k = ss.k)
   +  left join (select c.*, udf(true) as linked from child c) as ss
   +  on (udf(p.k) = udf(ss.k))
    -- !query 158 schema
    struct<k:int,pd:int,linked:boolean>
    -- !query 158 output
   @@ -3165,8 +3165,8 @@ struct<k:int,pd:int,linked:boolean>
    
    -- !query 159
    select p.* from
   -  parent p left join child c on (p.k = c.k)
   -  where p.k = 1 and p.k = 2
   +  parent p left join child c on (udf(p.k) = udf(c.k))
   +  where udf(p.k) = udf(1) and udf(p.k) = udf(2)
    -- !query 159 schema
    struct<k:int,pd:int>
    -- !query 159 output
   @@ -3175,8 +3175,8 @@ struct<k:int,pd:int>
    
    -- !query 160
    select p.* from
   -  (parent p left join child c on (p.k = c.k)) join parent x on p.k = x.k
   -  where p.k = 1 and p.k = 2
   +  (parent p left join child c on (udf(p.k) = udf(c.k))) join parent x on udf(p.k) = udf(x.k)
   +  where udf(p.k) = udf(1) and udf(p.k) = udf(2)
    -- !query 160 schema
    struct<k:int,pd:int>
    -- !query 160 output
   @@ -3204,7 +3204,7 @@ struct<>
    
    
    -- !query 163
   -SELECT * FROM b LEFT JOIN a ON (b.a_id = a.id) WHERE (a.id IS NULL OR a.id > 0)
   +SELECT * FROM b LEFT JOIN a ON (udf(b.a_id) = udf(a.id)) WHERE (udf(a.id) IS NULL OR udf(a.id) > 0)
    -- !query 163 schema
    struct<id:int,a_id:int,id:int>
    -- !query 163 output
   @@ -3212,7 +3212,7 @@ struct<id:int,a_id:int,id:int>
    
    
    -- !query 164
   -SELECT b.* FROM b LEFT JOIN a ON (b.a_id = a.id) WHERE (a.id IS NULL OR a.id > 0)
   +SELECT b.* FROM b LEFT JOIN a ON (udf(b.a_id) = udf(a.id)) WHERE (udf(a.id) IS NULL OR udf(a.id) > 0)
    -- !query 164 schema
    struct<id:int,a_id:int>
    -- !query 164 output
   @@ -3231,13 +3231,13 @@ struct<>
    
    -- !query 166
    SELECT * FROM
   -    (SELECT 1 AS x) ss1
   +    (SELECT udf(1) AS x) ss1
      LEFT JOIN
   -    (SELECT q1, q2, COALESCE(dat1, q1) AS y
   -     FROM int8_tbl LEFT JOIN innertab ON q2 = id) ss2
   +    (SELECT udf(q1), udf(q2), udf(COALESCE(dat1, q1)) AS y
   +     FROM int8_tbl LEFT JOIN innertab ON udf(q2) = udf(id)) ss2
      ON true
    -- !query 166 schema
   -struct<x:int,q1:bigint,q2:bigint,y:bigint>
   +struct<x:int,CAST(udf(cast(q1 as string)) AS BIGINT):bigint,CAST(udf(cast(q2 as string)) AS BIGINT):bigint,y:bigint>
    -- !query 166 output
    1      123     456     123
    1      123     4567890123456789        123
   @@ -3248,29 +3248,29 @@ struct<x:int,q1:bigint,q2:bigint,y:bigint>
    
    -- !query 167
    select * from
   -  int8_tbl x join (int4_tbl x cross join int4_tbl y) j on q1 = f1
   +  int8_tbl x join (int4_tbl x cross join int4_tbl y) j on udf(q1) = udf(f1)
    -- !query 167 schema
    struct<>
    -- !query 167 output
    org.apache.spark.sql.AnalysisException
   -Reference 'f1' is ambiguous, could be: j.f1, j.f1.; line 2 pos 63
   +Reference 'f1' is ambiguous, could be: j.f1, j.f1.; line 2 pos 72
    
    
    -- !query 168
    -- error
    select * from
   -  int8_tbl x join (int4_tbl x cross join int4_tbl y) j on q1 = y.f1
   +  int8_tbl x join (int4_tbl x cross join int4_tbl y) j on udf(q1) = udf(y.f1)
    -- !query 168 schema
    struct<>
    -- !query 168 output
    org.apache.spark.sql.AnalysisException
   -cannot resolve '`y.f1`' given input columns: [j.f1, j.f1, x.q1, x.q2]; line 3 pos 63
   +cannot resolve '`y.f1`' given input columns: [j.f1, j.f1, x.q1, x.q2]; line 3 pos 72
    
    
    -- !query 169
    -- error
    select * from
   -  int8_tbl x join (int4_tbl x cross join int4_tbl y(ff)) j on q1 = f1
   +  int8_tbl x join (int4_tbl x cross join int4_tbl y(ff)) j on udf(q1) = udf(f1)
    -- !query 169 schema
    struct<q1:bigint,q2:bigint,f1:int,ff:int>
    -- !query 169 output
   @@ -3281,35 +3281,35 @@ struct<q1:bigint,q2:bigint,f1:int,ff:int>
    -- ok
    
    
   -select t1.uunique1 from
   -  tenk1 t1 join tenk2 t2 on t1.two = t2.two
   +select udf(t1.uunique1) from
   +  tenk1 t1 join tenk2 t2 on udf(t1.two) = udf(t2.two)
    -- !query 170 schema
    struct<>
    -- !query 170 output
    org.apache.spark.sql.AnalysisException
   -cannot resolve '`t1.uunique1`' given input columns: [t1.even, t2.even, t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 4 pos 7
   +cannot resolve '`t1.uunique1`' given input columns: [t1.even, t2.even, t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 4 pos 11
    
    
    -- !query 171
    -- error, prefer "t1" suggestion
   -select t2.uunique1 from
   -  tenk1 t1 join tenk2 t2 on t1.two = t2.two
   +select udf(t2.uunique1) from
   +  tenk1 t1 join tenk2 t2 on udf(t1.two) = udf(t2.two)
    -- !query 171 schema
    struct<>
    -- !query 171 output
    org.apache.spark.sql.AnalysisException
   -cannot resolve '`t2.uunique1`' given input columns: [t1.even, t2.even, t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 2 pos 7
   +cannot resolve '`t2.uunique1`' given input columns: [t1.even, t2.even, t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 2 pos 11
    
    
    -- !query 172
    -- error, prefer "t2" suggestion
   -select uunique1 from
   -  tenk1 t1 join tenk2 t2 on t1.two = t2.two
   +select udf(uunique1) from
   +  tenk1 t1 join tenk2 t2 on udf(t1.two) = udf(t2.two)
    -- !query 172 schema
    struct<>
    -- !query 172 output
    org.apache.spark.sql.AnalysisException
   -cannot resolve '`uunique1`' given input columns: [t1.even, t2.even, t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 2 pos 7
   +cannot resolve '`uunique1`' given input columns: [t1.even, t2.even, t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 2 pos 11
    
    
    -- !query 173
   @@ -3338,39 +3338,39 @@ cannot resolve '`uunique1`' given input columns: [t1.even, t2.even, t1.fivethous
    
    
    
   -select f1,g from int4_tbl a, (select f1 as g) ss
   +select udf(f1,g) from int4_tbl a, (select udf(f1) as g) ss
    -- !query 173 schema
    struct<>
    -- !query 173 output
    org.apache.spark.sql.AnalysisException
   -cannot resolve '`f1`' given input columns: []; line 26 pos 37
   +cannot resolve '`f1`' given input columns: []; line 26 pos 46
    
    
    -- !query 174
   -select f1,g from int4_tbl a, (select a.f1 as g) ss
   +select udf(f1,g) from int4_tbl a, (select udf(a.f1) as g) ss
    -- !query 174 schema
    struct<>
    -- !query 174 output
    org.apache.spark.sql.AnalysisException
   -cannot resolve '`a.f1`' given input columns: []; line 1 pos 37
   +cannot resolve '`a.f1`' given input columns: []; line 1 pos 46
    
    
    -- !query 175
   -select f1,g from int4_tbl a cross join (select f1 as g) ss
   +select udf(f1,g) from int4_tbl a cross join (select udf(f1) as g) ss
    -- !query 175 schema
    struct<>
    -- !query 175 output
    org.apache.spark.sql.AnalysisException
   -cannot resolve '`f1`' given input columns: []; line 1 pos 47
   +cannot resolve '`f1`' given input columns: []; line 1 pos 56
    
    
    -- !query 176
   -select f1,g from int4_tbl a cross join (select a.f1 as g) ss
   +select udf(f1,g) from int4_tbl a cross join (select udf(a.f1) as g) ss
    -- !query 176 schema
    struct<>
    -- !query 176 output
    org.apache.spark.sql.AnalysisException
   -cannot resolve '`a.f1`' given input columns: []; line 1 pos 47
   +cannot resolve '`a.f1`' given input columns: []; line 1 pos 56
    
    
    -- !query 177
   @@ -3415,8 +3415,8 @@ struct<>
    
    -- !query 182
    select * from j1
   -inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2
   -where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1
   +inner join j2 on udf(j1.id1) = udf(j2.id1) and udf(j1.id2) = udf(j2.id2)
   +where udf(j1.id1) % 1000 = 1 and udf(j2.id1) % 1000 = 1
    -- !query 182 schema
    struct<id1:int,id2:int,id1:int,id2:int>
    -- !query 182 output
   ```
   
   </p>
   </details>
   
   
   ## How was this patch tested?
   
   Tested as guided in [SPARK-27921](https://issues.apache.org/jira/browse/SPARK-27921).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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