You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@arrow.apache.org by Troy Zimmerman <ta...@me.com> on 2020/07/24 19:42:19 UTC

Does gandiva support the unary minus operator?

Hi,

I’ve written a small library that uses the ast module to parse a Python expression into a Gandiva expression tree. I’d like to able to do numeric negation (i.e. -x) in an expression, but I’ve I looked through the source code and haven’t found a way to achieve this. (I could also be missing an obvious workaround.)

Separately, are there any tutorials on using the Python bindings for Gandiva? If not, would the project be open to such a contribution? At the moment I’ve got scattershot notes of what I’ve learned from digging through the source, but could organize them into a brief tutorial or cookbook.

Best,
Troy

Re: Does gandiva support the unary minus operator?

Posted by Troy Zimmerman <ta...@me.com>.
Hi Neal,

Thank for you the quick response & suggestion. That is the obvious workaround I missed. :)

As for the contributing docs, I’ll put something together and submit a PR.

Thank you again!

Best,
Troy

> On Jul 24, 2020, at 15:23, Neal Richardson <ne...@gmail.com> wrote:
> 
> 
> I can't answer the first question authoritatively, though off the top of my head, could you translate that to `0 - x` and use the binary operator? You may also consider posting this question to the dev@arrow.apache.org mailing list.
> 
> As for contributing tutorials and user guides, yes, please do. I believe the right location to add what you're talking about would be in https://github.com/apache/arrow/tree/master/docs/source/python.
> 
> Neal
> 
>> On Fri, Jul 24, 2020 at 12:42 PM Troy Zimmerman <ta...@me.com> wrote:
>> Hi,
>> 
>> I’ve written a small library that uses the ast module to parse a Python expression into a Gandiva expression tree. I’d like to able to do numeric negation (i.e. -x) in an expression, but I’ve I looked through the source code and haven’t found a way to achieve this. (I could also be missing an obvious workaround.)
>> 
>> Separately, are there any tutorials on using the Python bindings for Gandiva? If not, would the project be open to such a contribution? At the moment I’ve got scattershot notes of what I’ve learned from digging through the source, but could organize them into a brief tutorial or cookbook.
>> 
>> Best,
>> Troy

Re: Does gandiva support the unary minus operator?

Posted by Neal Richardson <ne...@gmail.com>.
I can't answer the first question authoritatively, though off the top of my
head, could you translate that to `0 - x` and use the binary operator? You
may also consider posting this question to the dev@arrow.apache.org mailing
list.

As for contributing tutorials and user guides, yes, please do. I believe
the right location to add what you're talking about would be in
https://github.com/apache/arrow/tree/master/docs/source/python.

Neal

On Fri, Jul 24, 2020 at 12:42 PM Troy Zimmerman <ta...@me.com> wrote:

> Hi,
>
> I’ve written a small library that uses the ast module to parse a Python
> expression into a Gandiva expression tree. I’d like to able to do numeric
> negation (i.e. -x) in an expression, but I’ve I looked through the source
> code and haven’t found a way to achieve this. (I could also be missing an
> obvious workaround.)
>
> Separately, are there any tutorials on using the Python bindings for
> Gandiva? If not, would the project be open to such a contribution? At the
> moment I’ve got scattershot notes of what I’ve learned from digging through
> the source, but could organize them into a brief tutorial or cookbook.
>
> Best,
> Troy