org.h2.command.dml.Query.isUnion()方法的使用及代码示例

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

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

Query.isUnion介绍

[英]Check if this is a UNION query.
[中]检查这是否是联合查询。

代码示例

代码示例来源:origin: com.h2database/h2

private boolean collectJoinBatches(Query query) {
  if (query.isUnion()) {
    SelectUnion union = (SelectUnion) query;
    return collectJoinBatches(union.getLeft()) &&
        collectJoinBatches(union.getRight());
  }
  Select select = (Select) query;
  JoinBatch jb = select.getJoinBatch();
  if (jb == null) {
    onlyBatchedQueries = false;
  } else {
    if (jb.getLookupBatch(0) == null) {
      // we are top sub-query
      return false;
    }
    assert !jb.batchedSubQuery;
    jb.batchedSubQuery = true;
    if (joinBatches == null) {
      joinBatches = New.arrayList();
      filters = New.arrayList();
    }
    filters.add(jb.filters[0]);
    joinBatches.add(jb);
  }
  return true;
}

代码示例来源:origin: com.h2database/h2

/**
 * Create index lookup batch for a view index.
 *
 * @param viewIndex view index
 * @return index lookup batch or {@code null} if batching is not supported
 *         for this query
 */
public static IndexLookupBatch createViewIndexLookupBatch(ViewIndex viewIndex) {
  Query query = viewIndex.getQuery();
  if (query.isUnion()) {
    ViewIndexLookupBatchUnion unionBatch = new ViewIndexLookupBatchUnion(viewIndex);
    return unionBatch.initialize() ? unionBatch : null;
  }
  JoinBatch jb = ((Select) query).getJoinBatch();
  if (jb == null || jb.getLookupBatch(0) == null) {
    // our sub-query is not batched or is top batched sub-query
    return null;
  }
  assert !jb.batchedSubQuery;
  jb.batchedSubQuery = true;
  return jb.viewIndexLookupBatch(viewIndex);
}

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

List<CollocationModel> unions,
boolean validate) {
if (qry.isUnion()) {
  if (unions == null)
    unions = new ArrayList<>();

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

/**
 * @param qry Query.
 * @param expCol Expression column.
 * @param validate Query validation flag.
 * @return {@code true} It it is an affinity column.
 */
private static boolean isAffinityColumn(Query qry, ExpressionColumn expCol, boolean validate) {
  if (qry.isUnion()) {
    SelectUnion union = (SelectUnion)qry;
    return isAffinityColumn(union.getLeft(), expCol, validate) && isAffinityColumn(union.getRight(), expCol, validate);
  }
  Expression exp = qry.getExpressions().get(expCol.getColumn().getColumnId()).getNonAliasExpression();
  if (exp instanceof ExpressionColumn) {
    expCol = (ExpressionColumn)exp;
    return isAffinityColumn(expCol.getTableFilter(), expCol, validate);
  }
  return false;
}

代码示例来源:origin: com.h2database/h2

if (isUnion()) {

代码示例来源:origin: com.h2database/h2

query.setNeverLazy(true);
if (!query.isUnion()) {
  throw DbException.get(ErrorCode.SYNTAX_ERROR_2,
      "recursive queries without UNION");

代码示例来源:origin: org.wowtools/h2

private boolean collectJoinBatches(Query query) {
  if (query.isUnion()) {
    SelectUnion union = (SelectUnion) query;
    return collectJoinBatches(union.getLeft()) &&
        collectJoinBatches(union.getRight());
  }
  Select select = (Select) query;
  JoinBatch jb = select.getJoinBatch();
  if (jb == null) {
    onlyBatchedQueries = false;
  } else {
    if (jb.getLookupBatch(0) == null) {
      // we are top sub-query
      return false;
    }
    assert !jb.batchedSubQuery;
    jb.batchedSubQuery = true;
    if (joinBatches == null) {
      joinBatches = New.arrayList();
      filters = New.arrayList();
    }
    filters.add(jb.filters[0]);
    joinBatches.add(jb);
  }
  return true;
}

代码示例来源:origin: com.eventsourcing/h2

private boolean collectJoinBatches(Query query) {
  if (query.isUnion()) {
    SelectUnion union = (SelectUnion) query;
    return collectJoinBatches(union.getLeft()) &&
        collectJoinBatches(union.getRight());
  }
  Select select = (Select) query;
  JoinBatch jb = select.getJoinBatch();
  if (jb == null) {
    onlyBatchedQueries = false;
  } else {
    if (jb.getLookupBatch(0) == null) {
      // we are top sub-query
      return false;
    }
    assert !jb.batchedSubQuery;
    jb.batchedSubQuery = true;
    if (joinBatches == null) {
      joinBatches = New.arrayList();
      filters = New.arrayList();
    }
    filters.add(jb.filters[0]);
    joinBatches.add(jb);
  }
  return true;
}

代码示例来源:origin: org.apache.ignite/ignite-indexing

List<GridH2CollocationModel> unions,
boolean validate) {
if (qry.isUnion()) {
  if (unions == null)
    unions = new ArrayList<>();

代码示例来源:origin: com.eventsourcing/h2

/**
 * Create index lookup batch for a view index.
 *
 * @param viewIndex view index
 * @return index lookup batch or {@code null} if batching is not supported
 *         for this query
 */
public static IndexLookupBatch createViewIndexLookupBatch(ViewIndex viewIndex) {
  Query query = viewIndex.getQuery();
  if (query.isUnion()) {
    ViewIndexLookupBatchUnion unionBatch = new ViewIndexLookupBatchUnion(viewIndex);
    return unionBatch.initialize() ? unionBatch : null;
  }
  JoinBatch jb = ((Select) query).getJoinBatch();
  if (jb == null || jb.getLookupBatch(0) == null) {
    // our sub-query is not batched or is top batched sub-query
    return null;
  }
  assert !jb.batchedSubQuery;
  jb.batchedSubQuery = true;
  return jb.viewIndexLookupBatch(viewIndex);
}

代码示例来源:origin: org.wowtools/h2

/**
 * Create index lookup batch for a view index.
 *
 * @param viewIndex view index
 * @return index lookup batch or {@code null} if batching is not supported
 *         for this query
 */
public static IndexLookupBatch createViewIndexLookupBatch(ViewIndex viewIndex) {
  Query query = viewIndex.getQuery();
  if (query.isUnion()) {
    ViewIndexLookupBatchUnion unionBatch = new ViewIndexLookupBatchUnion(viewIndex);
    return unionBatch.initialize() ? unionBatch : null;
  }
  JoinBatch jb = ((Select) query).getJoinBatch();
  if (jb == null || jb.getLookupBatch(0) == null) {
    // our sub-query is not batched or is top batched sub-query
    return null;
  }
  assert !jb.batchedSubQuery;
  jb.batchedSubQuery = true;
  return jb.viewIndexLookupBatch(viewIndex);
}

代码示例来源:origin: org.apache.ignite/ignite-indexing

/**
 * @param qry Query.
 * @param expCol Expression column.
 * @param validate Query validation flag.
 * @return {@code true} It it is an affinity column.
 */
private static boolean isAffinityColumn(Query qry, ExpressionColumn expCol, boolean validate) {
  if (qry.isUnion()) {
    SelectUnion union = (SelectUnion)qry;
    return isAffinityColumn(union.getLeft(), expCol, validate) && isAffinityColumn(union.getRight(), expCol, validate);
  }
  Expression exp = qry.getExpressions().get(expCol.getColumn().getColumnId()).getNonAliasExpression();
  if (exp instanceof ExpressionColumn) {
    expCol = (ExpressionColumn)exp;
    return isAffinityColumn(expCol.getTableFilter(), expCol, validate);
  }
  return false;
}

代码示例来源:origin: org.wowtools/h2

query = (Query) parser.prepare(querySQL);
if (!query.isUnion()) {
  throw DbException.get(ErrorCode.SYNTAX_ERROR_2,
      "recursive queries without UNION ALL");

代码示例来源:origin: com.eventsourcing/h2

query = (Query) parser.prepare(querySQL);
if (!query.isUnion()) {
  throw DbException.get(ErrorCode.SYNTAX_ERROR_2,
      "recursive queries without UNION ALL");

相关文章