You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apex.apache.org by Vlad Rozov <v....@gmail.com> on 2017/10/24 17:15:33 UTC
Re: How to specify more than one fields as a dedup keyExpression
Suppose I have a pojo with "$" in a field name. Will {$.$} work? Looking
at the PojoUtils code, it ignores exprObjectPlaceholder parameter and
hardcodes PojoUtils.DEFAULT_EXPRESSION_OBJ_PLACEHOLDER. I don't
understand why.
Thank you,
Vlad
On 10/23/17 19:23, Chinmay Kolhatkar wrote:
> {$.id} + {$.id1} should work.
>
> - Chinmay.
>
> On 24 Oct 2017 6:51 am, "Vlad Rozov" <v.rozov64@gmail.com
> <ma...@gmail.com>> wrote:
>
> I don't think that Apex expression evaluator is that smart :). Try
> "{$}.getId() + {$}.getId1()" or provide a getter that returns pair
> object.
>
> Thank you,
>
> Vlad
>
> On 10/23/17 18:13, Munagala Ramanath wrote:
>> It needs to be an expression that combines both (or all) values:
>> try "id + id1"
>>
>> Ram
>>
>>
>> On Monday, October 23, 2017, 6:04:14 PM PDT, Vivek Bhide
>> <vi...@target.com> <ma...@target.com> wrote:
>>
>>
>> Thanks Ram for your suggestions
>>
>> Field types that I am trying are the basic primitive types. In
>> fact, I was
>> just playing around with the dedup examples that is available in
>> malhar git.
>> I just added one more field id1 with getter and setters to
>> 'TestEvent' class
>> from testcase and want to try dedup on the combination of both fields
>>
>> Operator fails right during activate() method while getting the
>> keyGetter
>> for which is then used in getKey()
>>
>> Below are few expressions i tried
>> Default value <value>id</id>
>> combinations tried -
>> <value>id,id1</id>
>> <value>getId(),getId1()</id>
>> <value>{$}.getId() && {$}.getId1()</id>
>> <value>"getId()","getId1()"</id>
>> <value>{$}.getId(),{$}.getId1()</value>
>> <value>{{$}.getId(),{$}.getId1()}</value>
>>
>> Below is the stacktrace of the exception I got most of the times:
>>
>> 2017-10-23 16:48:52,775 [2/Deduper:BoundedDedupOperator] WARN
>> util.LoggerUtil shouldFetchLogFileInformation - Log information is
>> unavailable. To enable log information log4j/logging should be
>> configured
>> with single FileAppender that has immediateFlush set to true and
>> log level
>> set to ERROR or greater.
>> 2017-10-23 16:48:52,775 [2/Deduper:BoundedDedupOperator] ERROR
>> engine.StreamingContainer run - Abandoning deployment of operator
>> OperatorDeployInfo[id=2,name=Deduper,type=GENERIC,checkpoint={ffffffffffffffff,
>> 0,
>> 0},inputs=[OperatorDeployInfo.InputDeployInfo[portName=input,streamId=Generator
>> to
>> Dedup,sourceNodeId=1,sourcePortName=output,locality=<null>,partitionMask=0,partitionKeys=<null>]],outputs=[OperatorDeployInfo.OutputDeployInfo[portName=unique,streamId=Dedup
>> Unique to Console,bufferServer=localhost],
>> OperatorDeployInfo.OutputDeployInfo[portName=duplicate,streamId=Dedup
>> Duplicate to Console,bufferServer=localhost],
>> OperatorDeployInfo.OutputDeployInfo[portName=expired,streamId=Dedup
>> Expired
>> to Console,bufferServer=localhost]]] due to setup failure.
>> java.lang.RuntimeException:
>> org.codehaus.commons.compiler.CompileException:
>> Line 1, Column 101: ')' expected instead of ','
>> at
>> com.datatorrent.lib.util.PojoUtils.compileExpression(PojoUtils.java:778)
>> at
>> com.datatorrent.lib.util.PojoUtils.compileExpression(PojoUtils.java:746)
>> at
>> com.datatorrent.lib.util.PojoUtils.createGetter(PojoUtils.java:603)
>> at
>> com.datatorrent.lib.util.PojoUtils.createGetter(PojoUtils.java:235)
>> at
>> com.datatorrent.lib.util.PojoUtils.createGetter(PojoUtils.java:225)
>> at
>> org.apache.apex.malhar.lib.dedup.BoundedDedupOperator.activate(BoundedDedupOperator.java:121)
>> at com.datatorrent.stram.engine.Node.activate(Node.java:644)
>> at
>> com.datatorrent.stram.engine.GenericNode.activate(GenericNode.java:212)
>> at
>> com.datatorrent.stram.engine.StreamingContainer.setupNode(StreamingContainer.java:1364)
>> at
>> com.datatorrent.stram.engine.StreamingContainer.access$100(StreamingContainer.java:129)
>> at
>> com.datatorrent.stram.engine.StreamingContainer$2.run(StreamingContainer.java:1413)
>>
>>
>>
>>
>>
>> --
>> Sent from: http://apache-apex-users-list.78494.x6.nabble.com/
>> <http://apache-apex-users-list.78494.x6.nabble.com/>
>
>