private void addTargetPathForOriginalPath(SchemaPath origPath, SchemaPath newPath) { if (!columnToConvert.containsKey(origPath)) { Set<SchemaPath> newSet = Sets.newHashSet(); newSet.add(newPath); columnToConvert.put(origPath, newSet); } else { columnToConvert.get(origPath).add(newPath); } }
private void addPathInExpr(LogicalExpression expr, SchemaPath path) { if (!pathsInExpr.containsKey(expr)) { Set<SchemaPath> newSet = Sets.newHashSet(); newSet.add(path); pathsInExpr.put(expr, newSet); } else { pathsInExpr.get(expr).add(path); } }
@Override public Set<Entry<K, V>> entrySet() { return Sets.newHashSet(Iterables.transform(primary.entrySet(), new Function<Entry<K, Entry<Integer, V>>, Entry<K, V>>() { @Override public Entry<K, V> apply(Entry<K, Entry<Integer, V>> entry) { return new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue().getValue()); } })); } };
@Override public Set<String> getTableNames() { if (tables == null) { try { tables = Sets.newHashSet(mClient.getTableNames(this.name, schemaConfig.getIgnoreAuthErrors())); } catch (final TException e) { logger.warn("Failure while attempting to access HiveDatabase '{}'.", this.name, e.getCause()); tables = Sets.newHashSet(); // empty set. } } return tables; }
public GroupScan cloneWithNewSpec(List<KafkaPartitionScanSpec> partitionScanSpecList) { KafkaGroupScan clone = new KafkaGroupScan(this); HashSet<TopicPartition> partitionsInSpec = Sets.newHashSet(); for(KafkaPartitionScanSpec scanSpec : partitionScanSpecList) { TopicPartition tp = new TopicPartition(scanSpec.getTopicName(), scanSpec.getPartitionId()); partitionsInSpec.add(tp); PartitionScanWork newScanWork = new PartitionScanWork(partitionWorkMap.get(tp).getByteMap(), scanSpec); clone.partitionWorkMap.put(tp, newScanWork); } //Remove unnecessary partitions from partitionWorkMap clone.partitionWorkMap.keySet().removeIf(tp -> !partitionsInSpec.contains(tp)); return clone; }
@Override public Set<String> getTableNames() { try { ListTablesResponse tablesList = plugin.getClient().getTablesList(); return Sets.newHashSet(tablesList.getTablesList()); } catch (Exception e) { logger.warn("Failure reading kudu tables.", e); return Collections.emptySet(); } }
@Override public Set<String> getTableNames() { try(Admin admin = plugin.getConnection().getAdmin()) { HTableDescriptor[] tables = admin.listTables(); Set<String> tableNames = Sets.newHashSet(); for (HTableDescriptor table : tables) { tableNames.add(new String(table.getTableName().getNameAsString())); } return tableNames; } catch (Exception e) { logger.warn("Failure while loading table names for database '{}'.", getName(), e.getCause()); return Collections.emptySet(); } }
Set<TopicPartition> partitionsInNewSpec = Sets.newHashSet(); //Store topic-partitions returned from new spec.
public MapRDBFunctionalIndexInfo(IndexDescriptor indexDesc) { this.indexDesc = indexDesc; columnToConvert = Maps.newHashMap(); exprToConvert = Maps.newHashMap(); pathsInExpr = Maps.newHashMap(); // keep the order of new paths, it may be related to the naming policy newPathsForIndexedFunction = Sets.newLinkedHashSet(); allPathsInFunction = Sets.newHashSet(); init(); }
protected Collection<SchemaPath> transformColumns(Collection<SchemaPath> columns) { Set<SchemaPath> transformed = Sets.newLinkedHashSet(); completeFamilies = Sets.newHashSet();
@Override public MajorType getMajorType() { if (outputType != null) { return outputType; } MajorType elseType = elseExpression.getMajorType(); MajorType ifType = ifCondition.expression.getMajorType(); if (elseType.getMinorType() == MinorType.UNION) { Set<MinorType> subtypes = Sets.newHashSet(); for (MinorType subtype : elseType.getSubTypeList()) { subtypes.add(subtype); } for (MinorType subtype : ifType.getSubTypeList()) { subtypes.add(subtype); } MajorType.Builder builder = MajorType.newBuilder().setMinorType(MinorType.UNION).setMode(DataMode.OPTIONAL); for (MinorType subtype : subtypes) { builder.addSubType(subtype); } return builder.build(); } MajorType.Builder builder = MajorType.newBuilder().setMinorType(ifType.getMinorType()); builder.setMode(elseType.getMode() == DataMode.OPTIONAL || ifType.getMode() == DataMode.OPTIONAL ? DataMode.OPTIONAL : elseType.getMode()); builder = Types.calculateTypePrecisionAndScale(ifType, elseType, builder); return builder.build(); }
@Override public Set<SchemaPath> visitSchemaPath(SchemaPath path, Void value) { Set<SchemaPath> set = Sets.newHashSet(); set.add(path); return set; }
public PathInExpr(Map<LogicalExpression, Set<SchemaPath>> pathsInExpr) { this.pathsInExpr = pathsInExpr; allPaths = Sets.newHashSet(); remainderPaths = Sets.newHashSet(); remainderPathsInFunctions = Sets.newHashSet(); for(Map.Entry<LogicalExpression, Set<SchemaPath>> entry: pathsInExpr.entrySet()) { allPaths.addAll(entry.getValue()); } }
@Override public Set<SchemaPath> visitSchemaPath(SchemaPath path, Void value) { Set<SchemaPath> set = Sets.newHashSet(); set.add(path); return set; }
private void addTargetPathForOriginalPath(SchemaPath origPath, SchemaPath newPath) { if (!columnToConvert.containsKey(origPath)) { Set<SchemaPath> newSet = Sets.newHashSet(); newSet.add(newPath); columnToConvert.put(origPath, newSet); } else { columnToConvert.get(origPath).add(newPath); } }
private void addPathInExpr(LogicalExpression expr, SchemaPath path) { if (!pathsInExpr.containsKey(expr)) { Set<SchemaPath> newSet = Sets.newHashSet(); newSet.add(path); pathsInExpr.put(expr, newSet); } else { pathsInExpr.get(expr).add(path); } }
@Override public Set<SchemaPath> visitUnknown(LogicalExpression e, Void value) { Set<SchemaPath> paths = Sets.newHashSet(); for (LogicalExpression ex : e) { paths.addAll(ex.accept(this, null)); } return paths; }
@Override public Set<SchemaPath> visitUnknown(LogicalExpression e, Void value) { Set<SchemaPath> paths = Sets.newHashSet(); for (LogicalExpression ex : e) { paths.addAll(ex.accept(this, null)); } return paths; } }
@Override public Set<Entry<K, V>> entrySet() { return Sets.newHashSet(Iterables.transform(primary.entrySet(), new Function<Entry<K, Entry<Integer, V>>, Entry<K, V>>() { @Override public Entry<K, V> apply(Entry<K, Entry<Integer, V>> entry) { return new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue().getValue()); } })); } };
@Override public long getActualSize() { Set<AllocationManager.BufferLedger> ledgers = Sets.newHashSet(); startIndices.collectLedgers(ledgers); long size = 0L; for (AllocationManager.BufferLedger ledger: ledgers) { size += ledger.getAccountedSize(); } for (BatchHolder batchHolder: batchHolders) { size += batchHolder.getActualSize(); } return size; }