spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yijieshen <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-8279][SQL]Add math function round
Date Sat, 04 Jul 2015 08:53:23 GMT
Github user yijieshen commented on the pull request:

    https://github.com/apache/spark/pull/6938#issuecomment-118488908
  
    udf_round_3 and expected output:
    ```
    -- test for TINYINT
    select round(-128), round(127), round(0) from src tablesample (1 rows);
    
    -- test for SMALLINT
    select round(-32768), round(32767), round(-129), round(128) from src tablesample (1 rows);
    
    -- test for INT
    select round(cast(negative(pow(2, 31)) as INT)), round(cast((pow(2, 31) - 1) as INT)),
round(-32769), round(32768) from src tablesample (1 rows);
    
    -- test for BIGINT
    select round(cast(negative(pow(2, 63)) as BIGINT)), round(cast((pow(2, 63) - 1) as BIGINT)),
round(cast(negative(pow(2, 31) + 1) as BIGINT)), round(cast(pow(2, 31) as BIGINT)) from src
tablesample (1 rows);
    
    -- test for DOUBLE
    select round(126.1), round(126.7), round(32766.1), round(32766.7) from src tablesample
(1 rows);
    ```
    
    ```
    -128	127	0
    -32768	32767	-129	128
    -2147483648	2147483647	-32769	32768
    -9223372036854775808	9223372036854775807	-2147483649	2147483648
    126.0	127.0	32766.0	32767.0
    ```



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

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


Mime
View raw message