本文整理汇总了Java中org.apache.kylin.metadata.model.FunctionDesc.getParameter方法的典型用法代码示例。如果您正苦于以下问题:Java FunctionDesc.getParameter方法的具体用法?Java FunctionDesc.getParameter怎么用?Java FunctionDesc.getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.kylin.metadata.model.FunctionDesc
的用法示例。
在下文中一共展示了FunctionDesc.getParameter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTopNCompatibleSum
import org.apache.kylin.metadata.model.FunctionDesc; //导入方法依赖的package包/类
private boolean isTopNCompatibleSum(FunctionDesc topN, FunctionDesc sum) {
if (sum == null)
return false;
if (!isTopN(topN))
return false;
TblColRef topnNumCol = getTopNNumericColumn(topN);
if (topnNumCol == null) {
if (sum.isCount())
return true;
return false;
}
if (sum.isSum() == false)
return false;
if (sum.getParameter() == null || sum.getParameter().getColRefs() == null
|| sum.getParameter().getColRefs().size() == 0)
return false;
TblColRef sumCol = sum.getParameter().getColRefs().get(0);
return sumCol.equals(topnNumCol);
}
示例2: buildValueOf
import org.apache.kylin.metadata.model.FunctionDesc; //导入方法依赖的package包/类
private Object buildValueOf(int idxOfMeasure, String[] flatRow) {
MeasureDesc measure = cubeDesc.getMeasures().get(idxOfMeasure);
FunctionDesc function = measure.getFunction();
int[] colIdxOnFlatTable = intermediateTableDesc.getMeasureColumnIndexes()[idxOfMeasure];
int paramCount = function.getParameterCount();
String[] inputToMeasure = new String[paramCount];
// pick up parameter values
ParameterDesc param = function.getParameter();
int colParamIdx = 0; // index among parameters of column type
for (int i = 0; i < paramCount; i++, param = param.getNextParameter()) {
String value;
if (function.isCount()) {
value = "1";
} else if (param.isColumnType()) {
value = getCell(colIdxOnFlatTable[colParamIdx++], flatRow);
} else {
value = param.getValue();
}
inputToMeasure[i] = value;
}
return aggrIngesters[idxOfMeasure].valueOf(inputToMeasure, measure, dictionaryMap);
}
示例3: buildValueOf
import org.apache.kylin.metadata.model.FunctionDesc; //导入方法依赖的package包/类
private Object buildValueOf(int idxOfMeasure, String[] row) {
MeasureDesc measure = measureDescs[idxOfMeasure];
FunctionDesc function = measure.getFunction();
int[] colIdxOnFlatTable = flatDesc.getMeasureColumnIndexes()[idxOfMeasure];
int paramCount = function.getParameterCount();
String[] inputToMeasure = new String[paramCount];
// pick up parameter values
ParameterDesc param = function.getParameter();
int paramColIdx = 0; // index among parameters of column type
for (int i = 0; i < paramCount; i++, param = param.getNextParameter()) {
String value;
if (function.isCount()) {
value = "1";
} else if (param.isColumnType()) {
value = row[colIdxOnFlatTable[paramColIdx++]];
} else {
value = param.getValue();
}
inputToMeasure[i] = value;
}
return measureIngesters[idxOfMeasure].valueOf(inputToMeasure, measure, dictionaryMap);
}
示例4: tryDimensionAsMeasures
import org.apache.kylin.metadata.model.FunctionDesc; //导入方法依赖的package包/类
private static void tryDimensionAsMeasures(Collection<FunctionDesc> unmatchedAggregations, CapabilityResult result,
Set<TblColRef> dimCols) {
Iterator<FunctionDesc> it = unmatchedAggregations.iterator();
while (it.hasNext()) {
FunctionDesc functionDesc = it.next();
// let calcite handle count
if (functionDesc.isCount()) {
it.remove();
continue;
}
// calcite can do aggregation from columns on-the-fly
ParameterDesc parameterDesc = functionDesc.getParameter();
if (parameterDesc == null) {
continue;
}
List<TblColRef> neededCols = parameterDesc.getColRefs();
if (neededCols.size() > 0 && dimCols.containsAll(neededCols)
&& FunctionDesc.BUILT_IN_AGGREGATIONS.contains(functionDesc.getExpression())) {
result.influences.add(new CapabilityResult.DimensionAsMeasure(functionDesc));
it.remove();
continue;
}
}
}
示例5: validate
import org.apache.kylin.metadata.model.FunctionDesc; //导入方法依赖的package包/类
@Override
public void validate(CubeDesc cube, ValidateContext context) {
List<MeasureDesc> measures = cube.getMeasures();
if (validateMeasureNamesDuplicated(measures, context)) {
return;
}
List<FunctionDesc> countFuncs = new ArrayList<FunctionDesc>();
Iterator<MeasureDesc> it = measures.iterator();
while (it.hasNext()) {
MeasureDesc measure = it.next();
FunctionDesc func = measure.getFunction();
ParameterDesc parameter = func.getParameter();
if (parameter == null) {
context.addResult(ResultLevel.ERROR, "Must define parameter for function " + func.getExpression() + " in " + measure.getName());
return;
}
String type = func.getParameter().getType();
String value = func.getParameter().getValue();
if (StringUtils.isEmpty(type)) {
context.addResult(ResultLevel.ERROR, "Must define type for parameter type " + func.getExpression() + " in " + measure.getName());
return;
}
if (StringUtils.isEmpty(value)) {
context.addResult(ResultLevel.ERROR, "Must define type for parameter value " + func.getExpression() + " in " + measure.getName());
return;
}
if (StringUtils.isEmpty(func.getReturnType())) {
context.addResult(ResultLevel.ERROR, "Must define return type for function " + func.getExpression() + " in " + measure.getName());
return;
}
if (StringUtils.equalsIgnoreCase(FunctionDesc.PARAMETER_TYPE_COLUMN, type)) {
validateColumnParameter(context, cube, value);
} else if (StringUtils.equals(FunctionDesc.PARAMETER_TYPE_CONSTANT, type)) {
validateCostantParameter(context, cube, value);
}
try {
func.getMeasureType().validate(func);
} catch (IllegalArgumentException ex) {
context.addResult(ResultLevel.ERROR, ex.getMessage());
}
if (func.isCount())
countFuncs.add(func);
if (TopNMeasureType.FUNC_TOP_N.equalsIgnoreCase(func.getExpression())) {
if (parameter.getNextParameter() == null) {
context.addResult(ResultLevel.ERROR, "Must define at least 2 parameters for function " + func.getExpression() + " in " + measure.getName());
return;
}
ParameterDesc groupByCol = parameter.getNextParameter();
List<String> duplicatedCol = Lists.newArrayList();
while (groupByCol != null) {
String embeded_groupby = groupByCol.getValue();
for (DimensionDesc dimensionDesc : cube.getDimensions()) {
if (dimensionDesc.getColumn() != null && dimensionDesc.getColumn().equalsIgnoreCase(embeded_groupby)) {
duplicatedCol.add(embeded_groupby);
}
}
groupByCol = groupByCol.getNextParameter();
}
}
}
if (countFuncs.size() != 1) {
context.addResult(ResultLevel.ERROR, "Must define one and only one count(1) function, but there are " + countFuncs.size() + " -- " + countFuncs);
}
}