Hi it's me again,

I know it's been mentioned to me before that the examples in 
?https://github.com/idleft/asterix-udf-template/ are for template-purposes and 
not meant to actually be used, however, I hope somebody can shed light upon 
this behaviour that I can't wrap my head around.


I am running the sample sentiment function, 
https://github.com/idleft/asterix-udf-template/blob/master/src/main/java/org/apache/asterix/external/library/SentimentFunction.java.


The only change I've made from the original code has been changing the casting 
from JString to JLong on line 40 as the ID from tweets saved in AsterixDB are 
numbers (and will provoke an error if treated as JStrings).


[cid:cac38053-f399-4eaf-9c40-f745d4bc2ef5]


When running the UDF on my dataset of tweets it only works as expected on the 
first tweet?, for the rest of them it also changes the value of the text-field 
(which should equal the text in the original tweet), like this:


[cid:127092ca-c89e-4ae1-8696-f752cc2d991c]

The SQL++ command I am using to produce these results is


SELECT testlib#getSentiment(t) AS ProcessedTweet FROM (SELECT id, text FROM 
Tweets) AS t;


Looking at the code, the UDF gets the text-value on line 41 and populates the 
text-field on the result-object on line 46. Can somebody give me some hints 
about why the text-field is set to the same value as the sentiment-field?


Best wishes,

Torsten

Reply via email to