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

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

本文整理了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

  1. private boolean collectJoinBatches(Query query) {
  2. if (query.isUnion()) {
  3. SelectUnion union = (SelectUnion) query;
  4. return collectJoinBatches(union.getLeft()) &&
  5. collectJoinBatches(union.getRight());
  6. }
  7. Select select = (Select) query;
  8. JoinBatch jb = select.getJoinBatch();
  9. if (jb == null) {
  10. onlyBatchedQueries = false;
  11. } else {
  12. if (jb.getLookupBatch(0) == null) {
  13. // we are top sub-query
  14. return false;
  15. }
  16. assert !jb.batchedSubQuery;
  17. jb.batchedSubQuery = true;
  18. if (joinBatches == null) {
  19. joinBatches = New.arrayList();
  20. filters = New.arrayList();
  21. }
  22. filters.add(jb.filters[0]);
  23. joinBatches.add(jb);
  24. }
  25. return true;
  26. }

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

  1. /**
  2. * Create index lookup batch for a view index.
  3. *
  4. * @param viewIndex view index
  5. * @return index lookup batch or {@code null} if batching is not supported
  6. * for this query
  7. */
  8. public static IndexLookupBatch createViewIndexLookupBatch(ViewIndex viewIndex) {
  9. Query query = viewIndex.getQuery();
  10. if (query.isUnion()) {
  11. ViewIndexLookupBatchUnion unionBatch = new ViewIndexLookupBatchUnion(viewIndex);
  12. return unionBatch.initialize() ? unionBatch : null;
  13. }
  14. JoinBatch jb = ((Select) query).getJoinBatch();
  15. if (jb == null || jb.getLookupBatch(0) == null) {
  16. // our sub-query is not batched or is top batched sub-query
  17. return null;
  18. }
  19. assert !jb.batchedSubQuery;
  20. jb.batchedSubQuery = true;
  21. return jb.viewIndexLookupBatch(viewIndex);
  22. }

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

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

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

  1. /**
  2. * @param qry Query.
  3. * @param expCol Expression column.
  4. * @param validate Query validation flag.
  5. * @return {@code true} It it is an affinity column.
  6. */
  7. private static boolean isAffinityColumn(Query qry, ExpressionColumn expCol, boolean validate) {
  8. if (qry.isUnion()) {
  9. SelectUnion union = (SelectUnion)qry;
  10. return isAffinityColumn(union.getLeft(), expCol, validate) && isAffinityColumn(union.getRight(), expCol, validate);
  11. }
  12. Expression exp = qry.getExpressions().get(expCol.getColumn().getColumnId()).getNonAliasExpression();
  13. if (exp instanceof ExpressionColumn) {
  14. expCol = (ExpressionColumn)exp;
  15. return isAffinityColumn(expCol.getTableFilter(), expCol, validate);
  16. }
  17. return false;
  18. }

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

  1. if (isUnion()) {

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

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

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

  1. private boolean collectJoinBatches(Query query) {
  2. if (query.isUnion()) {
  3. SelectUnion union = (SelectUnion) query;
  4. return collectJoinBatches(union.getLeft()) &&
  5. collectJoinBatches(union.getRight());
  6. }
  7. Select select = (Select) query;
  8. JoinBatch jb = select.getJoinBatch();
  9. if (jb == null) {
  10. onlyBatchedQueries = false;
  11. } else {
  12. if (jb.getLookupBatch(0) == null) {
  13. // we are top sub-query
  14. return false;
  15. }
  16. assert !jb.batchedSubQuery;
  17. jb.batchedSubQuery = true;
  18. if (joinBatches == null) {
  19. joinBatches = New.arrayList();
  20. filters = New.arrayList();
  21. }
  22. filters.add(jb.filters[0]);
  23. joinBatches.add(jb);
  24. }
  25. return true;
  26. }

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

  1. private boolean collectJoinBatches(Query query) {
  2. if (query.isUnion()) {
  3. SelectUnion union = (SelectUnion) query;
  4. return collectJoinBatches(union.getLeft()) &&
  5. collectJoinBatches(union.getRight());
  6. }
  7. Select select = (Select) query;
  8. JoinBatch jb = select.getJoinBatch();
  9. if (jb == null) {
  10. onlyBatchedQueries = false;
  11. } else {
  12. if (jb.getLookupBatch(0) == null) {
  13. // we are top sub-query
  14. return false;
  15. }
  16. assert !jb.batchedSubQuery;
  17. jb.batchedSubQuery = true;
  18. if (joinBatches == null) {
  19. joinBatches = New.arrayList();
  20. filters = New.arrayList();
  21. }
  22. filters.add(jb.filters[0]);
  23. joinBatches.add(jb);
  24. }
  25. return true;
  26. }

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

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

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

  1. /**
  2. * Create index lookup batch for a view index.
  3. *
  4. * @param viewIndex view index
  5. * @return index lookup batch or {@code null} if batching is not supported
  6. * for this query
  7. */
  8. public static IndexLookupBatch createViewIndexLookupBatch(ViewIndex viewIndex) {
  9. Query query = viewIndex.getQuery();
  10. if (query.isUnion()) {
  11. ViewIndexLookupBatchUnion unionBatch = new ViewIndexLookupBatchUnion(viewIndex);
  12. return unionBatch.initialize() ? unionBatch : null;
  13. }
  14. JoinBatch jb = ((Select) query).getJoinBatch();
  15. if (jb == null || jb.getLookupBatch(0) == null) {
  16. // our sub-query is not batched or is top batched sub-query
  17. return null;
  18. }
  19. assert !jb.batchedSubQuery;
  20. jb.batchedSubQuery = true;
  21. return jb.viewIndexLookupBatch(viewIndex);
  22. }

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

  1. /**
  2. * Create index lookup batch for a view index.
  3. *
  4. * @param viewIndex view index
  5. * @return index lookup batch or {@code null} if batching is not supported
  6. * for this query
  7. */
  8. public static IndexLookupBatch createViewIndexLookupBatch(ViewIndex viewIndex) {
  9. Query query = viewIndex.getQuery();
  10. if (query.isUnion()) {
  11. ViewIndexLookupBatchUnion unionBatch = new ViewIndexLookupBatchUnion(viewIndex);
  12. return unionBatch.initialize() ? unionBatch : null;
  13. }
  14. JoinBatch jb = ((Select) query).getJoinBatch();
  15. if (jb == null || jb.getLookupBatch(0) == null) {
  16. // our sub-query is not batched or is top batched sub-query
  17. return null;
  18. }
  19. assert !jb.batchedSubQuery;
  20. jb.batchedSubQuery = true;
  21. return jb.viewIndexLookupBatch(viewIndex);
  22. }

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

  1. /**
  2. * @param qry Query.
  3. * @param expCol Expression column.
  4. * @param validate Query validation flag.
  5. * @return {@code true} It it is an affinity column.
  6. */
  7. private static boolean isAffinityColumn(Query qry, ExpressionColumn expCol, boolean validate) {
  8. if (qry.isUnion()) {
  9. SelectUnion union = (SelectUnion)qry;
  10. return isAffinityColumn(union.getLeft(), expCol, validate) && isAffinityColumn(union.getRight(), expCol, validate);
  11. }
  12. Expression exp = qry.getExpressions().get(expCol.getColumn().getColumnId()).getNonAliasExpression();
  13. if (exp instanceof ExpressionColumn) {
  14. expCol = (ExpressionColumn)exp;
  15. return isAffinityColumn(expCol.getTableFilter(), expCol, validate);
  16. }
  17. return false;
  18. }

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

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

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

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

相关文章