public override ScalarValue VisitSeparatedElement(SeparatedElement node)
        {
            Kusto.Language.Syntax.Query query = node.Root as Kusto.Language.Syntax.Query;
            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.Visit(this));
                }

                if (node.Parent.Parent is SummarizeByClause &&
                    node.Element is IdentifierNameReference identifierNameReference)
                {
                    return(identifierNameReference.Visit(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.Visit(this) as AggregationFunction;

                    RxKqlScalarValue retVal = new RxKqlScalarValue
                    {
                        Left  = simpleNamedExpression.Name.SimpleName,
                        Right = aggregationFunction
                    };

                    return(retVal);
                }
            }

            return(base.VisitSeparatedElement(node));
        }
        public override ScalarValue VisitFunctionCallExpression(FunctionCallExpression node)
        {
            var functionName = node.Name.SimpleName;
            var args         = node.ArgumentList.Expressions.Select(e => e.Element.Visit(this)).ToList();

            Kusto.Language.Syntax.Query query = node.Root as Kusto.Language.Syntax.Query;
            var statement           = query.Statements[0];
            var expressionStatement = statement.Element as ExpressionStatement;

            if (expressionStatement.Expression is Kusto.Language.Syntax.SummarizeOperator)
            {
                if (node.Parent.Parent.Parent is SummarizeByClause)
                {
                    return(ScalarFunctionFactory.Create(functionName, args));
                }

                return(AggregationFunctionFactory.Create(functionName, args));
            }
            else
            {
                return(ScalarFunctionFactory.Create(functionName, args));
            }
        }
Example #3
0
 public override T VisitQuery(Kusto.Language.Syntax.Query node)
 {
     throw new NotImplementedException();
 }