Hey Alexey,

You need to use |HiveContext| in order to access Hive UDFs. You may try it with |bin/spark-sql| (|src| is a Hive table):

|spark-sql> select key / 3 from src limit 10;
79.33333333333333
28.666666666666668
103.66666666666667
9.0
55.0
136.33333333333334
85.0
92.66666666666667
32.666666666666664
161.33333333333334
spark-sql> select ceil(key / 3) from src limit 10;
80
29
104
9
55
137
85
93
33
162
|

Just put your |hive-site.xml| under |$SPARK_HOME/conf|.

Cheng

On 1/26/15 11:20 PM, Alexey Romanchuk wrote:

I have tried "select ceil(2/3)", but got "key not found: floor"

On Tue, Jan 27, 2015 at 11:05 AM, Ted Yu <yuzhih...@gmail.com <mailto:yuzhih...@gmail.com>> wrote:

    Have you tried floor() or ceil() functions ?

    According to http://spark.apache.org/sql/, Spark SQL is compatible
    with Hive SQL.

    Cheers

    On Mon, Jan 26, 2015 at 8:29 PM, 1esha <alexey.romanc...@gmail.com
    <mailto:alexey.romanc...@gmail.com>> wrote:

        Hello everyone!

        I try execute "select 2/3" and I get "0.6666666666666666". Is
        there any way
        to cast double to int or something similar?

        Also it will be cool to get list of functions supported by
        spark sql.

        Thanks!



        --
        View this message in context:
        
http://apache-spark-user-list.1001560.n3.nabble.com/Mathematical-functions-in-spark-sql-tp21383.html
        Sent from the Apache Spark User List mailing list archive at
        Nabble.com.

        ---------------------------------------------------------------------
        To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
        <mailto:user-unsubscr...@spark.apache.org>
        For additional commands, e-mail: user-h...@spark.apache.org
        <mailto:user-h...@spark.apache.org>



Reply via email to