本文整理汇总了Java中org.apache.calcite.linq4j.AbstractEnumerable类的典型用法代码示例。如果您正苦于以下问题:Java AbstractEnumerable类的具体用法?Java AbstractEnumerable怎么用?Java AbstractEnumerable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractEnumerable类属于org.apache.calcite.linq4j包,在下文中一共展示了AbstractEnumerable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scan
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<Object[]> scan(DataContext root) {
final Random random = seed >= 0 ? new Random(seed) : new Random();
final Maze maze = new Maze(width, height);
final PrintWriter pw = Util.printWriter(System.out);
maze.layout(random, pw);
if (Maze.DEBUG) {
maze.print(pw, true);
}
return new AbstractEnumerable<Object[]>() {
public Enumerator<Object[]> enumerator() {
final Set<Integer> solutionSet;
if (solution) {
solutionSet = maze.solve(0, 0);
} else {
solutionSet = null;
}
return Linq4j.transform(maze.enumerator(solutionSet),
new Function1<String, Object[]>() {
public Object[] apply(String s) {
return new Object[] {s};
}
});
}
};
}
示例2: scan
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<Object[]> scan(DataContext root, List<RexNode> filters) {
final String[] filterValues = new String[fieldTypes.size()];
for (final Iterator<RexNode> i = filters.iterator(); i.hasNext();) {
final RexNode filter = i.next();
if (addFilter(filter, filterValues)) {
i.remove();
}
}
final int[] fields = CsvEnumerator.identityList(fieldTypes.size());
final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root);
return new AbstractEnumerable<Object[]>() {
public Enumerator<Object[]> enumerator() {
return new CsvEnumerator<>(source, cancelFlag, false, filterValues,
new CsvEnumerator.ArrayRowConverter(fieldTypes, fields));
}
};
}
示例3: find
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
@Override protected Enumerable<Object> find(String index, List<String> ops,
List<Map.Entry<String, Class>> fields) {
final String dbName = index;
final String queryString = "{" + Util.toString(ops, "", ", ", "") + "}";
final Function1<SearchHit, Object> getter = Elasticsearch2Enumerator.getter(fields);
return new AbstractEnumerable<Object>() {
public Enumerator<Object> enumerator() {
final Iterator<SearchHit> cursor = client.prepareSearch(dbName).setTypes(typeName)
.setSource(queryString).execute().actionGet().getHits().iterator();
return new Elasticsearch2Enumerator(cursor, getter);
}
};
}
示例4: myEnumerable
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
private Enumerable<String> myEnumerable(final int[] closes, final int size) {
return new AbstractEnumerable<String>() {
public Enumerator<String> enumerator() {
return new Enumerator<String>() {
int i = 0;
public String current() {
return "x";
}
public boolean moveNext() {
return i++ < size;
}
public void reset() {
}
public void close() {
++closes[0];
}
};
}
};
}
示例5: find
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
/** Executes a "find" operation on the underlying collection.
*
* <p>For example,
* <code>zipsTable.find("{state: 'OR'}", "{city: 1, zipcode: 1}")</code></p>
*
* @param mongoDb MongoDB connection
* @param filterJson Filter JSON string, or null
* @param projectJson Project JSON string, or null
* @param fields List of fields to project; or null to return map
* @return Enumerator of results
*/
private Enumerable<Object> find(MongoDatabase mongoDb, String filterJson,
String projectJson, List<Map.Entry<String, Class>> fields) {
final MongoCollection collection =
mongoDb.getCollection(collectionName);
final Bson filter =
filterJson == null ? null : BsonDocument.parse(filterJson);
final Bson project =
projectJson == null ? null : BsonDocument.parse(projectJson);
final Function1<Document, Object> getter = MongoEnumerator.getter(fields);
return new AbstractEnumerable<Object>() {
public Enumerator<Object> enumerator() {
@SuppressWarnings("unchecked") final FindIterable<Document> cursor =
collection.find(filter).projection(project);
return new MongoEnumerator(cursor.iterator(), getter);
}
};
}
示例6: aggregate
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
/** Executes an "aggregate" operation on the underlying collection.
*
* <p>For example:
* <code>zipsTable.aggregate(
* "{$filter: {state: 'OR'}",
* "{$group: {_id: '$city', c: {$sum: 1}, p: {$sum: '$pop'}}}")
* </code></p>
*
* @param mongoDb MongoDB connection
* @param fields List of fields to project; or null to return map
* @param operations One or more JSON strings
* @return Enumerator of results
*/
private Enumerable<Object> aggregate(final MongoDatabase mongoDb,
final List<Map.Entry<String, Class>> fields,
final List<String> operations) {
final List<Bson> list = new ArrayList<>();
for (String operation : operations) {
list.add(BsonDocument.parse(operation));
}
final Function1<Document, Object> getter =
MongoEnumerator.getter(fields);
return new AbstractEnumerable<Object>() {
public Enumerator<Object> enumerator() {
final Iterator<Document> resultIterator;
try {
resultIterator = mongoDb.getCollection(collectionName)
.aggregate(list).iterator();
} catch (Exception e) {
throw new RuntimeException("While running MongoDB query "
+ Util.toString(operations, "[", ",\n", "]"), e);
}
return new MongoEnumerator(resultIterator, getter);
}
};
}
示例7: createEnumerable
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<DataAccessor> createEnumerable() {
return new AbstractEnumerable<DataAccessor>() {
@Override
public Enumerator<DataAccessor> enumerator() {
return asEnumerator();
}
};
}
示例8: project
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<Object> project() {
return new AbstractEnumerable<Object>() {
public Enumerator<Object> enumerator() {
return new OctopusMetaModelEnumerator(dataSource, getName(), octopusMetaModelTableScan);
}
};
}
示例9: scan
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public static Enumerable<Object[]> scan() {
return new AbstractEnumerable<Object[]>() {
public Enumerator<Object[]> enumerator() {
return new GremlinEnumerator(rows);
}
};
}
示例10: scan
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<Object[]> scan(DataContext root) {
return new AbstractEnumerable<Object[]>() {
public Enumerator<Object[]> enumerator() {
return null;
}
};
}
示例11: project
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
/**
* Returns an enumerable over a given projection of the fields.
*
* Called from generated code.
*/
public Enumerable<Object> project(final int[] fields) {
return new AbstractEnumerable<Object>() {
public org.apache.calcite.linq4j.Enumerator enumerator() {
return new QuarkEnumerator();
}
};
}
示例12: scan
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
@Override
public Enumerable<Object[]> scan(DataContext dataContext) {
return new AbstractEnumerable<Object[]>() {
@Override
public Enumerator<Object[]> enumerator() {
return new StackFramesEnumerator(snapshot, getThreadStacks());
}
};
}
示例13: scan
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<Object[]> scan(DataContext root) {
final int[] fields = CsvEnumerator.identityList(fieldTypes.size());
final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root);
return new AbstractEnumerable<Object[]>() {
public Enumerator<Object[]> enumerator() {
return new CsvEnumerator<>(source, cancelFlag, true, null,
new CsvEnumerator.ArrayRowConverter(fieldTypes, fields, true));
}
};
}
示例14: scan
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<Object[]> scan(DataContext root) {
return new AbstractEnumerable<Object[]>() {
public Enumerator<Object[]> enumerator() {
return new JsonEnumerator(source);
}
};
}
示例15: scan
import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<Object[]> scan(DataContext root) {
final int[] fields = CsvEnumerator.identityList(fieldTypes.size());
final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root);
return new AbstractEnumerable<Object[]>() {
public Enumerator<Object[]> enumerator() {
return new CsvEnumerator<>(source, cancelFlag, false, null,
new CsvEnumerator.ArrayRowConverter(fieldTypes, fields));
}
};
}