You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Maria <li...@126.com> on 2019/05/07 11:01:18 UTC
How to convert custom Class type to Expression Type?
Hi, all.
I have one custom type called 'x.xx.xxx.EsSqlFilter', and I want to convert it to Expression type, then pass the instance obj to a function through Expressions.call(), then it can be used in the specified function call,I tryed to use 'Expressions.newArrayInit(clazz, constantList(values))' to convert it, but it became a new Object with nothing in the function, all the attribute values are lost.
I am newbie with linq4J. and got bogged down in this question.
Can someone give me an suggestion? Any reply will be much appreciated.
Best Wishes.
Re:Re: How to convert custom Class type to Expression Type?
Posted by Maria <li...@126.com>.
Thankyou so much for your reply.Muhammad .
I find a solution: serializing my custom filter object to byte[], then call org.apache.calcite.linq4j.tree.Expressions.constant(), it works!
At 2019-05-07 21:34:57, "Muhammad Gelbana" <m....@gmail.com> wrote:
>I think it might be easier/cleaner to have the filter as an input to a
>project having the expression processing the filter's output. I don't know
>if it's possible to have the operatr as an input to an expression.
>
>Thanks,
>Gelbana
>
>
>On Tue, May 7, 2019 at 1:09 PM Maria <li...@126.com> wrote:
>
>> Hi, all.
>> I have one custom type called 'x.xx.xxx.EsSqlFilter', and I want to
>> convert it to Expression type, then pass the instance obj to a function
>> through Expressions.call(), then it can be used in the specified function
>> call,I tryed to use 'Expressions.newArrayInit(clazz, constantList(values))'
>> to convert it, but it became a new Object with nothing in the function, all
>> the attribute values are lost.
>> I am newbie with linq4J. and got bogged down in this question.
>> Can someone give me an suggestion? Any reply will be much appreciated.
>>
>>
>> Best Wishes.
Re: How to convert custom Class type to Expression Type?
Posted by Muhammad Gelbana <m....@gmail.com>.
I think it might be easier/cleaner to have the filter as an input to a
project having the expression processing the filter's output. I don't know
if it's possible to have the operatr as an input to an expression.
Thanks,
Gelbana
On Tue, May 7, 2019 at 1:09 PM Maria <li...@126.com> wrote:
> Hi, all.
> I have one custom type called 'x.xx.xxx.EsSqlFilter', and I want to
> convert it to Expression type, then pass the instance obj to a function
> through Expressions.call(), then it can be used in the specified function
> call,I tryed to use 'Expressions.newArrayInit(clazz, constantList(values))'
> to convert it, but it became a new Object with nothing in the function, all
> the attribute values are lost.
> I am newbie with linq4J. and got bogged down in this question.
> Can someone give me an suggestion? Any reply will be much appreciated.
>
>
> Best Wishes.