// Plan to test when result type is ByteArray and casting is requested
// for example casting of values coming out of map lookup.
POCast opWithInputTypeAsBA = new POCast(new OperatorKey("", r.nextLong()), -1);
PhysicalPlan planToTestBACasts = constructPlan(opWithInputTypeAsBA);
TupleFactory tf = TupleFactory.getInstance();
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
plan.attachInput(t);
Map map = (Map) t.get(0);
Result res = op.getNext(map);
//System.out.println(res.result + " : " + t);
assertEquals(map, res.result);
planToTestBACasts.attachInput(t);
res = opWithInputTypeAsBA.getNext(map);
assertEquals(map, res.result);
}
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
plan.attachInput(t);
Result res = op.getNext(t);
assertEquals(POStatus.STATUS_ERR, res.returnStatus);
}
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
plan.attachInput(t);
DataBag b = null;
Result res = op.getNext(b);
assertEquals(POStatus.STATUS_ERR, res.returnStatus);
}
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
Integer i = null;
Result res = op.getNext(i);
assertEquals(POStatus.STATUS_ERR, res.returnStatus);
}
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
Long i = null;
Result res = op.getNext(i);
assertEquals(POStatus.STATUS_ERR, res.returnStatus);
}
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
Float i = null;
Result res = op.getNext(i);
assertEquals(POStatus.STATUS_ERR, res.returnStatus);
}
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
Double i = null;
Result res = op.getNext(i);
assertEquals(POStatus.STATUS_ERR, res.returnStatus);
}
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
String i = null;
Result res = op.getNext(i);
assertEquals(POStatus.STATUS_ERR, res.returnStatus);
}
{
Tuple t = tf.newTuple();
t.append(GenRandomData.genRandMap(r, 10));
plan.attachInput(t);
DataByteArray i = null;
Result res = op.getNext(i);
assertEquals(POStatus.STATUS_ERR, res.returnStatus);