本文整理汇总了Java中org.apache.calcite.rex.RexLiteral.getTypeName方法的典型用法代码示例。如果您正苦于以下问题:Java RexLiteral.getTypeName方法的具体用法?Java RexLiteral.getTypeName怎么用?Java RexLiteral.getTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.rex.RexLiteral
的用法示例。
在下文中一共展示了RexLiteral.getTypeName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: timestampValue
import org.apache.calcite.rex.RexLiteral; //导入方法依赖的package包/类
private Calendar timestampValue(RexLiteral timeLiteral) {
switch (timeLiteral.getTypeName()) {
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
final TimeZone tz = TimeZone.getTimeZone(this.timeZone);
return Util.calendar(
SqlFunctions.timestampWithLocalTimeZoneToTimestamp(
timeLiteral.getValueAs(Long.class), tz));
case TIMESTAMP:
return Util.calendar(timeLiteral.getValueAs(Long.class));
case DATE:
// Cast date to timestamp with local time zone
final DateString d = timeLiteral.getValueAs(DateString.class);
return Util.calendar(d.getMillisSinceEpoch());
default:
throw Util.unexpected(timeLiteral.getTypeName());
}
}
示例2: isLimit0
import org.apache.calcite.rex.RexLiteral; //导入方法依赖的package包/类
private boolean isLimit0(RexNode fetch) {
if (fetch != null && fetch.isA(SqlKind.LITERAL)) {
RexLiteral l = (RexLiteral) fetch;
switch (l.getTypeName()) {
case BIGINT:
case INTEGER:
case DECIMAL:
if (((long) l.getValue2()) == 0) {
return true;
}
}
}
return false;
}
示例3: isLimit0
import org.apache.calcite.rex.RexLiteral; //导入方法依赖的package包/类
private static boolean isLimit0(RexNode fetch) {
if (fetch != null && fetch.isA(SqlKind.LITERAL)) {
RexLiteral l = (RexLiteral) fetch;
switch (l.getTypeName()) {
case BIGINT:
case INTEGER:
case DECIMAL:
if (((long) l.getValue2()) == 0) {
return true;
}
}
}
return false;
}
示例4: visitCall
import org.apache.calcite.rex.RexLiteral; //导入方法依赖的package包/类
@Override
public SchemaPath visitCall(RexCall call) {
if(call.getOperator().getSyntax() != SqlSyntax.SPECIAL || call.getOperator() != SqlStdOperatorTable.ITEM){
return null;
}
LogicalExpression logExpr = call.getOperands().get(0).accept(this);
if (!(logExpr instanceof SchemaPath)) {
return (SchemaPath) logExpr;
}
SchemaPath left = (SchemaPath) logExpr;
final RexLiteral literal = (RexLiteral) call.getOperands().get(1);
switch(literal.getTypeName()){
case DECIMAL:
case INTEGER:
switch(indexMode){
case ALLOW:
return left.getChild(((BigDecimal)literal.getValue()).intValue());
case SKIP:
return left;
case DISALLOW:
default:
return null;
}
case CHAR:
return left.getChild(literal.getValue2().toString());
default:
// fall through
}
return null;
}
示例5: toString
import org.apache.calcite.rex.RexLiteral; //导入方法依赖的package包/类
private String toString(boolean like, RexLiteral literal) {
String value = null;
SqlTypeName litSqlType = literal.getTypeName();
if (SqlTypeName.NUMERIC_TYPES.contains(litSqlType)) {
value = literal.getValue().toString();
} else if (litSqlType == SqlTypeName.CHAR) {
value = ((NlsString) literal.getValue()).getValue();
if (like) {
value = value.replaceAll("%", "*");
}
value = searchEscape(value);
}
return value;
}