diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/operator/type/OperatorType.java b/core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/operator/type/OperatorType.java index f4f947ad9..7555478f0 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/operator/type/OperatorType.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/operator/type/OperatorType.java @@ -20,17 +20,33 @@ public enum OperatorType { - Unknown, - Binary, - Unary, - Multiple, + // Exception[0,9] + Unknown(0), - Project, - Select, - Join, + // MultipleOperator[10,19] + CombineNonQuery(10), + + //isGlobalOperator[20,29] + ShowTimeSeries(20), + Migration, + + //isNeedBroadcasting[30,39] + Delete(30), + Insert, + + // BinaryOperator[40,49] + Join(40), InnerJoin, OuterJoin, CrossJoin, + + + // isUnaryOperator >= 50 + Binary(50), + Unary, + Multiple, + Project, + Select, Union, Sort, Limit, @@ -39,24 +55,36 @@ public enum OperatorType { SetTransform, MappingTransform, Rename, - Reorder, - AddSchemaPrefix, + AddSchemaPrefix; - Delete, - Insert, - CombineNonQuery, - ShowTimeSeries, - Migration; + private int value; + OperatorType(){ + this(OperatorTypeCounter.nextValue); + } + OperatorType(int value){ + this.value = value; + OperatorTypeCounter.nextValue = value + 1; + } + + public int getValue() + { + return value; + } + + private static class OperatorTypeCounter + { + private static int nextValue = 0; + } public static boolean isBinaryOperator(OperatorType op) { - return op == Join || op == Union || op == InnerJoin || op == OuterJoin || op == CrossJoin; + return 40 < op.value && op.value < 49; } public static boolean isUnaryOperator(OperatorType op) { - return op == Project || op == Select || op == Sort || op == Limit || op == Downsample || op == RowTransform || op == SetTransform || op == MappingTransform || op == Delete || op == Insert || op == Rename || op == Reorder || op == AddSchemaPrefix; + return op.value >= 50; } public static boolean isMultipleOperator(OperatorType op) {