public static IncapableCause unmatchedAggregations(Collection<FunctionDesc> unmatchedAggregations) { IncapableCause incapableCause = new IncapableCause(); incapableCause.setIncapableType(IncapableType.UNMATCHED_AGGREGATION); incapableCause.setUnmatchedAggregations(unmatchedAggregations); return incapableCause; }
public static IncapableCause create(IncapableType incapableType) { IncapableCause incapableCause = new IncapableCause(); incapableCause.setIncapableType(incapableType); return incapableCause; }
public static IncapableCause unmatchedDimensions(Collection<TblColRef> unmatchedDimensions) { IncapableCause incapableCause = new IncapableCause(); incapableCause.setIncapableType(IncapableType.UNMATCHED_DIMENSION); incapableCause.setUnmatchedDimensions(unmatchedDimensions); return incapableCause; }
@Test public void test() throws Exception { final RealizationRegistry registry = RealizationRegistry.getInstance(KylinConfig.getInstanceFromEnv()); final Set<RealizationType> realizationTypes = registry.getRealizationTypes(); assertEquals(RealizationType.values().length - 1, realizationTypes.size()); } }
@Override public void onProjectSchemaChange(Broadcaster broadcaster, String project) throws IOException { ProjectManager projectManager = ProjectManager.getInstance(config); for (IRealization real : projectManager.listAllRealizations(project)) { if (real instanceof CubeInstance) { reloadCubeQuietly(real.getName()); } } projectManager.reloadProjectL2Cache(project); }
public static boolean accept(IRealization real) { String canonicalName = real.getCanonicalName(); if (blackList.contains(canonicalName)) return false; if (!whiteList.isEmpty() && !whiteList.contains(canonicalName)) return false; String filterClz = real.getConfig().getQueryRealizationFilter(); if (filterClz != null) { if (!getFilterImpl(real.getConfig()).accept(real)) return false; } return true; }
public Candidate(IRealization realization, SQLDigest sqlDigest) { this.realization = realization; this.sqlDigest = sqlDigest; this.priority = PRIORITIES.get(realization.getType()); }
private IRealization getRealization(RealizationEntry realizationEntry) { return realizationRegistry.getRealization(realizationEntry.getType(), realizationEntry.getRealization()); }
public static String getPrintableText(List<Candidate> candidates) { StringBuffer sb = new StringBuffer(); sb.append("["); for (Candidate candidate : candidates) { IRealization r = candidate.realization; sb.append(r.getCanonicalName()); sb.append(","); } if (sb.charAt(sb.length() - 1) != '[') sb.deleteCharAt(sb.length() - 1); sb.append("]"); return sb.toString(); }
@Override public String toString() { return "" + type.name() + "." + realization; }
static RealizationRegistry newInstance(KylinConfig config) throws IOException { return new RealizationRegistry(config); }
@Override public int compare(IRealization o1, IRealization o2) { long i1 = o1.getDateRangeStart(); long i2 = o2.getDateRangeStart(); long comp = i1 - i2; if (comp != 0) { return comp > 0 ? 1 : -1; } i1 = o1.getDateRangeEnd(); i2 = o2.getDateRangeEnd(); comp = i1 - i2; if (comp != 0) { return comp > 0 ? 1 : -1; } return 0; } });
@Override public int hashCode() { int result = type != null ? type.hashCode() : 0; result = 31 * result + (realization != null ? realization.hashCode() : 0); return result; }
private RealizationRegistry(KylinConfig config) throws IOException { logger.info("Initializing RealizationRegistry with metadata url " + config); this.config = config; init(); }
@Override public CapabilityResult isCapable(SQLDigest digest) { CapabilityResult result = CubeCapabilityChecker.check(this, digest); if (result.capable) { result.cost = getCost(digest); for (CapabilityInfluence i : result.influences) { result.cost *= (i.suggestCostMultiplier() == 0) ? 1.0 : i.suggestCostMultiplier(); } } else { result.cost = -1; } return result; }
@Override public int getCost() { int c = Integer.MAX_VALUE; for (IRealization realization : getRealizations()) { c = Math.min(realization.getCost(), c); } return c; }
@Override public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + (status != null ? status.hashCode() : 0); result = 31 * result + (segmentSignatureSet != null ? segmentSignatureSet.hashCode() : 0); return result; }
protected List<Integer> findRealizationsOf(List<IRealization> realizations, RealizationType type) { List<Integer> itemIndexes = Lists.newArrayList(); for (int i = 0; i < realizations.size(); ++i) { if (realizations.get(i).getType() == type) { itemIndexes.add(i); } } return itemIndexes; }
private IRealization getRealization(RealizationEntry realizationEntry) { return realizationRegistry.getRealization(realizationEntry.getType(), realizationEntry.getRealization()); }