本文整理汇总了Java中org.apache.kylin.metadata.realization.IRealization类的典型用法代码示例。如果您正苦于以下问题:Java IRealization类的具体用法?Java IRealization怎么用?Java IRealization使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IRealization类属于org.apache.kylin.metadata.realization包,在下文中一共展示了IRealization类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listEffectiveRewriteMeasures
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
public List<MeasureDesc> listEffectiveRewriteMeasures(String project, String table, boolean onlyRewriteMeasure) {
Set<IRealization> realizations = getRealizationsByTable(project, table);
List<MeasureDesc> result = Lists.newArrayList();
for (IRealization r : realizations) {
if (!r.isReady())
continue;
for (MeasureDesc m : r.getMeasures()) {
FunctionDesc func = m.getFunction();
if (belongToTable(func, table, r.getModel())) {
if (!onlyRewriteMeasure || func.needRewrite()) {
result.add(m);
}
}
}
}
return result;
}
示例2: isCapable
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
@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--; // let hybrid win its children
return result;
}
示例3: applyLimitPushDown
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
public void applyLimitPushDown(IRealization realization, StorageLimitLevel storageLimitLevel) {
if (storageLimitLevel == StorageLimitLevel.NO_LIMIT) {
return;
}
if (!realization.supportsLimitPushDown()) {
logger.warn("Not enabling limit push down because cube storage type not supported");
return;
}
long temp = this.getOffset() + this.getLimit();
if (!isValidPushDownLimit(temp)) {
logger.warn("Not enabling limit push down because current limit is invalid: " + this.getLimit());
return;
}
this.finalPushDownLimit = (int) temp;
this.storageLimitLevel = storageLimitLevel;
logger.info("Enabling limit push down: {} at level: {}", temp, storageLimitLevel);
}
示例4: createQuery
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
@Override
public IStorageQuery createQuery(IRealization realization) {
if (realization.getType() == RealizationType.CUBE) {
CubeInstance cubeInstance = (CubeInstance) realization;
String cubeStorageQuery;
if (cubeInstance.getStorageType() == IStorageAware.ID_HBASE) {//v2 query engine cannot go with v1 storage now
throw new IllegalStateException("Storage Engine (id=" + IStorageAware.ID_HBASE + ") is not supported any more");
} else {
cubeStorageQuery = v2CubeStorageQuery;//by default use v2
}
IStorageQuery ret;
try {
ret = (IStorageQuery) Class.forName(cubeStorageQuery).getConstructor(CubeInstance.class).newInstance((CubeInstance) realization);
} catch (Exception e) {
throw new RuntimeException("Failed to initialize storage query for " + cubeStorageQuery, e);
}
return ret;
} else {
throw new IllegalArgumentException("Unknown realization type " + realization.getType());
}
}
示例5: selectRealization
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
public static IRealization selectRealization(OLAPContext olapContext) throws NoRealizationFoundException {
ProjectManager prjMgr = ProjectManager.getInstance(olapContext.olapSchema.getConfig());
String factTableName = olapContext.firstTableScan.getTableName();
String projectName = olapContext.olapSchema.getProjectName();
List<IRealization> realizations = Lists.newArrayList(prjMgr.getRealizationsByTable(projectName, factTableName));
logger.info("Find candidates by table " + factTableName + " and project=" + projectName + " : " + StringUtils.join(realizations, ","));
//rule based realization selection, rules might reorder realizations or remove specific realization
RoutingRule.applyRules(realizations, olapContext);
if (realizations.size() == 0) {
throw new NoRealizationFoundException("Can't find any realization. Please confirm with providers. SQL digest: " + olapContext.getSQLDigest().toString());
}
logger.info("The realizations remaining: ");
logger.info(RoutingRule.getPrintableText(realizations));
logger.info("The realization being chosen: " + realizations.get(0).getName());
return realizations.get(0);
}
示例6: apply
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
@Override
public void apply(List<IRealization> realizations, OLAPContext olapContext) {
if (realizations.size() > 0) {
IRealization first = realizations.get(0);
if (first instanceof CubeInstance) {
CubeInstance cube = (CubeInstance) first;
adjustOLAPContextIfNecessary(cube, olapContext);
}
if (first instanceof IIInstance) {
IIInstance ii = (IIInstance) first;
adjustOLAPContextIfNecessary(ii, olapContext);
}
}
}
示例7: wireProjectAndRealizations
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
private void wireProjectAndRealizations(Collection<ProjectInstance> projectInstances) {
if (projectInstances.isEmpty())
return;
RealizationRegistry registry = RealizationRegistry.getInstance(config);
for (ProjectInstance projectInstance : projectInstances) {
for (RealizationEntry realization : projectInstance.getRealizationEntries()) {
IRealization rel = registry.getRealization(realization.getType(), realization.getRealization());
if (rel != null) {
rel.setProjectName(projectInstance.getName());
} else {
logger.warn("Realization '" + realization + "' defined under project '" + projectInstance + "' is not found");
}
}
}
}
示例8: getPrintableText
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
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();
}
示例9: findRealizationsOf
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
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;
}
示例10: accept
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
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;
}
示例11: testRealizationCheck
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
@Test
public void testRealizationCheck() {
RealizationCheck realizationCheck = new RealizationCheck();
CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc("ssb");
DataModelDesc dataModelDesc = cubeDesc.getModel();
IRealization iRealization = CubeInstance.create("ssb", cubeDesc);
realizationCheck.addCubeIncapableReason(iRealization,
RealizationCheck.IncapableReason.create(RealizationCheck.IncapableType.CUBE_NOT_CONTAIN_ALL_COLUMN));
realizationCheck.addCubeIncapableReason(iRealization,
RealizationCheck.IncapableReason.create(RealizationCheck.IncapableType.CUBE_NOT_CONTAIN_ALL_COLUMN));
Assert.assertTrue(realizationCheck.getCubeIncapableReasons().size() == 1);
realizationCheck.addModelIncapableReason(dataModelDesc,
RealizationCheck.IncapableReason.create(RealizationCheck.IncapableType.CUBE_NOT_CONTAIN_ALL_COLUMN));
realizationCheck.addModelIncapableReason(dataModelDesc,
RealizationCheck.IncapableReason.create(RealizationCheck.IncapableType.CUBE_NOT_CONTAIN_ALL_MEASURE));
realizationCheck.addModelIncapableReason(dataModelDesc,
RealizationCheck.IncapableReason.notContainAllColumn(Lists.<TblColRef> newArrayList()));
realizationCheck.addModelIncapableReason(dataModelDesc,
RealizationCheck.IncapableReason.notContainAllColumn(Lists.<TblColRef> newArrayList()));
Assert.assertTrue(realizationCheck.getModelIncapableReasons().size() == 1);
Assert.assertTrue(realizationCheck.getModelIncapableReasons().get(dataModelDesc).size() == 3);
realizationCheck.addModelIncapableReason(dataModelDesc, RealizationCheck.IncapableReason
.notContainAllColumn(Lists.<TblColRef> newArrayList(dataModelDesc.findColumn("LO_DATE"))));
Assert.assertTrue(realizationCheck.getModelIncapableReasons().size() == 1);
Assert.assertTrue(realizationCheck.getModelIncapableReasons().get(dataModelDesc).size() == 4);
}
示例12: executeExtract
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
@Override
protected void executeExtract(OptionsHelper optionsHelper, File exportDir) throws Exception {
kylinConfig = KylinConfig.getInstanceFromEnv();
cubeManager = CubeManager.getInstance(kylinConfig);
realizationRegistry = RealizationRegistry.getInstance(kylinConfig);
projectManager = ProjectManager.getInstance(kylinConfig);
if (optionsHelper.hasOption(OPTION_PROJECT)) {
String projectNames = optionsHelper.getOptionValue(OPTION_PROJECT);
for (String projectName: projectNames.split(",")) {
ProjectInstance projectInstance = projectManager.getProject(projectName);
if (projectInstance == null) {
throw new IllegalArgumentException("Project " + projectName + " does not exist");
}
List<RealizationEntry> realizationEntries = projectInstance.getRealizationEntries();
for (RealizationEntry realizationEntry : realizationEntries) {
retrieveResourcePath(getRealization(realizationEntry));
}
}
} else if (optionsHelper.hasOption(OPTION_CUBE)) {
String cubeNames = optionsHelper.getOptionValue(OPTION_CUBE);
for (String cubeName : cubeNames.split(",")) {
IRealization realization = cubeManager.getRealization(cubeName);
if (realization != null) {
retrieveResourcePath(realization);
} else {
throw new IllegalArgumentException("No cube found with name of " + cubeName);
}
}
}
extractCommonInfo(exportDir);
extractHTables(exportDir);
}
示例13: retrieveResourcePath
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
private void retrieveResourcePath(IRealization realization) {
logger.info("Deal with realization {} of type {}", realization.getName(), realization.getType());
if (realization instanceof CubeInstance) {
CubeInstance cube = (CubeInstance) realization;
for (CubeSegment segment : cube.getSegments()) {
addHTable(segment.getStorageLocationIdentifier());
}
} else {
logger.warn("Unknown realization type: " + realization.getType());
}
}
示例14: retrieveResourcePath
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
private void retrieveResourcePath(IRealization realization) throws IOException {
if (realization == null) {
return;
}
logger.info("Deal with realization {} of type {}", realization.getName(), realization.getType());
if (realization instanceof CubeInstance) {
CubeInstance cube = (CubeInstance) realization;
CubeDesc cubeDesc = cubeDescManager.getCubeDesc(cube.getDescName());
DataModelDesc modelDesc = metadataManager.getDataModelDesc(cubeDesc.getModelName());
// add tables
addTables(modelDesc);
// add streaming stuff
addStreamingConfig(cube);
// add cube
addRequired(CubeDesc.concatResourcePath(cubeDesc.getName()));
//add Segments and Jobs
addSegAndJob(cube);
} else if (realization instanceof HybridInstance) {
HybridInstance hybridInstance = (HybridInstance) realization;
addRequired(HybridInstance.concatResourcePath(hybridInstance.getName()));
for (IRealization iRealization : hybridInstance.getRealizations()) {
if (iRealization.getType() != RealizationType.CUBE) {
throw new RuntimeException("Hybrid " + iRealization.getName() + " contains non cube child "
+ iRealization.getName() + " with type " + iRealization.getType());
}
retrieveResourcePath(iRealization);
}
} else {
logger.warn("Unknown realization type: " + realization.getType());
}
}
示例15: getRealizationsByTable
import org.apache.kylin.metadata.realization.IRealization; //导入依赖的package包/类
public Set<IRealization> getRealizationsByTable(String project, String table) {
TableCache tableCache = getCache(project).tables.get(table);
if (tableCache == null)
return Collections.emptySet();
else
return Collections.unmodifiableSet(tableCache.realizations);
}