You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Venkata Ramana G (JIRA)" <ji...@apache.org> on 2014/09/18 12:19:34 UTC

[jira] [Commented] (SPARK-3268) DoubleType should support modulus

    [ https://issues.apache.org/jira/browse/SPARK-3268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14138763#comment-14138763 ] 

Venkata Ramana G commented on SPARK-3268:
-----------------------------------------

Problem:
double, decimal and float are identified under fractional type hierarchy
as per Scala, % (rem) function is implemented under integral type hierarchy.
Currently there is no mechanism exists to allow fractional type using integral operations.

Solution:
Scala provides overridden classes like DoubleAsIfIntegral, FloatAsIfIntegral, BigDecimalAsIfIntegral to allow these types to work with integral operators.
So we can add asIntegral to FractionalType  to support calling Integral related functions.
i2 function can call functions on asIntegral to execute the same.

Implemented the same, writing test cases is pending, will submit the patch for the same.

> DoubleType should support modulus 
> ----------------------------------
>
>                 Key: SPARK-3268
>                 URL: https://issues.apache.org/jira/browse/SPARK-3268
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Chris Grier
>            Priority: Minor
>
> Using the modulus operator (%) on Doubles throws and exception. 
> eg: 
> SELECT 1388632775.0 % 60 from tablename LIMIT 1
> Throws: 
> java.lang.Exception: Type DoubleType does not support numeric operations



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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