throws AlgebricksException {
final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
final ArrayBackedValueStorage abvsInner = new ArrayBackedValueStorage();
final DataOutput dOutInner = abvsInner.getDataOutput();
final SequenceBuilder sb = new SequenceBuilder();
final SequencePointable seq = (SequencePointable) SequencePointable.FACTORY.createPointable();
final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
final AbstractValueComparisonOperation aOp = new ValueEqComparisonOperation();
final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
final VoidPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable();
return new AbstractTaggedValueArgumentScalarEvaluator(args) {
@Override
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
try {
abvs.reset();
sb.reset(abvs);
TaggedValuePointable tvp1 = args[0];
TaggedValuePointable tvp2 = args[1];
if (tvp1.getTag() == ValueTag.SEQUENCE_TAG) {
tvp1.getValue(seq);
int seqLen = seq.getEntryCount();
for (int j = 0; j < seqLen; ++j) {
seq.getEntry(j, p);
tvp.set(p.getByteArray(), p.getStartOffset(), p.getLength());
if (FunctionHelper.compareTaggedValues(aOp, tvp, tvp2, dCtx)) {
abvsInner.reset();
dOutInner.write(ValueTag.XS_INTEGER_TAG);
dOutInner.writeLong(j + 1);