Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private CubeQueryConfUtil() {
public static final String VALID_STORAGE_DIM_TABLES = "lens.cube.query.valid." + "dim.storgaetables";
public static final String DRIVER_SUPPORTED_STORAGES = "lens.cube.query.driver." + "supported.storages";
public static final String FAIL_QUERY_ON_PARTIAL_DATA = "lens.cube.query.fail.if.data.partial";
public static final String SKIP_FACTS_ON_NO_DATA = "lens.cube.facts.skip.on.no.data";
public static final String NON_EXISTING_PARTITIONS = "lens.cube.query.nonexisting.partitions";
public static final String ENABLE_MULTI_TABLE_SELECT = "lens.cube.query.enable.multi.table.select";
public static final String QUERY_MAX_INTERVAL = "lens.cube.query.max.interval";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class StorageTableResolver implements ContextRewriter {
private final boolean allStoragesSupported;
CubeMetastoreClient client;
private final boolean failOnPartialData;
private final boolean skipOnNoData;
private final List<String> validDimTables;
private final Map<CubeFactTable, Map<UpdatePeriod, Set<String>>> validStorageMap =
new HashMap<CubeFactTable, Map<UpdatePeriod, Set<String>>>();
Expand Down Expand Up @@ -85,6 +86,7 @@ public StorageTableResolver(Configuration conf) {
this.supportedStorages = getSupportedStorages(conf);
this.allStoragesSupported = (supportedStorages == null);
this.failOnPartialData = conf.getBoolean(CubeQueryConfUtil.FAIL_QUERY_ON_PARTIAL_DATA, false);
this.skipOnNoData = conf.getBoolean(CubeQueryConfUtil.SKIP_FACTS_ON_NO_DATA, false);
String str = conf.get(CubeQueryConfUtil.VALID_STORAGE_DIM_TABLES);
validDimTables = StringUtils.isBlank(str) ? null : Arrays.asList(StringUtils.split(str.toLowerCase(), ","));
this.processTimePartCol = conf.get(CubeQueryConfUtil.PROCESS_TIME_PART_COL);
Expand Down Expand Up @@ -191,7 +193,7 @@ private void resolveDimStorageTablesAndPartitions(CubeQueryContext cubeql) throw
} else {
LOG.info("Partition " + StorageConstants.LATEST_PARTITION_VALUE + " does not exist on " + tableName);
}
if (!failOnPartialData || foundPart) {
if ((!skipOnNoData && !failOnPartialData) || foundPart) {
storageTables.add(tableName);
String whereClause =
StorageUtil.getWherePartClause(dim.getTimedDimension(), null,
Expand Down Expand Up @@ -325,7 +327,15 @@ private void resolveFactStoragePartitions(CubeQueryContext cubeql) throws Semant
noPartsForRange = true;
continue;
}
cfact.incrementPartsQueried(rangeParts.size());
if (skipOnNoData) {
for (FactPartition part : rangeParts) {
if (part.found()) {
cfact.incrementPartsQueried(1);
}
}
} else {
cfact.incrementPartsQueried(rangeParts.size());
}
answeringParts.addAll(rangeParts);
cfact.getPartsQueried().addAll(rangeParts);
cfact.getRangeToWhereClause().put(range, rangeWriter.getTimeRangeWhereClause(cubeql,
Expand Down Expand Up @@ -512,10 +522,6 @@ private boolean getPartitions(CubeFactTable fact, Date fromDate, Date toDate, St
partWhereClauseFormat));
}
LOG.info("added all sub partitions blindly in pPart: " + pPart);
// if (!getPartitions(fact, dt, cal.getTime(), partCol, pPart, partitions, newset, false,
// skipStorageCauses, nonExistingParts)) {
// LOG.info("No partitions found in look ahead range");
// }
}
}
}
Expand Down