本文整理了Java中org.apache.calcite.linq4j.Enumerable.enumerator()
方法的一些代码示例,展示了Enumerable.enumerator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Enumerable.enumerator()
方法的具体详情如下:
包路径:org.apache.calcite.linq4j.Enumerable
类名称:Enumerable
方法名:enumerator
暂无
代码示例来源:origin: apache/incubator-druid
final Supplier<Sequence<Object[]>> resultsSupplier = () -> {
final Enumerable enumerable = theRel.bind(dataContext);
final Enumerator enumerator = enumerable.enumerator();
return Sequences.withBaggage(new BaseSequence<>(
new BaseSequence.IteratorMaker<Object[], EnumeratorIterator<Object[]>>()
代码示例来源:origin: org.apache.calcite/calcite-linq4j
public Enumerator<TResult> enumerator() {
return new MergeJoinEnumerator<>(outer.enumerator(),
inner.enumerator(), outerKeySelector, innerKeySelector,
resultSelector);
}
};
代码示例来源:origin: Qihoo360/Quicksql
@SuppressWarnings("unchecked")
public Enumerator<T> enumerator() {
return (Enumerator<T>) enumerable.enumerator();
}
};
代码示例来源:origin: org.apache.calcite/calcite-linq4j
public Enumerator<TSource> enumerator() {
final Enumerator<TSource> enumerator = source.enumerator();
return EnumerableDefaults.where(enumerator, predicate);
}
};
代码示例来源:origin: org.apache.calcite/calcite-linq4j
public Enumerator<T2> enumerator() {
return new CastingEnumerator<>(source.enumerator(), clazz);
}
};
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Returns the first element of a sequence. (Defined
* by Enumerable.)
*/
public static <TSource> TSource first(Enumerable<TSource> enumerable) {
try (Enumerator<TSource> os = enumerable.enumerator()) {
if (os.moveNext()) {
return os.current();
}
throw new NoSuchElementException();
}
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/** Default implementation of {@link ExtendedEnumerable#into(Collection)}. */
public static <T, C extends Collection<? super T>> C into(
Enumerable<T> source, C sink) {
try (Enumerator<T> enumerator = source.enumerator()) {
while (enumerator.moveNext()) {
T t = enumerator.current();
sink.add(t);
}
}
return sink;
}
代码示例来源:origin: Qihoo360/Quicksql
public <T> Enumerator<T> executeQuery(Queryable<T> queryable) {
try {
CalciteStatement statement = (CalciteStatement) createStatement();
CalcitePrepare.CalciteSignature<T> signature =
statement.prepare(queryable);
return enumerable(statement.handle, signature).enumerator();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
public <T> Enumerator<T> executeQuery(Queryable<T> queryable) {
try {
CalciteStatement statement = (CalciteStatement) createStatement();
CalcitePrepare.CalciteSignature<T> signature =
statement.prepare(queryable);
return enumerable(statement.handle, signature).enumerator();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: Qihoo360/Quicksql
public Node implement(final InterpreterImplementor implementor) {
return () -> {
final Sink sink =
implementor.relSinks.get(EnumerableBindable.this).get(0);
final Enumerable<Object[]> enumerable = bind(implementor.dataContext);
final Enumerator<Object[]> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
sink.send(Row.asCopy(enumerator.current()));
}
};
}
代码示例来源:origin: org.apache.calcite/calcite-core
public Enumerator<Object> enumerator() {
final DataContext dataContext =
Schemas.createDataContext(connection,
calciteSignature.rootSchema.plus());
return calciteSignature.enumerable(dataContext).enumerator();
}
代码示例来源:origin: Qihoo360/Quicksql
public Enumerator<Object> enumerator() {
final DataContext dataContext =
Schemas.createDataContext(connection,
calciteSignature.rootSchema.plus());
return calciteSignature.enumerable(dataContext).enumerator();
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
private static <TSource, TKey, TResult> Enumerable<TResult> groupBy_(
final Set<TKey> map, Enumerable<TSource> enumerable,
Function1<TSource, TKey> keySelector,
final Function1<TKey, TResult> resultSelector) {
try (Enumerator<TSource> os = enumerable.enumerator()) {
while (os.moveNext()) {
TSource o = os.current();
TKey key = keySelector.apply(o);
map.add(key);
}
}
return Linq4j.asEnumerable(map).select(resultSelector);
}
代码示例来源:origin: Qihoo360/Quicksql
@SuppressWarnings("deprecation")
@Override public void setSourceEnumerable(Enumerable<Row> enumerable)
throws InterruptedException {
// just copy over the source into the local list
final Enumerator<Row> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
this.send(enumerator.current());
}
enumerator.close();
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
@SuppressWarnings("deprecation")
@Override public void setSourceEnumerable(Enumerable<Row> enumerable)
throws InterruptedException {
// just copy over the source into the local list
final Enumerator<Row> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
this.send(enumerator.current());
}
enumerator.close();
}
}
代码示例来源:origin: Qihoo360/Quicksql
public void run() throws InterruptedException {
final Enumerator<Object[]> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
Object[] values = enumerator.current();
sink.send(Row.of(values));
}
}
}
代码示例来源:origin: Qihoo360/Quicksql
@SuppressWarnings("deprecation")
@Override public void setSourceEnumerable(Enumerable<Row> enumerable)
throws InterruptedException {
// just copy over the source into the local list
final Enumerator<Row> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
this.send(enumerator.current());
}
enumerator.close();
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
public void run() throws InterruptedException {
final Enumerator<Object[]> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
Object[] values = enumerator.current();
sink.send(Row.of(values));
}
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
@SuppressWarnings("deprecation")
@Override public void setSourceEnumerable(Enumerable<Row> enumerable)
throws InterruptedException {
// just copy over the source into the local list
final Enumerator<Row> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
this.send(enumerator.current());
}
enumerator.close();
}
}
代码示例来源:origin: Qihoo360/Quicksql
public Enumerator<T> enumerator() {
final JavaTypeFactory typeFactory =
((CalciteConnection) queryProvider).getTypeFactory();
final SqlString sql = generateSql();
//noinspection unchecked
final Enumerable<T> enumerable = (Enumerable<T>) ResultSetEnumerable.of(
jdbcSchema.getDataSource(),
sql.getSql(),
JdbcUtils.ObjectArrayRowBuilder.factory(fieldClasses(typeFactory)));
return enumerable.enumerator();
}
}
内容来源于网络,如有侵权,请联系作者删除!