Java Code Examples for org.apache.kylin.metadata.model.MeasureDesc#getDependentMeasureRef()
The following examples show how to use
org.apache.kylin.metadata.model.MeasureDesc#getDependentMeasureRef() .
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: CubeDesc.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") private void initMeasureColumns() { if (measures == null || measures.isEmpty()) { return; } for (MeasureDesc m : measures) { m.setName(m.getName().toUpperCase(Locale.ROOT)); if (m.getDependentMeasureRef() != null) { m.setDependentMeasureRef(m.getDependentMeasureRef().toUpperCase(Locale.ROOT)); } FunctionDesc func = m.getFunction(); func.init(model); allColumns.addAll(func.getParameter().getColRefs()); if (ExtendedColumnMeasureType.FUNC_EXTENDED_COLUMN.equalsIgnoreCase(m.getFunction().getExpression())) { FunctionDesc functionDesc = m.getFunction(); List<TblColRef> hosts = ExtendedColumnMeasureType.getExtendedColumnHosts(functionDesc); TblColRef extendedColumn = ExtendedColumnMeasureType.getExtendedColumn(functionDesc); initExtendedColumnMap(hosts.toArray(new TblColRef[hosts.size()]), extendedColumn); } } }
Example 2
Source File: CuboidToGridTableMapping.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public Map<Integer, Integer> getDependentMetricsMap() { Map<Integer, Integer> result = Maps.newHashMap(); List<MeasureDesc> measures = cuboid.getCubeDesc().getMeasures(); for (MeasureDesc child : measures) { if (child.getDependentMeasureRef() != null) { boolean ok = false; for (MeasureDesc parent : measures) { if (parent.getName().equals(child.getDependentMeasureRef())) { int childIndex = getIndexOf(child.getFunction()); int parentIndex = getIndexOf(parent.getFunction()); result.put(childIndex, parentIndex); ok = true; break; } } if (!ok) throw new IllegalStateException("Cannot find dependent measure: " + child.getDependentMeasureRef()); } } return result.isEmpty() ? Collections.<Integer, Integer> emptyMap() : result; }
Example 3
Source File: CubeDesc.java From kylin with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") private void initMeasureColumns() { if (measures == null || measures.isEmpty()) { return; } for (MeasureDesc m : measures) { m.setName(m.getName().toUpperCase(Locale.ROOT)); if (m.getDependentMeasureRef() != null) { m.setDependentMeasureRef(m.getDependentMeasureRef().toUpperCase(Locale.ROOT)); } FunctionDesc func = m.getFunction(); func.init(model); allColumns.addAll(func.getParameter().getColRefs()); if (ExtendedColumnMeasureType.FUNC_EXTENDED_COLUMN.equalsIgnoreCase(m.getFunction().getExpression())) { FunctionDesc functionDesc = m.getFunction(); List<TblColRef> hosts = ExtendedColumnMeasureType.getExtendedColumnHosts(functionDesc); TblColRef extendedColumn = ExtendedColumnMeasureType.getExtendedColumn(functionDesc); initExtendedColumnMap(hosts.toArray(new TblColRef[hosts.size()]), extendedColumn); } } }
Example 4
Source File: CuboidToGridTableMapping.java From kylin with Apache License 2.0 | 6 votes |
public Map<Integer, Integer> getDependentMetricsMap() { Map<Integer, Integer> result = Maps.newHashMap(); List<MeasureDesc> measures = cuboid.getCubeDesc().getMeasures(); for (MeasureDesc child : measures) { if (child.getDependentMeasureRef() != null) { boolean ok = false; for (MeasureDesc parent : measures) { if (parent.getName().equals(child.getDependentMeasureRef())) { int childIndex = getIndexOf(child.getFunction()); int parentIndex = getIndexOf(parent.getFunction()); result.put(childIndex, parentIndex); ok = true; break; } } if (!ok) throw new IllegalStateException("Cannot find dependent measure: " + child.getDependentMeasureRef()); } } return result.isEmpty() ? Collections.<Integer, Integer> emptyMap() : result; }
Example 5
Source File: CubeDesc.java From Kylin with Apache License 2.0 | 5 votes |
private void initMeasureColumns(Map<String, TableDesc> tables) { if (measures == null || measures.isEmpty()) { return; } TableDesc factTable = tables.get(getFactTable()); for (MeasureDesc m : measures) { m.setName(m.getName().toUpperCase()); if (m.getDependentMeasureRef() != null) { m.setDependentMeasureRef(m.getDependentMeasureRef().toUpperCase()); } FunctionDesc f = m.getFunction(); f.setExpression(f.getExpression().toUpperCase()); f.setReturnDataType(DataType.getInstance(f.getReturnType())); ParameterDesc p = f.getParameter(); p.normalizeColumnValue(); if (p.isColumnType()) { ArrayList<TblColRef> colRefs = Lists.newArrayList(); for (String cName : p.getValue().split("\\s*,\\s*")) { ColumnDesc sourceColumn = factTable.findColumnByName(cName); TblColRef colRef = new TblColRef(sourceColumn); colRefs.add(colRef); allColumns.add(colRef); } if (colRefs.isEmpty() == false) p.setColRefs(colRefs); } } }
Example 6
Source File: CubeDesc.java From Kylin with Apache License 2.0 | 5 votes |
private void initMeasureColumns(Map<String, TableDesc> tables) { if (measures == null || measures.isEmpty()) { return; } TableDesc factTable = tables.get(getFactTable()); for (MeasureDesc m : measures) { m.setName(m.getName().toUpperCase()); if (m.getDependentMeasureRef() != null) { m.setDependentMeasureRef(m.getDependentMeasureRef().toUpperCase()); } FunctionDesc f = m.getFunction(); f.setExpression(f.getExpression().toUpperCase()); f.setReturnDataType(DataType.getInstance(f.getReturnType())); ParameterDesc p = f.getParameter(); p.normalizeColumnValue(); if (p.isColumnType()) { ArrayList<TblColRef> colRefs = Lists.newArrayList(); for (String cName : p.getValue().split("\\s*,\\s*")) { ColumnDesc sourceColumn = factTable.findColumnByName(cName); TblColRef colRef = new TblColRef(sourceColumn); colRefs.add(colRef); allColumns.add(colRef); } if (colRefs.isEmpty() == false) p.setColRefs(colRefs); } // verify holistic count distinct as a dependent measure if (m.isHolisticCountDistinct() && StringUtils.isBlank(m.getDependentMeasureRef())) { throw new IllegalStateException(m + " is a holistic count distinct but it has no DependentMeasureRef defined!"); } } }