Skip to content

Commit

Permalink
fix the OperatorType
Browse files Browse the repository at this point in the history
  • Loading branch information
RemHero committed Jan 19, 2023
1 parent 3fe52d5 commit 1092f6b
Showing 1 changed file with 44 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down

0 comments on commit 1092f6b

Please sign in to comment.