public override ScalarValue VisitSeparatedElement(SeparatedElement node) { Kusto.Language.Syntax.QueryBlock query = node.Root as Kusto.Language.Syntax.QueryBlock; var statement = query.Statements[0]; var expressionStatement = statement.Element as ExpressionStatement; if (expressionStatement.Expression is Kusto.Language.Syntax.SummarizeOperator) { if (node.Parent.Parent is SummarizeByClause && node.Element is FunctionCallExpression functionCallExpression) { return(functionCallExpression.Accept(this)); } if (node.Parent.Parent is SummarizeByClause && node.Element is NameReference identifierNameReference) { return(identifierNameReference.Accept(this)); } if (node.Element is FunctionCallExpression functionCallExpression1) { AggregationFunction aggregationFunction = VisitFunctionCallExpression(functionCallExpression1) as AggregationFunction; RxKqlScalarValue retVal = new RxKqlScalarValue { Left = aggregationFunction.Name, Right = aggregationFunction }; return(retVal); } if (node.Element is SimpleNamedExpression simpleNamedExpression) { AggregationFunction aggregationFunction = simpleNamedExpression.Expression.Accept(this) as AggregationFunction; RxKqlScalarValue retVal = new RxKqlScalarValue { Left = simpleNamedExpression.Name.SimpleName, Right = aggregationFunction }; return(retVal); } } return(base.VisitSeparatedElement(node)); }
public override ScalarValue VisitSummarizeOperator(Kusto.Language.Syntax.SummarizeOperator node) { ScalarSummarizer scalarSummarizer = new ScalarSummarizer(); var aggregates = node.Aggregates; foreach (var aggregate in aggregates) { RxKqlScalarValue scalarValue = aggregate.Accept(this) as RxKqlScalarValue; scalarSummarizer.Aggregations.Add(scalarValue.Left, scalarValue.Right as AggregationFunction); } scalarSummarizer.GroupingElements = node.ByClause.Expressions.Accept(this) as ScalarValueList; return(scalarSummarizer); }