RelDataType type = field.getValue(); SqlNode selectItem = oldSelectItems.get(p0); for (int p1 : Util.skip(source)) { final Map.Entry<String, RelDataType> field1 = oldFields.get(p1); final SqlNode selectItem1 = oldSelectItems.get(p1);
public void onMatch(RelOptRuleCall call) { final HiveUnion topUnion = call.rel(0); final HiveUnion bottomUnion; if (call.rel(2) instanceof HiveUnion) { bottomUnion = call.rel(2); } else if (call.rel(1) instanceof HiveUnion) { bottomUnion = call.rel(1); } else { return; } List<RelNode> inputs = new ArrayList<>(); if (call.rel(2) instanceof HiveUnion) { for (int i = 0; i < topUnion.getInputs().size(); i++) { if (i != 1) { inputs.add(topUnion.getInput(i)); } } inputs.addAll(bottomUnion.getInputs()); } else { inputs.addAll(bottomUnion.getInputs()); inputs.addAll(Util.skip(topUnion.getInputs())); } HiveUnion newUnion = (HiveUnion) topUnion.copy( topUnion.getTraitSet(), inputs, true); call.transformTo(newUnion); } }
} else { inputs.addAll(bottomHiveIntersect.getInputs()); inputs.addAll(Util.skip(topHiveIntersect.getInputs()));
} else { inputs.addAll(bottomHiveIntersect.getInputs()); inputs.addAll(Util.skip(topHiveIntersect.getInputs()));
for (SqlValidatorScope.Step p : Util.skip(resolve.path.steps())) { type = type.getFieldList().get(p.i).getType();
public final List<String> suffix() { return Util.skip(identifier.names, prefixLength); } }
/** Returns all but the first element of a list. */ public static <E> List<E> skip(List<E> list) { return skip(list, 1); }
public final List<String> suffix() { return Util.skip(identifier.names, prefixLength); } }
/** Returns all but the first element of a list. */ public static <E> List<E> skip(List<E> list) { return skip(list, 1); }
private static boolean couldImplement(Method handlerMethod, Method method) { if (!handlerMethod.getName().equals(method.getName()) || (handlerMethod.getModifiers() & Modifier.STATIC) != 0 || (handlerMethod.getModifiers() & Modifier.PUBLIC) == 0) { return false; } final Class<?>[] parameterTypes1 = handlerMethod.getParameterTypes(); final Class<?>[] parameterTypes = method.getParameterTypes(); return parameterTypes1.length == parameterTypes.length + 2 && RelNode.class.isAssignableFrom(parameterTypes1[0]) && RelMetadataQuery.class == parameterTypes1[1] && Arrays.asList(parameterTypes) .equals(Util.skip(Arrays.asList(parameterTypes1), 2)); }
@Override protected void matched(List<String> prefixNames, List<String> names) { matchedNames = ImmutableList.copyOf( Util.startsWith(names, prefixNames) ? Util.skip(names, prefixNames.size()) : names); }
@Override protected void matched(List<String> prefixNames, List<String> names) { matchedNames = ImmutableList.copyOf( Util.startsWith(names, prefixNames) ? Util.skip(names, prefixNames.size()) : names); }
public PrecedenceClimbingParser copy(int start, Predicate<Token> predicate) { final List<Token> tokens = new ArrayList<>(); for (Token token : Util.skip(all(), start)) { if (predicate.test(token)) { break; } tokens.add(token.copy()); } return new PrecedenceClimbingParser(tokens); }
public PrecedenceClimbingParser copy(int start, Predicate<Token> predicate) { final List<Token> tokens = new ArrayList<>(); for (Token token : Util.skip(all(), start)) { if (predicate.test(token)) { break; } tokens.add(token.copy()); } return new PrecedenceClimbingParser(tokens); }
private static SqlTypeExplicitPrecedenceList numeric(SqlTypeName typeName) { int i = getListPosition(typeName, COMPACT_NUMERIC_TYPES); return new SqlTypeExplicitPrecedenceList( Util.skip(COMPACT_NUMERIC_TYPES, i)); }
private static SqlTypeExplicitPrecedenceList numeric(SqlTypeName typeName) { int i = getListPosition(typeName, COMPACT_NUMERIC_TYPES); return new SqlTypeExplicitPrecedenceList( Util.skip(COMPACT_NUMERIC_TYPES, i)); }
private Expression implementRecurse(RexToLixTranslator translator, List<RexNode> operands, NullAs nullAs) { if (operands.size() == 1) { return translator.translate(operands.get(0)); } else { return Expressions.condition( translator.translate(operands.get(0), NullAs.IS_NULL), translator.translate(operands.get(0), nullAs), implementRecurse(translator, Util.skip(operands), nullAs)); } } }
private Expression implementRecurse(RexToLixTranslator translator, List<RexNode> operands, NullAs nullAs) { if (operands.size() == 1) { return translator.translate(operands.get(0)); } else { return Expressions.condition( translator.translate(operands.get(0), NullAs.IS_NULL), translator.translate(operands.get(0), nullAs), implementRecurse(translator, Util.skip(operands), nullAs)); } } }
/** * Returns a list of calls to aggregate functions together with their output * field names. * * @return list of calls to aggregate functions and their output field names */ public List<Pair<AggregateCall, String>> getNamedAggCalls() { final int offset = getGroupCount() + getIndicatorCount(); return Pair.zip(aggCalls, Util.skip(getRowType().getFieldNames(), offset)); }
/** * Returns a list of calls to aggregate functions together with their output * field names. * * @return list of calls to aggregate functions and their output field names */ public List<Pair<AggregateCall, String>> getNamedAggCalls() { final int offset = getGroupCount() + getIndicatorCount(); return Pair.zip(aggCalls, Util.skip(getRowType().getFieldNames(), offset)); }