@Test public void testEvaluate() throws SQLException { Expression inputArg = LiteralExpression.newConstant( PInteger.INSTANCE.getSqlType(), PInteger.INSTANCE); Object returnValue = executeFunction(inputArg); assertEquals(Types.INTEGER, returnValue); }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression child = children.get(0); if (!child.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } int sqlType = child.getDataType().getCodec().decodeInt(ptr, child.getSortOrder()); try { byte[] externalIdTypeBytes = PInteger.INSTANCE.toBytes( PDataType.fromTypeId(sqlType).getResultSetSqlType()); ptr.set(externalIdTypeBytes); } catch (IllegalDataException e) { ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); } return true; }
ExternalSqlTypeIdFunction extends ScalarFunction { @Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression child = children.get(0); if (!child.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } int sqlType = child.getDataType().getCodec().decodeInt(ptr, child.getSortOrder()); try { byte[] externalIdTypeBytes = PInteger.INSTANCE.toBytes( PDataType.fromTypeId(sqlType).getResultSetSqlType()); ptr.set(externalIdTypeBytes); } catch (IllegalDataException e) { ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); } return true; } }
ExternalSqlTypeIdFunction extends ScalarFunction { @Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression child = children.get(0); if (!child.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } int sqlType = child.getDataType().getCodec().decodeInt(ptr, child.getSortOrder()); try { byte[] externalIdTypeBytes = PInteger.INSTANCE.toBytes( PDataType.fromTypeId(sqlType).getResultSetSqlType()); ptr.set(externalIdTypeBytes); } catch (IllegalDataException e) { ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); } return true; } ExternalSqlTypeIdFunction();  ExternalSqlTypeIdFunction(List<Expression> children); }
ExternalSqlTypeIdFunction extends ScalarFunction { @Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression child = children.get(0); if (!child.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } int sqlType = child.getDataType().getCodec().decodeInt(ptr, child.getSortOrder()); try { byte[] externalIdTypeBytes = PInteger.INSTANCE.toBytes( PDataType.fromTypeId(sqlType).getResultSetSqlType()); ptr.set(externalIdTypeBytes); } catch (IllegalDataException e) { ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); } return true; } ExternalSqlTypeIdFunction();  ExternalSqlTypeIdFunction(List<Expression> children); @Override boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr); @Override PDataType getDataType(); @Override String getName(); }
ExternalSqlTypeIdFunction extends ScalarFunction { @Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression child = children.get(0); if (!child.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } int sqlType = child.getDataType().getCodec().decodeInt(ptr, child.getSortOrder()); try { byte[] externalIdTypeBytes = PInteger.INSTANCE.toBytes( PDataType.fromTypeId(sqlType).getResultSetSqlType()); ptr.set(externalIdTypeBytes); } catch (IllegalDataException e) { ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); } return true; } ExternalSqlTypeIdFunction();  ExternalSqlTypeIdFunction(List<Expression> children); @Override boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr); @Override PDataType getDataType(); @Override String getName(); static final String NAME; }