@Test public void testIsCapable() { HybridInstance hybridInstance = new HybridInstance(); LinkedHashSet<TblColRef> linkedHashSet = new LinkedHashSet<>(); TupleInfo tupleInfo = new TupleInfo(); Tuple tuple = new Tuple(tupleInfo); SQLDigest sQLDigest = new SQLDigest("6Bw^[(:[hOd", linkedHashSet, new LinkedList<>(), tuple.getAllColumns(), linkedHashSet, new ConcurrentHashMap<>(), false, linkedHashSet, new LinkedList<>(), new LinkedList<>(), new LinkedList<>(), linkedHashSet, linkedHashSet, linkedHashSet, null, null, tuple.getAllColumns(), new LinkedList<>(), true, true, false, new LinkedHashSet<>()); CapabilityResult capabilityResult = hybridInstance.isCapable(sQLDigest); assertNotNull(capabilityResult); assertFalse(capabilityResult.capable); assertEquals(2147483646, capabilityResult.cost); }
@Override public CapabilityResult isCapable(SQLDigest digest) { CapabilityResult result = new CapabilityResult(); result.cost = Integer.MAX_VALUE; for (IRealization realization : getRealizations()) { CapabilityResult child = realization.isCapable(digest); if (child.capable) { result.capable = true; result.cost = Math.min(result.cost, child.cost); result.influences.addAll(child.influences); } else { result.incapableCause = child.incapableCause; } } if (result.cost > 0) result.cost--; return result; }
HybridInstance extends RootPersistentEntity implements IRealization { @Override public CapabilityResult isCapable(SQLDigest digest) { CapabilityResult result = new CapabilityResult(); result.cost = Integer.MAX_VALUE; for (IRealization realization : getRealizations()) { CapabilityResult child = realization.isCapable(digest); if (child.capable) { result.capable = true; result.cost = Math.min(result.cost, child.cost); result.influences.addAll(child.influences); } else { result.incapableCause = child.incapableCause; } } if (result.cost > 0) result.cost--; return result; } }
HybridInstance extends RootPersistentEntity implements IRealization { @Override public CapabilityResult isCapable(SQLDigest digest) { CapabilityResult result = new CapabilityResult(); result.cost = Integer.MAX_VALUE; for (IRealization realization : getRealizations()) { CapabilityResult child = realization.isCapable(digest); if (child.capable) { result.capable = true; result.cost = Math.min(result.cost, child.cost); result.influences.addAll(child.influences); } else { result.incapableCause = child.incapableCause; } } if (result.cost > 0) result.cost--; return result; }  }
HybridInstance extends RootPersistentEntity implements IRealization { @Override public CapabilityResult isCapable(SQLDigest digest) { CapabilityResult result = new CapabilityResult(); result.cost = Integer.MAX_VALUE; for (IRealization realization : getRealizations()) { CapabilityResult child = realization.isCapable(digest); if (child.capable) { result.capable = true; result.cost = Math.min(result.cost, child.cost); result.influences.addAll(child.influences); } else { result.incapableCause = child.incapableCause; } } if (result.cost > 0) result.cost--; return result; }  static HybridInstance create(KylinConfig config, String name, List<RealizationEntry> realizationEntries); @Override String resourceName(); List<RealizationEntry> getRealizationEntries(); void setRealizationEntries(List<RealizationEntry> realizationEntries); @Override CapabilityResult isCapable(SQLDigest digest); @Override int getCost(); @Override RealizationType getType(); @Override DataModelDesc getModel(); @Override Set<TblColRef> getAllColumns(); @Override Set<ColumnDesc> getAllColumnDescs(); @Override List<MeasureDesc> getMeasures(); @Override boolean isReady(); @Override String getName(); void setName(String name); @Override String toString(); @Override String getCanonicalName(); @Override KylinConfig getConfig(); void setConfig(KylinConfig config); @Override long getDateRangeStart(); @Override long getDateRangeEnd(); @Override boolean supportsLimitPushDown(); @Override List<TblColRef> getAllDimensions(); IRealization[] getRealizations(); String getResourcePath(); static String concatResourcePath(String hybridName); void setCost(int cost); IRealization getLatestRealization(); @Override int getStorageType(); }
HybridInstance extends RootPersistentEntity implements IRealization { @Override public CapabilityResult isCapable(SQLDigest digest) { CapabilityResult result = new CapabilityResult(); result.cost = Integer.MAX_VALUE; for (IRealization realization : getRealizations()) { CapabilityResult child = realization.isCapable(digest); if (child.capable) { result.capable = true; result.cost = Math.min(result.cost, child.cost); result.influences.addAll(child.influences); } else { result.incapableCause = child.incapableCause; } } if (result.cost > 0) result.cost--; return result; }  static HybridInstance create(KylinConfig config, String name, List<RealizationEntry> realizationEntries); @Override String resourceName(); List<RealizationEntry> getRealizationEntries(); void setRealizationEntries(List<RealizationEntry> realizationEntries); @Override CapabilityResult isCapable(SQLDigest digest); @Override int getCost(); @Override RealizationType getType(); @Override DataModelDesc getModel(); @Override Set<TblColRef> getAllColumns(); @Override Set<ColumnDesc> getAllColumnDescs(); @Override List<MeasureDesc> getMeasures(); @Override boolean isReady(); @Override String getName(); void setName(String name); @Override String toString(); @Override String getCanonicalName(); @Override KylinConfig getConfig(); void setConfig(KylinConfig config); @Override long getDateRangeStart(); @Override long getDateRangeEnd(); @Override boolean supportsLimitPushDown(); @Override List<TblColRef> getAllDimensions(); IRealization[] getRealizations(); String getResourcePath(); static String concatResourcePath(String hybridName); void setCost(int cost); IRealization getLatestRealization(); @Override int getStorageType();  }