Java Code Examples for org.apache.kylin.metadata.project.ProjectManager#listEffectiveRewriteMeasures()
The following examples show how to use
org.apache.kylin.metadata.project.ProjectManager#listEffectiveRewriteMeasures() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OLAPTable.java From Kylin with Apache License 2.0 | 6 votes |
private List<ColumnDesc> listSourceColumns() { ProjectManager mgr = ProjectManager.getInstance(olapSchema.getConfig()); List<ColumnDesc> exposedColumns = Lists.newArrayList(mgr.listExposedColumns(olapSchema.getProjectName(), sourceTable.getIdentity())); List<MeasureDesc> countMeasures = mgr.listEffectiveRewriteMeasures(olapSchema.getProjectName(), sourceTable.getIdentity()); HashSet<String> metFields = new HashSet<String>(); for (MeasureDesc m : countMeasures) { FunctionDesc func = m.getFunction(); String fieldName = func.getRewriteFieldName(); if (!metFields.contains(fieldName)) { metFields.add(fieldName); ColumnDesc fakeCountCol = new ColumnDesc(); fakeCountCol.setName(fieldName); fakeCountCol.setDatatype(func.getSQLType()); fakeCountCol.setNullable(false); fakeCountCol.init(sourceTable); exposedColumns.add(fakeCountCol); } } return exposedColumns; }
Example 2
Source File: OLAPTable.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private List<ColumnDesc> listSourceColumns() { ProjectManager mgr = ProjectManager.getInstance(olapSchema.getConfig()); List<ColumnDesc> tableColumns = mgr.listExposedColumns(olapSchema.getProjectName(), sourceTable, exposeMore); List<ColumnDesc> metricColumns = Lists.newArrayList(); List<MeasureDesc> countMeasures = mgr.listEffectiveRewriteMeasures(olapSchema.getProjectName(), sourceTable.getIdentity()); HashSet<String> metFields = new HashSet<String>(); for (MeasureDesc m : countMeasures) { FunctionDesc func = m.getFunction(); String fieldName = func.getRewriteFieldName(); if (!metFields.contains(fieldName)) { metFields.add(fieldName); ColumnDesc fakeCountCol = func.newFakeRewriteColumn(sourceTable); metricColumns.add(fakeCountCol); } } Collections.sort(tableColumns, new Comparator<ColumnDesc>() { @Override public int compare(ColumnDesc o1, ColumnDesc o2) { return o1.getZeroBasedIndex() - o2.getZeroBasedIndex(); } }); return Lists.newArrayList(Iterables.concat(tableColumns, metricColumns)); }
Example 3
Source File: OLAPTable.java From kylin with Apache License 2.0 | 5 votes |
private List<ColumnDesc> listSourceColumns() { ProjectManager mgr = ProjectManager.getInstance(olapSchema.getConfig()); List<ColumnDesc> tableColumns = mgr.listExposedColumns(olapSchema.getProjectName(), sourceTable, exposeMore); List<ColumnDesc> metricColumns = Lists.newArrayList(); List<MeasureDesc> countMeasures = mgr.listEffectiveRewriteMeasures(olapSchema.getProjectName(), sourceTable.getIdentity()); HashSet<String> metFields = new HashSet<String>(); for (MeasureDesc m : countMeasures) { FunctionDesc func = m.getFunction(); String fieldName = func.getRewriteFieldName(); if (!metFields.contains(fieldName)) { metFields.add(fieldName); ColumnDesc fakeCountCol = func.newFakeRewriteColumn(sourceTable); metricColumns.add(fakeCountCol); } } Collections.sort(tableColumns, new Comparator<ColumnDesc>() { @Override public int compare(ColumnDesc o1, ColumnDesc o2) { return o1.getZeroBasedIndex() - o2.getZeroBasedIndex(); } }); return Lists.newArrayList(Iterables.concat(tableColumns, metricColumns)); }