setState(89); match(CParen); ((ConvertCallContext)_localctx).e = FunctionCallFactory.createConvert((((ConvertCallContext)_localctx).Convert!=null?((ConvertCallContext)_localctx).Convert.getText():null), (((ConvertCallContext)_localctx).String!=null?((ConvertCallContext)_localctx).String.getText():null), ((ConvertCallContext)_localctx).expression.e, pos(((ConvertCallContext)_localctx).Convert));
case "convert_to": { if (args.get(1) instanceof QuotedString) { return FunctionCallFactory.createConvert(functionName, ((QuotedString) args.get(1)).value, args.get(0), ExpressionPosition.UNKNOWN);
private List<NamedExpression> getExpressionList() { if (popConfig.getExprs() != null) { return popConfig.getExprs(); } final List<NamedExpression> exprs = Lists.newArrayList(); for (final MaterializedField field : incoming.getSchema()) { String fieldName = field.getName(); if (Types.isComplex(field.getType()) || Types.isRepeated(field.getType())) { final LogicalExpression convertToJson = FunctionCallFactory.createConvert(ConvertExpression.CONVERT_TO, "JSON", SchemaPath.getSimplePath(fieldName), ExpressionPosition.UNKNOWN); final String castFuncName = FunctionReplacementUtils.getCastFunc(MinorType.VARCHAR); final List<LogicalExpression> castArgs = Lists.newArrayList(); castArgs.add(convertToJson); //input_expr // implicitly casting to varchar, since we don't know actual source length, cast to undefined length, which will preserve source length castArgs.add(new ValueExpressions.LongExpression(Types.MAX_VARCHAR_LENGTH, null)); final FunctionCall castCall = new FunctionCall(castFuncName, castArgs, ExpressionPosition.UNKNOWN); exprs.add(new NamedExpression(castCall, new FieldReference(fieldName))); } else { exprs.add(new NamedExpression(SchemaPath.getSimplePath(fieldName), new FieldReference(fieldName))); } } return exprs; }
setState(89); match(CParen); ((ConvertCallContext)_localctx).e = FunctionCallFactory.createConvert((((ConvertCallContext)_localctx).Convert!=null?((ConvertCallContext)_localctx).Convert.getText():null), (((ConvertCallContext)_localctx).String!=null?((ConvertCallContext)_localctx).String.getText():null), ((ConvertCallContext)_localctx).expression.e, pos(((ConvertCallContext)_localctx).Convert));