Search in sources :

Example 11 with Exp

use of mondrian.olap.Exp in project mondrian by pentaho.

the class SqlConstraintUtilsTest method makeSupportedExpressionForCalculatedMember.

private Exp makeSupportedExpressionForCalculatedMember() {
    Exp memberExpr = new MemberExpr(Mockito.mock(Member.class));
    Assert.assertEquals(true, SqlConstraintUtils.isSupportedExpressionForCalculatedMember(memberExpr));
    return memberExpr;
}
Also used : MemberExpr(mondrian.mdx.MemberExpr) Exp(mondrian.olap.Exp) Member(mondrian.olap.Member) TestMember(mondrian.olap.fun.TestMember)

Example 12 with Exp

use of mondrian.olap.Exp in project mondrian by pentaho.

the class TopCountNativeEvaluatorTest method testNonNative_WhenTwoParametersArePassed.

/**
 * For now, prohibit native evaluation of the function if has two
 * parameters. According to the specification, this means
 * the function should behave similarly to {@code HEAD} function.
 * However, native evaluation joins data with the fact table and if there
 * is no data there, then some records are ignored, what is not correct.
 *
 * @see <a href="http://jira.pentaho.com/browse/MONDRIAN-2394">MONDRIAN-2394</a>
 */
public void testNonNative_WhenTwoParametersArePassed() throws Exception {
    RolapNativeTopCount nativeTopCount = createTopCountSpy();
    doReturn(true).when(nativeTopCount).isValidContext(any(RolapEvaluator.class));
    Exp[] arguments = new Exp[] { new DummyExp(new EmptyType()), Literal.create(BigDecimal.ONE) };
    assertNull("Native evaluator should not be created when " + "two parameters are passed", nativeTopCount.createEvaluator(null, mockFunctionDef(), arguments));
}
Also used : DummyExp(mondrian.calc.DummyExp) EmptyType(mondrian.olap.type.EmptyType) DummyExp(mondrian.calc.DummyExp) Exp(mondrian.olap.Exp)

Example 13 with Exp

use of mondrian.olap.Exp in project mondrian by pentaho.

the class NumberSqlCompilerTest method checkAcceptsString.

private void checkAcceptsString(String value) {
    Exp exp = Literal.createString(value);
    assertNotNull(value, compiler.compile(exp));
}
Also used : DummyExp(mondrian.calc.DummyExp) Exp(mondrian.olap.Exp)

Example 14 with Exp

use of mondrian.olap.Exp in project mondrian by pentaho.

the class NumberSqlCompilerTest method checkRejectsString.

private void checkRejectsString(String value) {
    Exp exp = Literal.createString(value);
    try {
        compiler.compile(exp);
    } catch (MondrianEvaluationException e) {
        return;
    }
    fail("Expected to get MondrianEvaluationException for " + value);
}
Also used : MondrianEvaluationException(mondrian.olap.fun.MondrianEvaluationException) DummyExp(mondrian.calc.DummyExp) Exp(mondrian.olap.Exp)

Example 15 with Exp

use of mondrian.olap.Exp in project mondrian by pentaho.

the class NumberSqlCompilerTest method testAcceptsNumeric.

public void testAcceptsNumeric() {
    Exp exp = Literal.create(BigDecimal.ONE);
    assertNotNull(compiler.compile(exp));
}
Also used : DummyExp(mondrian.calc.DummyExp) Exp(mondrian.olap.Exp)

Aggregations

Exp (mondrian.olap.Exp)18 ResolvedFunCall (mondrian.mdx.ResolvedFunCall)9 Member (mondrian.olap.Member)9 TestMember (mondrian.olap.fun.TestMember)7 DummyExp (mondrian.calc.DummyExp)5 MemberExpr (mondrian.mdx.MemberExpr)5 FunDef (mondrian.olap.FunDef)5 NullFunDef (mondrian.olap.fun.CrossJoinTest.NullFunDef)5 NullType (mondrian.olap.type.NullType)5 AggregateFunDef (mondrian.olap.fun.AggregateFunDef)4 ParenthesesFunDef (mondrian.olap.fun.ParenthesesFunDef)4 TupleType (mondrian.olap.type.TupleType)4 Type (mondrian.olap.type.Type)4 ArrayList (java.util.ArrayList)3 TupleList (mondrian.calc.TupleList)3 UnaryTupleList (mondrian.calc.impl.UnaryTupleList)3 DecimalType (mondrian.olap.type.DecimalType)3 List (java.util.List)2 TupleIterable (mondrian.calc.TupleIterable)2 SetEvaluator (mondrian.olap.Evaluator.SetEvaluator)2