Show / Hide Table of Contents

Class ExpressionEmitterBase

Base class for an expression visitor.

Inheritance
Object
LoggingExpressionVisitorBase
ExpressionEmitterBase
KustoExpression
ScopeExpression
SparkSQLExpression
Implements
IGenericExpressionVisitor<String>
IExpressionVisitor
IGenericVisitor<String>
Inherited Members
LoggingExpressionVisitorBase.Logger
LoggingExpressionVisitorBase.VisitorName
LoggingExpressionVisitorBase.VisitWithTracing(ColumnReference)
LoggingExpressionVisitorBase.Visit(JoinKey)
LoggingExpressionVisitorBase.Visit(Literal)
LoggingExpressionVisitorBase.Visit(RuntimeVariable)
LoggingExpressionVisitorBase.Visit(TernaryOperation)
LoggingExpressionVisitorBase.Visit(UnaryAggregation)
LoggingExpressionVisitorBase.Visit(UnaryOperation)
LoggingExpressionVisitorBase.Visit(UnionExpression)
LoggingExpressionVisitorBase.Visit(VectorOperation)
LoggingExpressionVisitorBase.Visit(Aggregand)
LoggingExpressionVisitorBase.Visit(BinaryAggregation)
LoggingExpressionVisitorBase.Visit(BinaryOperation)
LoggingExpressionVisitorBase.Visit(ColumnReference)
LoggingExpressionVisitorBase.Visit(DataSourceColumn)
LoggingExpressionVisitorBase.Visit(Extern)
LoggingExpressionVisitorBase.Visit(Filter)
LoggingExpressionVisitorBase.Visit(UnaryWindowFunction)
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Mangrove.MetricSetEmitters
Assembly: MetricSetEmitters.dll
Syntax
public abstract class ExpressionEmitterBase : LoggingExpressionVisitorBase, IGenericExpressionVisitor<string>, IExpressionVisitor, IGenericVisitor<string>
Remarks

This can be used in any emitter, or just for debugging.

Constructors

View Source

ExpressionEmitterBase(ILogger)

Declaration
public ExpressionEmitterBase(ILogger logger)
Parameters
Type Name Description
ILogger logger

Fields

View Source

_output

Declaration
protected StringBuilder _output
Field Value
Type Description
StringBuilder

Properties

View Source

AssignmentOperator

String representing the assigment operator.

Declaration
protected abstract string AssignmentOperator { get; }
Property Value
Type Description
String
Remarks

For example, " = " in Kusto in Scope.

View Source

BinaryAggregationToOperator

A map of each supported binary aggregation type to the corresponding representation as a tuple of strings.

Declaration
protected abstract IReadOnlyDictionary<BinaryAggregationKind, (string prefix, string separator, string suffix)> BinaryAggregationToOperator { get; }
Property Value
Type Description
IReadOnlyDictionary<BinaryAggregationKind, ValueTuple<String, String, String>>
Remarks

For example, BinaryAggregationKind.Percentile maps to ("PERCENTILE(", ")") in Scope, because the result of the y-th percentile of x is PERCENTILE(x, y) in Scope.

View Source

BinaryOperationToOperator

A map of each supported binary operation type to the corresponding representation as a tuple of strings.

Declaration
protected abstract IReadOnlyDictionary<BinaryOperationKind, (string prefix, string infix, string suffix)> BinaryOperationToOperator { get; }
Property Value
Type Description
IReadOnlyDictionary<BinaryOperationKind, ValueTuple<String, String, String>>
Remarks

For example, BinaryOperationKind.StringConcat maps to ("string.Concat(", ", ", ")") in Scope, because the result of x string concat y is string.Concat(x, y) in Scope.

View Source

LiteralFalse

Declaration
protected abstract string LiteralFalse { get; }
Property Value
Type Description
String
View Source

LiteralTrue

Declaration
protected abstract string LiteralTrue { get; }
Property Value
Type Description
String
View Source

Min_Max_Value

Declaration
protected abstract Dictionary<string, string> Min_Max_Value { get; }
Property Value
Type Description
Dictionary<String, String>
View Source

NegativeInfinity

Declaration
protected abstract string NegativeInfinity { get; }
Property Value
Type Description
String
View Source

PositiveInfinity

Declaration
protected abstract string PositiveInfinity { get; }
Property Value
Type Description
String
View Source

Result

Declaration
public string Result { get; }
Property Value
Type Description
String
View Source

TernaryOperationToOperator

A map of each supported ternary operation type to the corresponding representation as a tuple of strings.

Declaration
protected abstract IReadOnlyDictionary<TernaryOperationKind, (string prefix, string leftInfix, string rightInfix, string suffix)> TernaryOperationToOperator { get; }
Property Value
Type Description
IReadOnlyDictionary<TernaryOperationKind, ValueTuple<String, String, String, String>>
Remarks

For example, TernaryOperationKind.Boolean maps to ("", "?", ":", "") in Scope, because the result of booloean operation on x, y,z is x ? y : z in Scope.

View Source

TypeKindToParseFromStringOperator

A map of each supported type to the its corresponding parse from string operation as a tuple of strings.

Declaration
protected abstract IReadOnlyDictionary<TypeKind, (string prefix, string suffix)> TypeKindToParseFromStringOperator { get; }
Property Value
Type Description
IReadOnlyDictionary<TypeKind, ValueTuple<String, String>>
Remarks

For example, TypeKind.Double maps to ("Operations.parseDouble(", ")") in Java, which underneath uses Double.parseDouble to parse string to double.

View Source

TypeToName

A map of each supported data type to the corresponding string representation.

Declaration
protected abstract IReadOnlyDictionary<TypeKind, string> TypeToName { get; }
Property Value
Type Description
IReadOnlyDictionary<TypeKind, String>
View Source

TypeToNull

A map of each supported nullable data type to the corresponding string representation of the null value.

Declaration
protected abstract IReadOnlyDictionary<TypeKind, string> TypeToNull { get; }
Property Value
Type Description
IReadOnlyDictionary<TypeKind, String>
Remarks

For example, TypeKind.Int maps to (int?)null in Scope.

View Source

UnaryAggregationToOperator

A map of each supported unary aggregation type to the corresponding representation as a tuple of strings.

Declaration
protected abstract IReadOnlyDictionary<UnaryAggregationKind, (string op, string prefix, string suffix)> UnaryAggregationToOperator { get; }
Property Value
Type Description
IReadOnlyDictionary<UnaryAggregationKind, ValueTuple<String, String, String>>
Remarks

For example, UnaryAggregationKind.MAX maps to ("MAX(" , ")") in Scope, because the result of MAX on x is MAX(x) in Scope.

View Source

UnaryOperationToOperator

A map of each supported unary operation type to the corresponding representation as a tuple of strings.

Declaration
protected abstract IReadOnlyDictionary<UnaryOperationKind, (string prefix, string suffix)> UnaryOperationToOperator { get; }
Property Value
Type Description
IReadOnlyDictionary<UnaryOperationKind, ValueTuple<String, String>>
Remarks

For example, UnaryOperationKind.Exp maps to ("System.Math.Exp(", ")") in Scope, because the result of the exponent on x is System.Math.Exp(x) in Scope.

View Source

VectorOperationToOperator

A map of each supported vector operation type to the corresponding representation as a tuple of strings.

Declaration
protected abstract IReadOnlyDictionary<VectorOperationKind, (string prefix, string separator, string suffix)> VectorOperationToOperator { get; }
Property Value
Type Description
IReadOnlyDictionary<VectorOperationKind, ValueTuple<String, String, String>>
Remarks

For example, VectorOperationKind.Max maps to ("System.Math.Max(", ")") in Scope, because the result of the max on x and y is System.Math.Max(x, y) in Scope.

View Source

WindowFunctionSyntax

The representation as a tuple of strings of the syntax for using a window function.

Declaration
protected abstract (string prefix, string separator, string suffix) WindowFunctionSyntax { get; }
Property Value
Type Description
ValueTuple<String, String, String>
Remarks

For example, in Scope, (" OVER (PARTITION BY ",",",")") indicates that after the aggregation expression, we say "OVER (PARTITION BY " befor listing out the partitions, place a "," between the partitions, and end it with a ")"

Methods

View Source

AcceptAndAppend(Object[])

Given a sequence of either String, TypeKind, or Expression objects, either append them to _output, append their name to _output, or accept them, respectively.

Declaration
protected void AcceptAndAppend(params object[] objects)
Parameters
Type Name Description
Object[] objects
View Source

AcceptWithSeparator(IEnumerable<Expression>, String, String, String)

Interleave expressions with separator, e.g. e1 sep e2 sep e3, using AcceptAndAppend(Object[]).

Declaration
protected void AcceptWithSeparator(IEnumerable<Expression> expressions, string separator, string prefix = "", string suffix = "")
Parameters
Type Name Description
IEnumerable<Expression> expressions
String separator
String prefix
String suffix
View Source

CreateVectorOperationFromBinary(VectorOperationKind, IEnumerable<Expression>)

Subclasses may call this when the compute fabric does not support "native" vector operations. This recursively creates something like max(a, max(b, c)) instead.

Declaration
protected void CreateVectorOperationFromBinary(VectorOperationKind operation, IEnumerable<Expression> arguments)
Parameters
Type Name Description
VectorOperationKind operation
IEnumerable<Expression> arguments
View Source

Escape(String)

Declaration
protected abstract string Escape(string input)
Parameters
Type Name Description
String input
Returns
Type Description
String
View Source

Reset()

Declaration
public void Reset()
View Source

ThrowHelpfulError(Object)

Declaration
protected static void ThrowHelpfulError(object received)
Parameters
Type Name Description
Object received
View Source

VisitCreateHistogramExpression(UnaryOperation)

Declaration
protected abstract void VisitCreateHistogramExpression(UnaryOperation expr)
Parameters
Type Name Description
UnaryOperation expr
View Source

VisitParseExpression(UnaryOperation)

Declaration
protected void VisitParseExpression(UnaryOperation expr)
Parameters
Type Name Description
UnaryOperation expr
View Source

VisitTypeCastExpression(UnaryOperation)

Declaration
protected abstract void VisitTypeCastExpression(UnaryOperation expr)
Parameters
Type Name Description
UnaryOperation expr
View Source

VisitWithTracing(Aggregand)

Declaration
public override void VisitWithTracing(Aggregand expr)
Parameters
Type Name Description
Aggregand expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(Aggregand)
View Source

VisitWithTracing(BinaryAggregation)

Declaration
public override void VisitWithTracing(BinaryAggregation expr)
Parameters
Type Name Description
BinaryAggregation expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(BinaryAggregation)
View Source

VisitWithTracing(BinaryOperation)

Declaration
public override void VisitWithTracing(BinaryOperation expr)
Parameters
Type Name Description
BinaryOperation expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(BinaryOperation)
View Source

VisitWithTracing(DataSourceColumn)

Declaration
public override void VisitWithTracing(DataSourceColumn expr)
Parameters
Type Name Description
DataSourceColumn expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(DataSourceColumn)
View Source

VisitWithTracing(Extern)

Declaration
public override void VisitWithTracing(Extern expr)
Parameters
Type Name Description
Extern expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(Extern)
View Source

VisitWithTracing(Filter)

Declaration
public override void VisitWithTracing(Filter expr)
Parameters
Type Name Description
Filter expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(Filter)
View Source

VisitWithTracing(JoinKey)

Declaration
public override void VisitWithTracing(JoinKey expr)
Parameters
Type Name Description
JoinKey expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(JoinKey)
View Source

VisitWithTracing(Literal)

Declaration
public override void VisitWithTracing(Literal expr)
Parameters
Type Name Description
Literal expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(Literal)
View Source

VisitWithTracing(RuntimeVariable)

Declaration
public override void VisitWithTracing(RuntimeVariable expr)
Parameters
Type Name Description
RuntimeVariable expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(RuntimeVariable)
View Source

VisitWithTracing(TernaryOperation)

Declaration
public override void VisitWithTracing(TernaryOperation expr)
Parameters
Type Name Description
TernaryOperation expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(TernaryOperation)
View Source

VisitWithTracing(UnaryAggregation)

Declaration
public override void VisitWithTracing(UnaryAggregation expr)
Parameters
Type Name Description
UnaryAggregation expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(UnaryAggregation)
View Source

VisitWithTracing(UnaryOperation)

Declaration
public override void VisitWithTracing(UnaryOperation expr)
Parameters
Type Name Description
UnaryOperation expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(UnaryOperation)
View Source

VisitWithTracing(UnaryWindowFunction)

Declaration
public override void VisitWithTracing(UnaryWindowFunction expr)
Parameters
Type Name Description
UnaryWindowFunction expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(UnaryWindowFunction)
View Source

VisitWithTracing(UnionExpression)

A UNION operation combines rows from different tables that all have same schema. The expressions in a Union table are pointers to the individual columnReferences that are unioned together in a particular column. So to visit a UnionExpression, we actually need to visit one of the parent ColumnReferences that it points to.

Declaration
public override void VisitWithTracing(UnionExpression expr)
Parameters
Type Name Description
UnionExpression expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(UnionExpression)
View Source

VisitWithTracing(VectorOperation)

Declaration
public override void VisitWithTracing(VectorOperation expr)
Parameters
Type Name Description
VectorOperation expr
Overrides
LoggingExpressionVisitorBase.VisitWithTracing(VectorOperation)

Implements

IGenericExpressionVisitor<T>
IExpressionVisitor
IGenericVisitor<T>

Extension Methods

ObjectExtensions.EventId(Object)
  • View Source
Back to top Generated by DocFX