@Override public boolean isNullable() { return getChildren().get(0).isNullable(); } }
private void initialize() { String localeISOCode = getLiteralValue(1, String.class); Boolean useSpecialUpperCaseCollator = getLiteralValue(2, Boolean.class); Integer collatorStrength = getLiteralValue(3, Integer.class); Integer collatorDecomposition = getLiteralValue(4, Integer.class);
public CollationKeyFunction(List<Expression> children) throws SQLException { super(children); initialize(); }
private static byte[] callFunction(LiteralExpression inputStrLiteral, LiteralExpression localeIsoCodeLiteral, LiteralExpression upperCaseBooleanLiteral, LiteralExpression strengthLiteral, LiteralExpression decompositionLiteral) throws Exception { List<Expression> expressions = Lists.newArrayList((Expression) inputStrLiteral, (Expression) localeIsoCodeLiteral, (Expression) upperCaseBooleanLiteral, (Expression) strengthLiteral, (Expression) decompositionLiteral); Expression collationKeyFunction = new CollationKeyFunction(expressions); ImmutableBytesWritable ptr = new ImmutableBytesWritable(); boolean ret = collationKeyFunction.evaluate(null, ptr); byte[] result = ret ? (byte[]) collationKeyFunction.getDataType().toObject(ptr, collationKeyFunction.getSortOrder()) : null; return result; } }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = getChildren().get(0); if (!expression.evaluate(tuple, ptr)) { return false; } String inputString = (String) PVarchar.INSTANCE.toObject(ptr, expression.getSortOrder()); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey inputString: " + inputString); } if (inputString == null) { return true; } byte[] collationKeyByteArray = collator.getCollationKey(inputString).toByteArray(); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey bytes: " + VarBinaryFormatter.INSTANCE.format(collationKeyByteArray)); } ptr.set(collationKeyByteArray); return true; }
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); initialize(); }
private void initialize() { String localeISOCode = getLiteralValue(1, String.class); Boolean useSpecialUpperCaseCollator = getLiteralValue(2, Boolean.class); Integer collatorStrength = getLiteralValue(3, Integer.class); Integer collatorDecomposition = getLiteralValue(4, Integer.class);
@Override public boolean isNullable() { return getChildren().get(0).isNullable(); } }
public CollationKeyFunction(List<Expression> children) throws SQLException { super(children); initialize(); }
private void initialize() { String localeISOCode = getLiteralValue(1, String.class); Boolean useSpecialUpperCaseCollator = getLiteralValue(2, Boolean.class); Integer collatorStrength = getLiteralValue(3, Integer.class); Integer collatorDecomposition = getLiteralValue(4, Integer.class);
@Override public boolean isNullable() { return getChildren().get(0).isNullable(); } }
public CollationKeyFunction(List<Expression> children) throws SQLException { super(children); initialize(); }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = getChildren().get(0); if (!expression.evaluate(tuple, ptr)) { return false; } String inputString = (String) PVarchar.INSTANCE.toObject(ptr, expression.getSortOrder()); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey inputString: " + inputString); } if (inputString == null) { return true; } byte[] collationKeyByteArray = collator.getCollationKey(inputString).toByteArray(); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey bytes: " + VarBinaryFormatter.INSTANCE.format(collationKeyByteArray)); } ptr.set(collationKeyByteArray); return true; }
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); initialize(); }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = getChildren().get(0); if (!expression.evaluate(tuple, ptr)) { return false; } String inputString = (String) PVarchar.INSTANCE.toObject(ptr, expression.getSortOrder()); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey inputString: " + inputString); } if (inputString == null) { return true; } byte[] collationKeyByteArray = collator.getCollationKey(inputString).toByteArray(); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey bytes: " + VarBinaryFormatter.INSTANCE.format(collationKeyByteArray)); } ptr.set(collationKeyByteArray); return true; }
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); initialize(); }