use of mondrian.olap.type.DimensionType in project mondrian by pentaho.
the class QueryAxis method resolve.
public void resolve(Validator validator) {
exp = validator.validate(exp, false);
final Type type = exp.getType();
if (!TypeUtil.isSet(type)) {
// members, thence to sets.
if (type instanceof MemberType || type instanceof TupleType || type instanceof DimensionType || type instanceof HierarchyType) {
exp = new UnresolvedFunCall("{}", Syntax.Braces, new Exp[] { exp });
exp = validator.validate(exp, false);
} else {
throw MondrianResource.instance().MdxAxisIsNotSet.ex(axisOrdinal.name());
}
}
}
use of mondrian.olap.type.DimensionType in project mondrian by pentaho.
the class AbstractExpCompiler method compileHierarchy.
public HierarchyCalc compileHierarchy(Exp exp) {
final Type type = exp.getType();
if (type instanceof DimensionType) {
// <Dimension> --> unique Hierarchy else error
// Resolve at compile time if constant
final Dimension dimension = type.getDimension();
if (dimension != null) {
final Hierarchy hierarchy = FunUtil.getDimensionDefaultHierarchy(dimension);
if (hierarchy != null) {
return (HierarchyCalc) ConstantCalc.constantHierarchy(hierarchy);
} else {
// cell) but we prefer to give an error at validate time.
throw MondrianResource.instance().CannotImplicitlyConvertDimensionToHierarchy.ex(dimension.getName());
}
}
final DimensionCalc dimensionCalc = compileDimension(exp);
return new DimensionHierarchyCalc(new DummyExp(HierarchyType.forType(type)), dimensionCalc);
}
if (type instanceof MemberType) {
// <Member> --> <Member>.Hierarchy
final MemberCalc memberCalc = compileMember(exp);
return new MemberHierarchyFunDef.CalcImpl(new DummyExp(HierarchyType.forType(type)), memberCalc);
}
if (type instanceof LevelType) {
// <Level> --> <Level>.Hierarchy
final LevelCalc levelCalc = compileLevel(exp);
return new LevelHierarchyFunDef.CalcImpl(new DummyExp(HierarchyType.forType(type)), levelCalc);
}
assert type instanceof HierarchyType;
return (HierarchyCalc) compile(exp);
}
Aggregations