• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AbstractEnumerable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.calcite.linq4j.AbstractEnumerable的典型用法代码示例。如果您正苦于以下问题:Java AbstractEnumerable类的具体用法?Java AbstractEnumerable怎么用?Java AbstractEnumerable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AbstractEnumerable类属于org.apache.calcite.linq4j包,在下文中一共展示了AbstractEnumerable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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};
            }
          });
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:MazeTable.java


示例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));
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:18,代码来源:CsvFilterableTable.java


示例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);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:Elasticsearch2Table.java


示例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];
        }
      };
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:Linq4jTest.java


示例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);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:29,代码来源:MongoTable.java


示例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);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:37,代码来源:MongoTable.java


示例7: createEnumerable

import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<DataAccessor> createEnumerable() {
    return new AbstractEnumerable<DataAccessor>() {
        @Override
        public Enumerator<DataAccessor> enumerator() {
            return asEnumerator();
        }
    };
}
 
开发者ID:diennea,项目名称:herddb,代码行数:9,代码来源:DataScanner.java


示例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);
        }
    };
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:8,代码来源:OctopusMetaModelTable.java


示例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);
        }
    };
}
 
开发者ID:twilmes,项目名称:sql-gremlin,代码行数:8,代码来源:GremlinTraversalScan.java


示例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;
    }
  };
}
 
开发者ID:qubole,项目名称:quark,代码行数:8,代码来源:QuarkViewTable.java


示例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();
    }
  };
}
 
开发者ID:qubole,项目名称:quark,代码行数:13,代码来源:QuarkTable.java


示例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());
        }
    };
}
 
开发者ID:vlsi,项目名称:mat-calcite-plugin,代码行数:10,代码来源:SnapshotThreadStacksTable.java


示例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));
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:CsvStreamScannableTable.java


示例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);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:JsonTable.java


示例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));
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:CsvScannableTable.java


示例16: project

import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
/** Returns an enumerable over a given projection of the fields.
 *
 * <p>Called from generated code. */
public Enumerable<Object> project(final DataContext root,
    final int[] fields) {
  final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root);
  return new AbstractEnumerable<Object>() {
    public Enumerator<Object> enumerator() {
      return new CsvEnumerator<>(source, cancelFlag, fieldTypes, fields);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:CsvTranslatableTable.java


示例17: project

import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
/** Returns an enumerable over a given projection of the fields. */
public Enumerable<Object> project(final int[] fields) {
  return new AbstractEnumerable<Object>() {
    public Enumerator<Object> enumerator() {
      try {
        return new FileEnumerator(reader.iterator(), converter, fields);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:FileTable.java


示例18: 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 SearchSourceBuilder searchSourceBuilder;
  if (ops.isEmpty()) {
    searchSourceBuilder = new SearchSourceBuilder();
  } else {
    String queryString = "{" + Util.toString(ops, "", ", ", "") + "}";
    NamedXContentRegistry xContentRegistry = NamedXContentRegistry.EMPTY;
    XContent xContent = JsonXContent.jsonXContent;
    try (XContentParser parser = xContent.createParser(xContentRegistry, queryString)) {
      final QueryParseContext queryParseContext = new QueryParseContext(parser);
      searchSourceBuilder = SearchSourceBuilder.fromXContent(queryParseContext);
    } catch (IOException ex) {
      throw new RuntimeException(ex);
    }
  }
  final Function1<SearchHit, Object> getter = Elasticsearch5Enumerator.getter(fields);

  return new AbstractEnumerable<Object>() {
    public Enumerator<Object> enumerator() {
      final Iterator<SearchHit> cursor = client.prepareSearch(dbName).setTypes(typeName)
          .setSource(searchSourceBuilder)
          .execute().actionGet().getHits().iterator();
      return new Elasticsearch5Enumerator(cursor, getter);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:30,代码来源:Elasticsearch5Table.java


示例19: scan

import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
public Enumerable<Object[]> scan(DataContext root) {
  return new AbstractEnumerable<Object[]>() {
    public Enumerator<Object[]> enumerator() {
      final Content content = supplier.get();
      return content.arrayEnumerator();
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:ArrayTable.java


示例20: product

import org.apache.calcite.linq4j.AbstractEnumerable; //导入依赖的package包/类
/** Similar to {@link Linq4j#product(Iterable)} but each resulting list
 * implements {@link FlatLists.ComparableList}. */
public static <E extends Comparable> Enumerable<FlatLists.ComparableList<E>> product(
    final List<Enumerator<List<E>>> enumerators, final int fieldCount,
    final boolean withOrdinality) {
  return new AbstractEnumerable<FlatLists.ComparableList<E>>() {
    public Enumerator<FlatLists.ComparableList<E>> enumerator() {
      return new ProductComparableListEnumerator<>(enumerators, fieldCount,
          withOrdinality);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:SqlFunctions.java



注:本文中的org.apache.calcite.linq4j.AbstractEnumerable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DeadLetter类代码示例发布时间:2022-05-22
下一篇:
Java CamelExchangeException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap