this.sources = Functions.generate(rowType.getFieldCount(), i -> ImmutableIntList.of(offset + i)); this.trivial = true;
/** Whether to attempt to merge consecutive {@link Project} operators. * * <p>The default implementation returns {@code true}; * sub-classes may disable merge by overriding to return {@code false}. */ @Experimental protected boolean shouldMergeProject() { return true; }
@SemiStrict public static String eval(@Parameter(name = "s") String s) { if (s.length() == 8) { return null; } return s; } }
public Function2<TKey, LazySource<TSource>, TResult> resultSelector( Function2<TKey, TOrigAccumulate, TResult> resultSelector) { return (groupByKey, lazySource) -> { final TOrigAccumulate accumulator = accumulatorInitializer.apply(); for (SourceSorter<TOrigAccumulate, TSource, TSortKey> acc : sourceSorters) { acc.sortAndAccumulate(lazySource, accumulator); } return resultSelector.apply(groupByKey, accumulator); }; }
ResultSetEnumerator( ResultSet resultSet, Function1<ResultSet, Function0<T>> rowBuilderFactory) { this.resultSet = resultSet; this.rowBuilder = rowBuilderFactory.apply(resultSet); }
/** Returns whether there is an element in {@code list} for which * {@code predicate} is true. */ public static <E> boolean exists(List<? extends E> list, Predicate1<E> predicate) { for (E e : list) { if (predicate.apply(e)) { return true; } } return false; }
@Override public boolean equals(Object obj) { //noinspection unchecked return obj == this || obj instanceof Wrapped && comparer.equal(element, ((Wrapped<T>) obj).element); }
/** * Returns an {@link EqualityComparer} that uses a selector function. */ public static <T, T2> EqualityComparer<T> selectorComparer( Function1<T, T2> selector) { return new SelectorEqualityComparer<>(selector); }
public void run() { for (int i = 0; i < repeat; i++) { function.apply(statistician); } statistician.printDurations(); }
/** * Returns whether the dialect supports VALUES in a sub-query with * and an "AS t(column, ...)" values to define column names. * * <p>Currently, only Oracle does not. For this, we generate "SELECT v0 AS c0, * v1 AS c1 ... UNION ALL ...". We may need to refactor this method when we * support VALUES for other dialects. */ @Experimental public boolean supportsAliasedValues() { return false; }
public String eval(@Parameter(name = "A", optional = false) Integer a, @Parameter(name = "B", optional = true) Integer b, @Parameter(name = "C", optional = false) Integer c, @Parameter(name = "D", optional = true) Integer d, @Parameter(name = "E", optional = true) Integer e) { return "{a: " + a + ", b: " + b + ", c: " + c + ", d: " + d + ", e: " + e + "}"; } }
public void run() { for (int i = 0; i < repeat; i++) { function.apply(statistician); } statistician.printDurations(); }
/** * Mix-in interface for {@link SqlNode} that allows DDL commands to be * executed directly. * * <p>NOTE: Subject to change without notice. */ @Experimental public interface SqlExecutableStatement { void execute(CalcitePrepare.Context context); }
/** * Creates child visitor. It is used to traverse nested class declarations. * * @return new {@code Visitor} that is used to optimize class declarations */ protected ClassDeclarationFinder goDeeper() { return childFactory.apply(this); } }
/** * Returns whether the dialect supports VALUES in a sub-query with * and an "AS t(column, ...)" values to define column names. * * <p>Currently, only Oracle does not. For this, we generate "SELECT v0 AS c0, * v1 AS c1 ... UNION ALL ...". We may need to refactor this method when we * support VALUES for other dialects. */ @Experimental public boolean supportsAliasedValues() { return true; }