.addAll(scannedFieldsSet).build();
/** * Returns an immutable set containing each of {@code elements}, minus duplicates, in the order * each appears first in the source iterator. * * @throws NullPointerException if any of {@code elements} is null */ public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> elements) { // We special-case for 0 or 1 elements, but anything further is madness. if (!elements.hasNext()) { return of(); } E first = elements.next(); if (!elements.hasNext()) { return of(first); } else { return new ImmutableSet.Builder<E>().add(first).addAll(elements).build(); } }
.addAll(scannedFieldsSet).build();
.addAll(staticRuleSet) .add( DrillMergeProjectRule.getInstance(true, RelFactories.DEFAULT_PROJECT_FACTORY,
public MapRDBIndexDescriptor(List<LogicalExpression> indexCols, CollationContext indexCollationContext, List<LogicalExpression> nonIndexCols, List<LogicalExpression> rowKeyColumns, String indexName, String tableName, IndexType type, Object desc, DbGroupScan scan, NullDirection nullsDirection) { super(indexCols, indexCollationContext, nonIndexCols, rowKeyColumns, indexName, tableName, type, nullsDirection); this.desc = desc; this.indexedFields = ImmutableSet.copyOf(indexColumns); this.allFields = new ImmutableSet.Builder<LogicalExpression>() .add(PluginConstants.DOCUMENT_SCHEMA_PATH) .addAll(indexColumns) .addAll(nonIndexColumns) .build(); this.pluginCost = scan.getPluginCostModel(); }
/** * Get an immutable list of directory-based partition pruning rules that will be used in Calcite logical planning. * * @param optimizerRulesContext rules context * @return directory-based partition pruning rules */ static RuleSet getDirPruneScanRules(OptimizerRulesContext optimizerRulesContext) { final Set<RelOptRule> pruneRules = ImmutableSet.<RelOptRule>builder() .addAll(getItemStarRules()) .add( PruneScanRule.getDirFilterOnProject(optimizerRulesContext), PruneScanRule.getDirFilterOnScan(optimizerRulesContext) ) .build(); return RuleSets.ofList(pruneRules); }
/** * Get an immutable list of partition pruning rules that will be used in logical planning. */ static RuleSet getPruneScanRules(OptimizerRulesContext optimizerRulesContext) { final ImmutableSet<RelOptRule> pruneRules = ImmutableSet.<RelOptRule>builder() .addAll(getItemStarRules()) .add( PruneScanRule.getDirFilterOnProject(optimizerRulesContext), PruneScanRule.getDirFilterOnScan(optimizerRulesContext), ParquetPruneScanRule.getFilterOnProjectParquet(optimizerRulesContext), ParquetPruneScanRule.getFilterOnScanParquet(optimizerRulesContext), // Include LIMIT_ON_PROJECT since LIMIT_ON_SCAN may not work without it DrillPushLimitToScanRule.LIMIT_ON_PROJECT, DrillPushLimitToScanRule.LIMIT_ON_SCAN ) .build(); return RuleSets.ofList(pruneRules); } /**
/** * Adds each element of {@code elements} to the {@code ImmutableSortedSet}, * ignoring duplicate elements (only the first duplicate element is added). * * @param elements the elements to add to the {@code ImmutableSortedSet} * @return this {@code Builder} object * @throws NullPointerException if {@code elements} contains a null element */ @CanIgnoreReturnValue @Override public Builder<E> addAll(Iterable<? extends E> elements) { super.addAll(elements); return this; }
@Override public Set<StoragePluginOptimizerRule> getPhysicalOptimizerRules(OptimizerRulesContext optimizerRulesContext) { Builder<StoragePluginOptimizerRule> setBuilder = ImmutableSet.builder(); for (FormatPlugin plugin : formatCreator.getConfiguredFormatPlugins()) { Set<StoragePluginOptimizerRule> rules = plugin.getOptimizerRules(); if (rules != null && rules.size() > 0) { setBuilder.addAll(rules); } } return setBuilder.build(); }
/** * Adds each element of {@code elements} to the {@code ImmutableSortedSet}, * ignoring duplicate elements (only the first duplicate element is added). * * @param elements the elements to add to the {@code ImmutableSortedSet} * @return this {@code Builder} object * @throws NullPointerException if {@code elements} contains a null element */ @CanIgnoreReturnValue @Override public Builder<E> addAll(Iterator<? extends E> elements) { super.addAll(elements); return this; }
private static RuleSet getStorageRules(OptimizerRulesContext context, Collection<StoragePlugin> plugins, PlannerPhase phase) { final Builder<RelOptRule> rules = ImmutableSet.builder(); for(StoragePlugin plugin : plugins){ if(plugin instanceof AbstractStoragePlugin){ rules.addAll(((AbstractStoragePlugin) plugin).getOptimizerRules(context, phase)); }else{ rules.addAll(plugin.getOptimizerRules(context)); } } return RuleSets.ofList(rules.build()); }
public MapRDBIndexDescriptor(List<LogicalExpression> indexCols, CollationContext indexCollationContext, List<LogicalExpression> nonIndexCols, List<LogicalExpression> rowKeyColumns, String indexName, String tableName, IndexType type, Object desc, DbGroupScan scan, NullDirection nullsDirection) { super(indexCols, indexCollationContext, nonIndexCols, rowKeyColumns, indexName, tableName, type, nullsDirection); this.desc = desc; this.indexedFields = ImmutableSet.copyOf(indexColumns); this.allFields = new ImmutableSet.Builder<LogicalExpression>() .add(PluginConstants.DOCUMENT_SCHEMA_PATH) .addAll(indexColumns) .addAll(nonIndexColumns) .build(); this.pluginCost = scan.getPluginCostModel(); }