use of org.apache.drill.exec.ops.ExecutorFragmentContext in project drill by apache.
the class ReadersInitializer method init.
/**
* Selects reader constructor reference as {@link HiveReaderFactory} readerFactory.
* Then check if input splits are empty creates empty record reader, or one reader per split otherwise.
*
* @param ctx context related to fragment
* @param config context which holds different Hive configurations
* @return list containing one or more readers
*/
public static List<RecordReader> init(ExecutorFragmentContext ctx, HiveSubScan config) {
final HiveReaderFactory readerFactory = getReaderFactory(config);
final UserGroupInformation proxyUgi = ImpersonationUtil.createProxyUgi(config.getUserName(), ctx.getQueryUserName());
final List<List<InputSplit>> inputSplits = config.getInputSplits();
final HiveConf hiveConf = config.getHiveConf();
if (inputSplits.isEmpty()) {
return Collections.singletonList(readerFactory.createReader(config.getTable(), null, /*partition*/
null, /*split*/
config.getColumns(), ctx, hiveConf, proxyUgi));
} else {
IndexedPartitions partitions = getPartitions(config);
return IntStream.range(0, inputSplits.size()).mapToObj(idx -> readerFactory.createReader(config.getTable(), partitions.get(idx), inputSplits.get(idx), config.getColumns(), ctx, hiveConf, proxyUgi)).collect(Collectors.toList());
}
}
use of org.apache.drill.exec.ops.ExecutorFragmentContext in project drill by apache.
the class HashJoinBatch method initializeRuntimeFilter.
/**
* Note: This method can not be called again as part of recursive call of
* executeBuildPhase() to handle spilled build partitions.
*/
private void initializeRuntimeFilter() {
if (!enableRuntimeFilter || bloomFiltersGenerated) {
return;
}
runtimeFilterReporter = new RuntimeFilterReporter((ExecutorFragmentContext) context);
RuntimeFilterDef runtimeFilterDef = popConfig.getRuntimeFilterDef();
// RuntimeFilterRouter's judgement will have the RuntimeFilterDef.
if (runtimeFilterDef != null) {
List<BloomFilterDef> bloomFilterDefs = runtimeFilterDef.getBloomFilterDefs();
for (BloomFilterDef bloomFilterDef : bloomFilterDefs) {
int buildFieldId = bloomFilterDef2buildId.get(bloomFilterDef);
int numBytes = bloomFilterDef.getNumBytes();
String probeField = bloomFilterDef.getProbeField();
probeFields.add(probeField);
BloomFilter bloomFilter = new BloomFilter(numBytes, context.getAllocator());
bloomFilters.add(bloomFilter);
bloomFilter2buildId.put(bloomFilter, buildFieldId);
}
}
bloomFiltersGenerated = true;
}
Aggregations