org.apache.metamodel.query.Query.from()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中org.apache.metamodel.query.Query.from方法的一些代码示例,展示了Query.from的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.from方法的具体详情如下:
包路径:org.apache.metamodel.query.Query
类名称:Query
方法名:from

Query.from介绍

暂无

代码示例

代码示例来源:origin: org.apache.metamodel/MetaModel-core

public TableFromBuilderImpl(Table table, Query query, DataContext dataContext) {
  super(query, dataContext);
  fromItem = new FromItem(table);
  query.from(fromItem);
}

代码示例来源:origin: apache/metamodel

public TableFromBuilderImpl(Table table, Query query, DataContext dataContext) {
  super(query, dataContext);
  fromItem = new FromItem(table);
  query.from(fromItem);
}

代码示例来源:origin: org.apache.metamodel/MetaModel-core

public Query from(String expression) {
  return from(new FromItem(expression));
}

代码示例来源:origin: apache/metamodel

public Query from(String expression) {
  return from(new FromItem(expression));
}

代码示例来源:origin: apache/metamodel

public Query from(Table table) {
  return from(new FromItem(table));
}

代码示例来源:origin: org.apache.metamodel/MetaModel-core

public Query from(Table table) {
  return from(new FromItem(table));
}

代码示例来源:origin: org.apache.metamodel/MetaModel-core

public Query from(Table table, String alias) {
  return from(new FromItem(table).setAlias(alias));
}

代码示例来源:origin: apache/metamodel

public Query from(Table table, String alias) {
  return from(new FromItem(table).setAlias(alias));
}

代码示例来源: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: org.apache.metamodel/MetaModel-core

@Override
public SatisfiedFromBuilder on(Column left, Column right) throws IllegalArgumentException {
  if (left == null) {
    throw new IllegalArgumentException("left cannot be null");
  }
  if (right == null) {
    throw new IllegalArgumentException("right cannot be null");
  }
  getQuery().getFromClause().removeItem(leftItem);
  SelectItem[] leftOn = new SelectItem[] { new SelectItem(left) };
  SelectItem[] rightOn = new SelectItem[] { new SelectItem(right) };
  FromItem fromItem = new FromItem(joinType, leftItem, rightItem, leftOn, rightOn);
  getQuery().from(fromItem);
  return this;
}

代码示例来源:origin: apache/metamodel

@Override
public SatisfiedFromBuilder on(Column left, Column right) throws IllegalArgumentException {
  if (left == null) {
    throw new IllegalArgumentException("left cannot be null");
  }
  if (right == null) {
    throw new IllegalArgumentException("right cannot be null");
  }
  getQuery().getFromClause().removeItem(leftItem);
  SelectItem[] leftOn = new SelectItem[] { new SelectItem(left) };
  SelectItem[] rightOn = new SelectItem[] { new SelectItem(right) };
  FromItem fromItem = new FromItem(joinType, leftItem, rightItem, leftOn, rightOn);
  getQuery().from(fromItem);
  return this;
}

代码示例来源:origin: org.apache.metamodel/MetaModel-core

public Query from(Table leftTable, Table rightTable, JoinType joinType, Column leftOnColumn, Column rightOnColumn) {
  SelectItem[] leftOn = new SelectItem[] { new SelectItem(leftOnColumn) };
  SelectItem[] rightOn = new SelectItem[] { new SelectItem(rightOnColumn) };
  FromItem fromItem = new FromItem(joinType, new FromItem(leftTable), new FromItem(rightTable), leftOn, rightOn);
  return from(fromItem);
}

代码示例来源: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

public Query from(Table leftTable, Table rightTable, JoinType joinType, Column leftOnColumn, Column rightOnColumn) {
  SelectItem[] leftOn = new SelectItem[] { new SelectItem(leftOnColumn) };
  SelectItem[] rightOn = new SelectItem[] { new SelectItem(rightOnColumn) };
  FromItem fromItem = new FromItem(joinType, new FromItem(leftTable), new FromItem(rightTable), leftOn, rightOn);
  return from(fromItem);
}

代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc

private List<Query> splitQueryBasedOnSubQueries(int fromItemIndex) {
  Query subQuery = _query.getFromClause().getItem(fromItemIndex).getSubQuery();
  QuerySplitter subQuerySplitter = new QuerySplitter(_dataContext, subQuery);
  subQuerySplitter.setMaxRows(_maxRows);
  List<Query> splitQueries = subQuerySplitter.splitQuery();
  List<Query> result = new ArrayList<Query>(splitQueries.size());
  for (Query splitQuery : splitQueries) {
    Query newQuery = _query.clone();
    FromClause fromClause = newQuery.getFromClause();
    String alias = fromClause.getItem(fromItemIndex).getAlias();
    fromClause.removeItem(fromItemIndex);
    newQuery.from(new FromItem(splitQuery).setAlias(alias));
    result.add(newQuery);
  }
  return result;
}

代码示例来源:origin: apache/metamodel

private List<Query> splitQueryBasedOnSubQueries(int fromItemIndex) {
  Query subQuery = _query.getFromClause().getItem(fromItemIndex).getSubQuery();
  QuerySplitter subQuerySplitter = new QuerySplitter(_dataContext, subQuery);
  subQuerySplitter.setMaxRows(_maxRows);
  List<Query> splitQueries = subQuerySplitter.splitQuery();
  List<Query> result = new ArrayList<Query>(splitQueries.size());
  for (Query splitQuery : splitQueries) {
    Query newQuery = _query.clone();
    FromClause fromClause = newQuery.getFromClause();
    String alias = fromClause.getItem(fromItemIndex).getAlias();
    fromClause.removeItem(fromItemIndex);
    newQuery.from(new FromItem(splitQuery).setAlias(alias));
    result.add(newQuery);
  }
  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 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: 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());
}

相关文章