本文整理了Java中org.apache.calcite.rex.RexBuilder.makeBinaryLiteral
方法的一些代码示例,展示了RexBuilder.makeBinaryLiteral
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RexBuilder.makeBinaryLiteral
方法的具体详情如下:
包路径:org.apache.calcite.rex.RexBuilder
类名称:RexBuilder
方法名:makeBinaryLiteral
[英]Creates a byte array literal.
[中]创建字节数组文本。
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testBinarySubstring() throws Exception {
check((rexBuilder, executor) -> {
final List<RexNode> reducedValues = new ArrayList<>();
// hello world! -> 48656c6c6f20776f726c6421
final RexLiteral binaryHello =
rexBuilder.makeBinaryLiteral(
new ByteString("Hello world!".getBytes(UTF_8)));
final RexNode plus =
rexBuilder.makeCall(SqlStdOperatorTable.PLUS,
rexBuilder.makeExactLiteral(BigDecimal.ONE),
rexBuilder.makeExactLiteral(BigDecimal.ONE));
RexLiteral four = rexBuilder.makeExactLiteral(BigDecimal.valueOf(4));
final RexNode substring =
rexBuilder.makeCall(SqlStdOperatorTable.SUBSTRING,
binaryHello, plus, four);
executor.reduce(rexBuilder, ImmutableList.of(substring, plus),
reducedValues);
assertThat(reducedValues.size(), equalTo(2));
assertThat(reducedValues.get(0), instanceOf(RexLiteral.class));
assertThat(((RexLiteral) reducedValues.get(0)).getValue2().toString(),
equalTo((Object) "656c6c6f")); // substring('Hello world!, 2, 4)
assertThat(reducedValues.get(1), instanceOf(RexLiteral.class));
assertThat(((RexLiteral) reducedValues.get(1)).getValue2(),
equalTo((Object) 2L));
});
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testBinarySubstring() throws Exception {
check((rexBuilder, executor) -> {
final List<RexNode> reducedValues = new ArrayList<>();
// hello world! -> 48656c6c6f20776f726c6421
final RexLiteral binaryHello =
rexBuilder.makeBinaryLiteral(
new ByteString("Hello world!".getBytes(UTF_8)));
final RexNode plus =
rexBuilder.makeCall(SqlStdOperatorTable.PLUS,
rexBuilder.makeExactLiteral(BigDecimal.ONE),
rexBuilder.makeExactLiteral(BigDecimal.ONE));
RexLiteral four = rexBuilder.makeExactLiteral(BigDecimal.valueOf(4));
final RexNode substring =
rexBuilder.makeCall(SqlStdOperatorTable.SUBSTRING,
binaryHello, plus, four);
executor.reduce(rexBuilder, ImmutableList.of(substring, plus),
reducedValues);
assertThat(reducedValues.size(), equalTo(2));
assertThat(reducedValues.get(0), instanceOf(RexLiteral.class));
assertThat(((RexLiteral) reducedValues.get(0)).getValue2().toString(),
equalTo((Object) "656c6c6f")); // substring('Hello world!, 2, 4)
assertThat(reducedValues.get(1), instanceOf(RexLiteral.class));
assertThat(((RexLiteral) reducedValues.get(1)).getValue2(),
equalTo((Object) 2L));
});
}
代码示例来源:origin: Qihoo360/Quicksql
return makeBinaryLiteral(
padRight((ByteString) value, type.getPrecision()));
case VARBINARY:
literal = makeBinaryLiteral((ByteString) value);
if (allowCast) {
return makeCast(type, literal);
代码示例来源:origin: org.apache.calcite/calcite-core
return makeBinaryLiteral(
padRight((ByteString) value, type.getPrecision()));
case VARBINARY:
literal = makeBinaryLiteral((ByteString) value);
if (allowCast) {
return makeCast(type, literal);
代码示例来源:origin: Qihoo360/Quicksql
return rexBuilder.makeBinaryLiteral(byteString);
case SYMBOL:
return rexBuilder.makeFlag(literal.getValueAs(Enum.class));
代码示例来源:origin: org.apache.calcite/calcite-core
return rexBuilder.makeBinaryLiteral(byteString);
case SYMBOL:
return rexBuilder.makeFlag(literal.getValueAs(Enum.class));
内容来源于网络,如有侵权,请联系作者删除!