@Override public Void visitCall(CallExpression call, Void context) { builder.add(call); for (RowExpression argument : call.getArguments()) { argument.accept(this, context); } return null; }
@Override public Void visitCall(CallExpression call, Context context) { for (RowExpression rowExpression : call.getArguments()) { rowExpression.accept(this, context); } return null; }
@Override public RowExpression visitCall(CallExpression call, Void context) { return new CallExpression(call.getSignature(), targetType, call.getArguments()); }
@Override public RowExpression visitCall(CallExpression call, Void context) { return new CallExpression( call.getSignature(), call.getType(), call.getArguments().stream() .map(expression -> expression.accept(this, context)) .collect(toImmutableList())); }
public static List<RowExpression> flattenNestedCallArgs(CallExpression call) { String callName = call.getSignature().getName(); ImmutableList.Builder<RowExpression> newArguments = ImmutableList.builder(); for (RowExpression argument : call.getArguments()) { if (argument instanceof CallExpression && callName.equals(((CallExpression) argument).getSignature().getName())) { // same call type, so flatten the args newArguments.addAll(flattenNestedCallArgs((CallExpression) argument)); } else { newArguments.add(argument); } } return newArguments.build(); }
@Override public Boolean visitCall(CallExpression call, Void context) { Signature signature = call.getSignature(); if (registry.isRegistered(signature) && !registry.getScalarFunctionImplementation(signature).isDeterministic()) { return false; } return call.getArguments().stream() .allMatch(expression -> expression.accept(this, context)); }
private CallExpression rewriteCast(CallExpression call) if (call.getArguments().get(0) instanceof CallExpression) { CallExpression innerCall = (CallExpression) call.getArguments().get(0); if (innerCall.getSignature().getName().equals("json_parse")) { checkArgument(innerCall.getType().equals(JSON)); checkArgument(innerCall.getArguments().size() == 1); TypeSignature returnType = call.getSignature().getReturnType(); if (returnType.getBase().equals(ARRAY)) { ImmutableList.of(parseTypeSignature(VARCHAR))), call.getType(), innerCall.getArguments()); ImmutableList.of(parseTypeSignature(VARCHAR))), call.getType(), innerCall.getArguments()); ImmutableList.of(parseTypeSignature(VARCHAR))), call.getType(), innerCall.getArguments()); registry.getCoercion(call.getArguments().get(0).getType(), call.getType()), call.getType(), call.getArguments());
checkState(call.getArguments().size() == 3, "IF function should have 3 arguments. Get " + call.getArguments().size()); RowExpression optimizedOperand = call.getArguments().get(0).accept(this, context); if (optimizedOperand instanceof ConstantExpression) { ConstantExpression constantOperand = (ConstantExpression) optimizedOperand; checkState(constantOperand.getType().equals(BOOLEAN), "Operand of IF function should be BOOLEAN type. Get type " + constantOperand.getType().getDisplayName()); if (Boolean.TRUE.equals(constantOperand.getValue())) { return call.getArguments().get(1).accept(this, context); return call.getArguments().get(2).accept(this, context); List<RowExpression> arguments = call.getArguments().stream() .map(argument -> argument.accept(this, null)) .collect(toImmutableList()); checkState(call.getArguments().size() >= 1, BIND + " function should have at least 1 argument. Got " + call.getArguments().size()); for (RowExpression argument : call.getArguments()) { RowExpression optimizedArgument = argument.accept(this, context); if (!(optimizedArgument instanceof ConstantExpression)) { case DEREFERENCE: case ROW_CONSTRUCTOR: { List<RowExpression> arguments = call.getArguments().stream() .map(argument -> argument.accept(this, null)) .collect(toImmutableList()); List<RowExpression> arguments = call.getArguments().stream() .map(argument -> argument.accept(this, context)) .collect(toImmutableList());
return ComparisonChain.start() .compare(leftCall.getSignature().toString(), rightCall.getSignature().toString()) .compare(leftCall.getArguments(), rightCall.getArguments(), argumentComparator) .result();
call.getSignature(), call.getType(), call.getArguments().stream() .map(expression -> expression.accept(this, context)) .collect(toImmutableList())); call.getSignature(), call.getType(), ROW_EXPRESSION_ORDERING.sortedCopy(call.getArguments())); false), call.getType(), swapPair(call.getArguments()));
Preconditions.checkArgument(clause instanceof CallExpression && ((CallExpression) clause).getSignature().getName().equals("WHEN")); RowExpression operand = ((CallExpression) clause).getArguments().get(0); RowExpression result = ((CallExpression) clause).getArguments().get(1);
registry); return generator.generateExpression(call.getSignature(), generatorContext, call.getType(), call.getArguments(), context.getOutputBlockVariable());
@Override public BytecodeNode visitCall(CallExpression call, Scope scope) { if (call.getSignature().getName().equals(TRY)) { checkState(call.getArguments().size() == 1, "try call expressions must have a single argument"); checkState(getOnlyElement(call.getArguments()) instanceof CallExpression, "try call expression argument must be a call expression"); tryExpressions.add((CallExpression) getOnlyElement(call.getArguments())); } for (RowExpression rowExpression : call.getArguments()) { rowExpression.accept(this, null); } return null; }
@Override public Void visitCall(CallExpression call, Void context) { builder.add(call); for (RowExpression argument : call.getArguments()) { argument.accept(this, context); } return null; }
@Override public RowExpression visitCall(CallExpression call, Void context) { return new CallExpression(call.getSignature(), targetType, call.getArguments()); }
public static List<RowExpression> flattenNestedCallArgs(CallExpression call) { String callName = call.getSignature().getName(); ImmutableList.Builder<RowExpression> newArguments = ImmutableList.builder(); for (RowExpression argument : call.getArguments()) { if (argument instanceof CallExpression && callName.equals(((CallExpression) argument).getSignature().getName())) { // same call type, so flatten the args newArguments.addAll(flattenNestedCallArgs((CallExpression) argument)); } else { newArguments.add(argument); } } return newArguments.build(); }
@Override public Boolean visitCall(CallExpression call, Void context) { Signature signature = call.getSignature(); if (registry.isRegistered(signature) && !registry.getScalarFunctionImplementation(signature).isDeterministic()) { return false; } return call.getArguments().stream() .allMatch(expression -> expression.accept(this, context)); } }
return ComparisonChain.start() .compare(leftCall.getSignature().toString(), rightCall.getSignature().toString()) .compare(leftCall.getArguments(), rightCall.getArguments(), argumentComparator) .result();
call.getSignature(), call.getType(), call.getArguments().stream() .map(expression -> expression.accept(this, context)) .collect(toImmutableList())); call.getSignature(), call.getType(), ROW_EXPRESSION_ORDERING.sortedCopy(call.getArguments())); false), call.getType(), swapPair(call.getArguments()));
for (CallExpression tryExpression : tryExpressions) { Parameter session = arg("session", ConnectorSession.class); List<Parameter> blocks = toBlockParameters(getInputChannels(tryExpression.getArguments())); Parameter position = arg("position", int.class); Parameter wasNullVariable = arg("wasNull", boolean.class);