| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| |
| syntax = "proto2"; |
| |
| package quickstep.serialization; |
| |
| import "types/Type.proto"; |
| |
| message Comparison { |
| enum ComparisonID { |
| EQUAL = 0; |
| NOT_EQUAL = 1; |
| LESS = 2; |
| LESS_OR_EQUAL = 3; |
| GREATER = 4; |
| GREATER_OR_EQUAL = 5; |
| LIKE = 6; |
| NOT_LIKE = 7; |
| REGEX_MATCH = 8; |
| NOT_REGEX_MATCH = 9; |
| } |
| |
| required ComparisonID comparison_id = 1; |
| } |
| |
| message UnaryOperation { |
| enum UnaryOperationID { |
| NEGATE = 0; |
| CAST = 1; |
| DATE_EXTRACT = 2; |
| SUBSTRING = 3; |
| } |
| |
| required UnaryOperationID operation_id = 1; |
| |
| extensions 32 to max; |
| } |
| |
| message CastOperation { |
| extend UnaryOperation { |
| // Required when operation_id = CAST. |
| optional Type target_type = 64; |
| } |
| } |
| |
| message DateExtractOperation { |
| enum Unit { |
| YEAR = 0; |
| MONTH = 1; |
| DAY = 2; |
| HOUR = 3; |
| MINUTE = 4; |
| SECOND = 5; |
| } |
| |
| extend UnaryOperation { |
| // Required when operation_id = DATE_EXTRACT. |
| optional Unit unit = 96; |
| } |
| } |
| |
| message SubstringOperation { |
| extend UnaryOperation { |
| // Required when operation_id = SUBSTRING. |
| optional int64 start_position = 100; |
| optional int64 substring_length = 101; |
| } |
| } |
| |
| message BinaryOperation { |
| enum BinaryOperationID { |
| ADD = 0; |
| SUBTRACT = 1; |
| MULTIPLY = 2; |
| DIVIDE = 3; |
| MODULO = 4; |
| } |
| |
| required BinaryOperationID operation_id = 1; |
| } |