use of org.apache.flink.table.planner.functions.sql.FlinkSqlTimestampFunction in project flink by apache.
the class SqlFunctionConverter method visitCall.
@Override
public RexNode visitCall(RexCall call) {
SqlOperator operator = call.getOperator();
List<RexNode> operands = call.getOperands();
SqlOperator convertedOp = convertOperator(operator);
final boolean[] update = null;
if (convertedOp instanceof SqlCastFunction) {
RelDataType type = call.getType();
return builder.makeCall(type, convertedOp, visitList(operands, update));
} else {
if (convertedOp instanceof FlinkSqlTimestampFunction) {
// flink's current_timestamp has different type from hive's, convert it to a literal
Timestamp currentTS = ((HiveParser.HiveParserSessionState) SessionState.get()).getHiveParserCurrentTS();
HiveShim hiveShim = HiveParserUtils.getSessionHiveShim();
try {
return HiveParserRexNodeConverter.convertConstant(new ExprNodeConstantDesc(hiveShim.toHiveTimestamp(currentTS)), cluster);
} catch (SemanticException e) {
throw new FlinkHiveException(e);
}
}
return builder.makeCall(convertedOp, visitList(operands, update));
}
}
Aggregations