本文整理了Java中org.apache.metamodel.query.Query.<init>
方法的一些代码示例,展示了Query.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>
方法的具体详情如下:
包路径:org.apache.metamodel.query.Query
类名称:Query
方法名:<init>
暂无
代码示例来源:origin: org.apache.metamodel/MetaModel-core
public InitFromBuilderImpl(DataContext dataContext) {
this.dataContext = dataContext;
this.query = new Query();
}
代码示例来源:origin: apache/metamodel
public InitFromBuilderImpl(DataContext dataContext) {
this.dataContext = dataContext;
this.query = new Query();
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
protected DataSet materializeMainSchemaTable(Table table, List<Column> columns,
int maxRows) {
// find the appropriate datacontext to execute a simple
// table materialization query
final DataContext dc = _dataContextRetrievalFunction.apply(table);
final Query q = new Query().select(columns).from(table);
if (maxRows >= 0) {
q.setMaxRows(maxRows);
}
return dc.executeQuery(q);
}
代码示例来源:origin: apache/metamodel
@Override
protected DataSet materializeMainSchemaTable(Table table, List<Column> columns,
int maxRows) {
// find the appropriate datacontext to execute a simple
// table materialization query
final DataContext dc = _dataContextRetrievalFunction.apply(table);
final Query q = new Query().select(columns).from(table);
if (maxRows >= 0) {
q.setMaxRows(maxRows);
}
return dc.executeQuery(q);
}
代码示例来源:origin: datacleaner/DataCleaner
@Override
protected RowProcessingQueryOptimizer getQueryOptimizer() {
final Table table = getStream().getTable();
final Query q = new Query().from(table).select(table.getColumns());
return new NoopRowProcessingQueryOptimizer(q, getConsumersSorted());
}
}
代码示例来源:origin: apache/metamodel
Query q = new Query();
q.select(primaryColumns);
q.select(foreignColumns);
代码示例来源:origin: apache/metamodel
Query q = new Query().select(foreignColumns).select(countAllItem).from(table).groupBy(
foreignColumns);
DataSet data = executeQuery(q);
代码示例来源:origin: org.apache.metamodel/MetaModel-core
private SelectItem findSelectItem(String token, FromItem[] joinTables) {
// first look in the original query
SelectItemParser selectItemParser = new SelectItemParser(_query, false);
SelectItem result = selectItemParser.findSelectItem(token);
if (result == null) {
// fail over and try with the from items available in the join that
// is being built.
final Query temporaryQuery = new Query().from(joinTables);
selectItemParser = new SelectItemParser(temporaryQuery, false);
result = selectItemParser.findSelectItem(token);
if (result == null) {
throw new QueryParserException("Not capable of parsing ON token: " + token);
}
// set the query on the involved query parts (since they have been
// temporarily moved to the searched query).
result.setQuery(_query);
}
return result;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
private long getRowCount(Query q) {
q = q.clone();
SelectItem countAllItem = SelectItem.getCountAllItem();
if (q.getGroupByClause().getItemCount() > 0) {
q = new Query().from(new FromItem(q).setAlias("sq")).select(countAllItem);
} else {
q.getSelectClause().removeItems();
q.select(countAllItem);
}
Row row = MetaModelHelper.executeSingleRowQuery(_dataContext, q);
Number count = (Number) row.getValue(countAllItem);
return count.longValue();
}
代码示例来源:origin: apache/metamodel
private SelectItem findSelectItem(String token, FromItem[] joinTables) {
// first look in the original query
SelectItemParser selectItemParser = new SelectItemParser(_query, false);
SelectItem result = selectItemParser.findSelectItem(token);
if (result == null) {
// fail over and try with the from items available in the join that
// is being built.
final Query temporaryQuery = new Query().from(joinTables);
selectItemParser = new SelectItemParser(temporaryQuery, false);
result = selectItemParser.findSelectItem(token);
if (result == null) {
throw new QueryParserException("Not capable of parsing ON token: " + token);
}
// set the query on the involved query parts (since they have been
// temporarily moved to the searched query).
result.setQuery(_query);
}
return result;
}
代码示例来源:origin: apache/metamodel
private long getRowCount(Query q) {
q = q.clone();
SelectItem countAllItem = SelectItem.getCountAllItem();
if (q.getGroupByClause().getItemCount() > 0) {
q = new Query().from(new FromItem(q).setAlias("sq")).select(countAllItem);
} else {
q.getSelectClause().removeItems();
q.select(countAllItem);
}
Row row = MetaModelHelper.executeSingleRowQuery(_dataContext, q);
Number count = (Number) row.getValue(countAllItem);
return count.longValue();
}
代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core
private void compileLookupQuery() {
try {
final Column[] queryOutputColumns = getQueryOutputColumns(false);
final Column queryOutputColumn = queryOutputColumns[0];
final Table table = queryOutputColumn.getTable();
Query query = new Query().from(table).select(queryOutputColumns);
if (!isCarthesianProductMode()) {
final Column[] queryConditionColumns = getQueryConditionColumns();
for (int i = 0; i < queryConditionColumns.length; i++) {
query = query.where(queryConditionColumns[i], OperatorType.EQUALS_TO, new QueryParameter());
}
}
if (joinSemantic == JoinSemantic.LEFT_JOIN_MAX_ONE) {
query = query.setMaxRows(1);
}
lookupQuery = datastoreConnection.getDataContext().compileQuery(query);
} catch (RuntimeException e) {
logger.error("Error occurred while compiling lookup query", e);
throw e;
}
}
代码示例来源:origin: datacleaner/DataCleaner
private void compileLookupQuery() {
try {
final Column[] queryOutputColumns = getQueryOutputColumns(false);
final Column queryOutputColumn = queryOutputColumns[0];
final Table table = queryOutputColumn.getTable();
Query query = new Query().from(table).select(queryOutputColumns);
if (!isCarthesianProductMode()) {
final Column[] queryConditionColumns = getQueryConditionColumns();
for (int i = 0; i < queryConditionColumns.length; i++) {
query = query.where(queryConditionColumns[i], OperatorType.EQUALS_TO, new QueryParameter());
}
}
if (joinSemantic == JoinSemantic.LEFT_JOIN_MAX_ONE) {
query = query.setMaxRows(1);
}
lookupQuery = datastoreConnection.getDataContext().compileQuery(query);
} catch (final RuntimeException e) {
logger.error("Error occurred while compiling lookup query", e);
throw e;
}
}
代码示例来源:origin: datacleaner/DataCleaner
public void initialize() {
final Table table = _outputDataStreamJob.getOutputDataStream().getTable();
final Query query = new Query();
query.from(table).selectAll();
final List<SelectItem> selectItems = query.getSelectClause().getItems();
final ConsumeRowHandler consumeRowHandler = _publisher.createConsumeRowHandler();
_outputRowCollector = new OutputDataStreamRowCollector(_publisher, selectItems, consumeRowHandler);
final OutputDataStream outputDataStream = _outputDataStreamJob.getOutputDataStream();
_component.initializeOutputDataStream(outputDataStream, query, _outputRowCollector);
_publisher.getAnalysisListener()
.rowProcessingBegin(_publisher.getAnalysisJob(), _publisher.getRowProcessingMetrics());
}
代码示例来源:origin: apache/metamodel
innerQuery.setMaxRows(null);
final Query outerQuery = new Query();
final FromItem subQuerySelectItem = new FromItem(innerQuery).setAlias("metamodel_subquery");
outerQuery.from(subQuerySelectItem);
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
innerQuery.setMaxRows(null);
final Query outerQuery = new Query();
final FromItem subQuerySelectItem = new FromItem(innerQuery).setAlias("metamodel_subquery");
outerQuery.from(subQuerySelectItem);
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
private List<Query> splitQueryBasedOnColumn(Column column) {
SelectItem maxItem = new SelectItem(FunctionType.MAX, column);
SelectItem minItem = new SelectItem(FunctionType.MIN, column);
Query q = new Query().from(column.getTable()).select(maxItem, minItem);
Row row = MetaModelHelper.executeSingleRowQuery(_dataContext, q);
long max = ceil((Number) row.getValue(maxItem));
代码示例来源:origin: apache/metamodel
private List<Query> splitQueryBasedOnColumn(Column column) {
SelectItem maxItem = new SelectItem(FunctionType.MAX, column);
SelectItem minItem = new SelectItem(FunctionType.MIN, column);
Query q = new Query().from(column.getTable()).select(maxItem, minItem);
Row row = MetaModelHelper.executeSingleRowQuery(_dataContext, q);
long max = ceil((Number) row.getValue(maxItem));
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public Query clone() {
final Query q = new Query();
q.setMaxRows(_maxRows);
q.setFirstRow(_firstRow);
q.getSelectClause().setDistinct(_selectClause.isDistinct());
for (FromItem item : _fromClause.getItems()) {
q.from(item.clone());
}
for (SelectItem item : _selectClause.getItems()) {
q.select(item.clone(q));
}
for (FilterItem item : _whereClause.getItems()) {
q.where(item.clone());
}
for (GroupByItem item : _groupByClause.getItems()) {
q.groupBy(item.clone());
}
for (FilterItem item : _havingClause.getItems()) {
q.having(item.clone());
}
for (OrderByItem item : _orderByClause.getItems()) {
q.orderBy(item.clone());
}
return q;
}
}
代码示例来源:origin: apache/metamodel
@Override
public Query clone() {
final Query q = new Query();
q.setMaxRows(_maxRows);
q.setFirstRow(_firstRow);
q.getSelectClause().setDistinct(_selectClause.isDistinct());
for (FromItem item : _fromClause.getItems()) {
q.from(item.clone());
}
for (SelectItem item : _selectClause.getItems()) {
q.select(item.clone(q));
}
for (FilterItem item : _whereClause.getItems()) {
q.where(item.clone());
}
for (GroupByItem item : _groupByClause.getItems()) {
q.groupBy(item.clone());
}
for (FilterItem item : _havingClause.getItems()) {
q.having(item.clone());
}
for (OrderByItem item : _orderByClause.getItems()) {
q.orderBy(item.clone());
}
return q;
}
}
内容来源于网络,如有侵权,请联系作者删除!