public static boolean includesIdField(Collection<FieldPath> projected) { return Iterables.tryFind(projected, path -> Preconditions.checkNotNull(path).equals(ID_FIELD)).isPresent(); }
/** * Returns an {@link Optional} containing the first element in this fluent iterable that satisfies * the given predicate, if such an element exists. * * <p><b>Warning:</b> avoid using a {@code predicate} that matches {@code null}. If {@code null} * is matched in this fluent iterable, a {@link NullPointerException} will be thrown. * * <p><b>{@code Stream} equivalent:</b> {@code stream.filter(predicate).findFirst()}. */ public final Optional<E> firstMatch(Predicate<? super E> predicate) { return Iterables.tryFind(getDelegate(), predicate); }
public static boolean includesIdField(Collection<FieldPath> projected) { return Iterables.tryFind(projected, new Predicate<FieldPath>() { @Override public boolean apply(FieldPath path) { return Preconditions.checkNotNull(path).equals(ID_FIELD); } }).isPresent(); }
/** * Return true if list of schema path has star column. * @param projected * @return True if the list of {@link org.apache.drill.common.expression.SchemaPath}s has star column. */ public static boolean isStarQuery(Collection<SchemaPath> projected) { return Iterables.tryFind(Preconditions.checkNotNull(projected, COL_NULL_ERROR), new Predicate<SchemaPath>() { @Override public boolean apply(SchemaPath path) { return Preconditions.checkNotNull(path).equals(SchemaPath.STAR_COLUMN); } }).isPresent(); }
@Override public boolean isStarQuery() { return super.isStarQuery() || Iterables.tryFind(getColumns(), new Predicate<SchemaPath>() { private final SchemaPath COLUMNS = SchemaPath.getSimplePath("columns"); @Override public boolean apply(@Nullable SchemaPath path) { return path.equals(COLUMNS); } }).isPresent(); }
@Override public boolean isStarQuery() { if(settings.isUseRepeatedVarChar()) { return super.isStarQuery() || Iterables.tryFind(getColumns(), new Predicate<SchemaPath>() { @Override public boolean apply(@Nullable SchemaPath path) { return path.equals(RepeatedVarCharOutput.COLUMNS); } }).isPresent(); } return super.isStarQuery(); }
Optional<LogicalExpression> nonNullExpr = Iterables.tryFind(allExpressions, new Predicate<LogicalExpression>() { @Override