use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method testSubtraction.
public void testSubtraction() {
Set<String> functionNameSet = new HashSet<String>();
functionNameSet.add("-");
CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
try {
Query q = getParsedQueryForExpr(cftab, "([Measures].[Store Cost] - [Measures].[Unit Sales])");
q.resolve(q.createValidator(cftab, true));
} catch (Throwable e) {
fail(e.getMessage());
}
}
use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method testMixingMemberLimitation.
/**
* Mondrian is not strict about referencing a dimension member in calculated
* measures.
*
* <p>The following expression passes parsing and validation.
* Its computation is strange: the result is as if the measure is defined as
* ([Measures].[Store Cost] + [Measures].[Store Cost])
*/
public void testMixingMemberLimitation() {
Set<String> functionNameSet = new HashSet<String>();
functionNameSet.add("+");
CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
try {
Query q = getParsedQueryForExpr(cftab, "([Measures].[Store Cost] + [Store].[USA])");
q.resolve(q.createValidator(cftab, true));
// Shouldn't reach here
fail("Expected error did not occur.");
} catch (Throwable e) {
checkErrorMsg(e, "Expected error did not occur.");
}
}
use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method getCustomizedFunctionTable.
CustomizedFunctionTable getCustomizedFunctionTable(Set<String> funNameSet) {
Set<FunDef> specialFunctions = new HashSet<FunDef>();
specialFunctions.add(new ParenthesesFunDef(Category.Numeric));
CustomizedFunctionTable cftab = new CustomizedFunctionTable(funNameSet, specialFunctions);
cftab.init();
return cftab;
}
use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method testTupleFail.
public void testTupleFail() {
Set<String> functionNameSet = new HashSet<String>();
functionNameSet.add("+");
functionNameSet.add("-");
functionNameSet.add("*");
functionNameSet.add("/");
CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
try {
Query q = getParsedQueryForExpr(cftab, "([Store].[USA], [Gender].[F])");
q.resolve(q.createValidator(cftab, true));
// Shouldn't reach here
fail("Expected error did not occur.");
} catch (Throwable e) {
checkErrorMsg(e, "Mondrian Error:No function matches signature '(<Member>, <Member>)'");
}
}
Aggregations