private def parseExpr()

in atlas-eval/src/main/scala/com/netflix/atlas/eval/stream/LwcToAggrDatapoint.scala [183:203]


  private def parseExpr(input: String, exprType: ExprType = ExprType.TIME_SERIES): DataExpr = {
    exprType match {
      case ExprType.TIME_SERIES =>
        dataInterpreter.execute(input).stack match {
          case (expr: DataExpr) :: Nil => expr
          case _ => throw new IllegalArgumentException(s"invalid expr: $input")
        }
      case ExprType.TRACE_TIME_SERIES =>
        traceInterpreter.execute(input).stack match {
          case ModelExtractors.TraceTimeSeriesType(tq) :: Nil => tq.expr.expr.dataExprs.head
          case _ => throw new IllegalArgumentException(s"invalid expr: $input")
        }
      case ExprType.EVENTS =>
        eventInterpreter.execute(input).stack match {
          case ModelExtractors.EventExprType(expr: EventExpr.Sample) :: Nil => expr.dataExpr
          case _ => throw new IllegalArgumentException(s"invalid expr: $input")
        }
      case _ =>
        throw new IllegalArgumentException(s"unsupported expression type: $exprType")
    }
  }