Skip to content

Instantly share code, notes, and snippets.

@prateeka
Created August 30, 2022 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateeka/a745c27d9f0d35703af26c6fe9d7337b to your computer and use it in GitHub Desktop.
Save prateeka/a745c27d9f0d35703af26c6fe9d7337b to your computer and use it in GitHub Desktop.
atscale-3705: incorrect data type
case mpv: MemberPropertyValue[_] =>
calculationContext match {
case FilterCalculationContext(FilterFlatLevel(flatLevel)) =>
(mpv.property, mpv.typed) match {
case (_: MemberNameProperty | _: MemberCaption, _) =>
val v = resolveMDX(mpv.member)
v.physicalType match {
case _: VariableStringType | NullType => v
case _ => TypeConvertedValue(v, MaxStringType)
}
case (_: MemberKey, _) => resolveMDX(mpv.member)
case (_: LevelNumberProperty, true) => ConstantValue(flatLevel.depth)
case (_: LevelNumberProperty, false) => ConstantValue(flatLevel.depth.toString)
case other =>
throw new NotSupportedYetException(s"Unsupported member property in filter value: $other")
}
case FilterCalculationContext(FilterAllLevel(flatHierarchy)) =>
(mpv.property, mpv.typed) match {
case (_: MemberNameProperty, _) =>
ConstantValue(flatHierarchy.allLevel.get.memberName)
case (_: MemberCaption, _) =>
ConstantValue(flatHierarchy.allLevel.get.memberCaption)
case (_: LevelNumberProperty, true) => ConstantValue(0)
case (_: LevelNumberProperty, false) => ConstantValue("0")
case other =>
throw new NotSupportedYetException(s"Unsupported member property for all level in filter value: $other")
}
case _ =>
val mod = resolveMemberExpression(mpv.member) match {
case Left(_) => throw new NotSupportedYetException("Contextual properties not supported yet for measures")
case Right(d) => d
}
val cpv = if (mpv.typed) {
ContextualPropertyValue(mod.hierarchy, SupportedContextualProperties(mpv.property))(cube)
} else {
TypeConvertedValue(ContextualPropertyValue(mod.hierarchy, SupportedContextualProperties(mpv.property))(cube), MaxStringType)
}
DimensionallyModifiedValue(cpv, Seq(mod))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment