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

Joel Bernstein edited comment on SOLR-9916 at 1/3/17 4:58 PM:
--------------------------------------------------------------

One possible approach would look like this:

{code}
plus(a, b, outField)
plus(plus(a,b), c, outField)
plus(sum(a), sum(b), outField)
{code}

In the first example two field names are used to represent operands.

In the second example the first operand is a nested arithmetic operation. 

In the third example the operands are aggregate function names.

The constructors of the arithmetic operations will need to do the work to 
distinguish the different types of operands.

As part of a select expression it would like this:
{code}
select(expr, plus(a,b, outField), minus(sum(a), sum(b), outField))
{code}


For simplicity arithmetic functions can only return doubles.

Suggested initial arithmetic operations:

plus
minus,
mult,
div,
abs,
mod












was (Author: joel.bernstein):
One possible approach would look like this:

{code}
plus(a, b, outField)
plus(plus(a,b), c, outField)
plus(sum(a), sum(b), outField)
{code}

In the first example two field names are used to represent operands.

In the second example the first operand is a nested arithmetic operation. 

In the third example the operands are aggregate function names.

The constructors of the arithmetic operations will need to do the work to 
distinguish the different types of operands.

For simplicity arithmetic functions can only return doubles.

Suggested initial arithmetic operations:

plus
minus,
mult,
div,
abs,
mod











> Add arithmetic operations for the SelectStream
> ----------------------------------------------
>
>                 Key: SOLR-9916
>                 URL: https://issues.apache.org/jira/browse/SOLR-9916
>             Project: Solr
>          Issue Type: New Feature
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Joel Bernstein
>
> One of the things that will be needed as the SQL implementation matures is 
> the ability to do arithmetic operations. For example:
> select (a+b) from x;
> select sum(a)+sum(b) from x;
> We will need to support arithmetic operations within the Streaming API to 
> support these types of operations.
> It looks like adding arithmetic operations to the SelectStream is the best 
> place to add this functionality.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to