Block isNotNull = new Block(context)
.getVariable("cursor")
.push(channel)
.invokeInterface(RecordCursor.class, "getBoolean", boolean.class, int.class);
return typedByteCodeNode(new IfStatement(context, isNullCheck, isNull, isNotNull), boolean.class);
}
case BIGINT: {
Block isNull = new Block(context)
.putVariable("wasNull", true)
.pushJavaDefault(long.class);
Block isNotNull = new Block(context)
.getVariable("cursor")
.push(channel)
.invokeInterface(RecordCursor.class, "getLong", long.class, int.class);
return typedByteCodeNode(new IfStatement(context, isNullCheck, isNull, isNotNull), long.class);
}
case DOUBLE: {
Block isNull = new Block(context)
.putVariable("wasNull", true)
.pushJavaDefault(double.class);
Block isNotNull = new Block(context)
.getVariable("cursor")
.push(channel)
.invokeInterface(RecordCursor.class, "getDouble", double.class, int.class);
return typedByteCodeNode(new IfStatement(context, isNullCheck, isNull, isNotNull), double.class);
}
case VARCHAR: {
Block isNull = new Block(context)
.putVariable("wasNull", true)
.pushJavaDefault(Slice.class);
Block isNotNull = new Block(context)
.getVariable("cursor")
.push(channel)
.invokeInterface(RecordCursor.class, "getString", byte[].class, int.class)
.invokeStatic(Slices.class, "wrappedBuffer", Slice.class, byte[].class);
return typedByteCodeNode(new IfStatement(context, isNullCheck, isNull, isNotNull), Slice.class);
}
default:
throw new UnsupportedOperationException("not yet implemented: " + type);
}
}
else {
Block isNullCheck = new Block(context)
.setDescription(format("channel_%d.get%s()", channel, type))
.getVariable("channel_" + channel)
.invokeInterface(TupleReadable.class, "isNull", boolean.class);
switch (type) {
case BOOLEAN: {
Block isNull = new Block(context)
.putVariable("wasNull", true)
.pushJavaDefault(boolean.class);
Block isNotNull = new Block(context)
.getVariable("channel_" + channel)
.invokeInterface(TupleReadable.class, "getBoolean", boolean.class);
return typedByteCodeNode(new IfStatement(context, isNullCheck, isNull, isNotNull), boolean.class);
}
case BIGINT: {
Block isNull = new Block(context)
.putVariable("wasNull", true)
.pushJavaDefault(long.class);
Block isNotNull = new Block(context)
.getVariable("channel_" + channel)
.invokeInterface(TupleReadable.class, "getLong", long.class);
return typedByteCodeNode(new IfStatement(context, isNullCheck, isNull, isNotNull), long.class);
}
case DOUBLE: {
Block isNull = new Block(context)
.putVariable("wasNull", true)
.pushJavaDefault(double.class);
Block isNotNull = new Block(context)
.getVariable("channel_" + channel)
.invokeInterface(TupleReadable.class, "getDouble", double.class);
return typedByteCodeNode(new IfStatement(context, isNullCheck, isNull, isNotNull), double.class);
}
case VARCHAR: {
Block isNull = new Block(context)
.putVariable("wasNull", true)
.pushJavaDefault(Slice.class);
Block isNotNull = new Block(context)
.getVariable("channel_" + channel)
.invokeInterface(TupleReadable.class, "getSlice", Slice.class);
return typedByteCodeNode(new IfStatement(context, isNullCheck, isNull, isNotNull), Slice.class);
}
default:
throw new UnsupportedOperationException("not yet implemented: " + type);
}
}