/Users/deen/code/yugabyte-db/src/yb/yql/cql/ql/exec/eval_op.cc
Line | Count | Source (jump to first uncovered line) |
1 | | //-------------------------------------------------------------------------------------------------- |
2 | | // Copyright (c) YugaByte, Inc. |
3 | | // |
4 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
5 | | // in compliance with the License. You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
10 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
11 | | // or implied. See the License for the specific language governing permissions and limitations |
12 | | // under the License. |
13 | | // |
14 | | //-------------------------------------------------------------------------------------------------- |
15 | | |
16 | | #include "yb/yql/cql/ql/exec/executor.h" |
17 | | |
18 | | #include "yb/yql/cql/ql/ptree/pt_expr.h" |
19 | | |
20 | | namespace yb { |
21 | | namespace ql { |
22 | | |
23 | | using client::YBColumnSpec; |
24 | | |
25 | 4.50k | CHECKED_STATUS Executor::PTUMinusToPB(const PTOperator1 *op_pt, QLExpressionPB *op_pb) { |
26 | 4.50k | return PTUMinusToPB(op_pt, op_pb->mutable_value()); |
27 | 4.50k | } |
28 | | |
29 | 4.56k | CHECKED_STATUS Executor::PTUMinusToPB(const PTOperator1 *op_pt, QLValuePB *const_pb) { |
30 | | // Negate the value. |
31 | 4.56k | if (op_pt->is_constant()) { |
32 | 4.56k | RETURN_NOT_OK(PTConstToPB(op_pt->op1(), const_pb, true)); |
33 | 4.56k | } else { |
34 | 0 | LOG(FATAL) << "Unary minus operator is only supported for literals"; |
35 | 0 | } |
36 | | |
37 | 4.56k | return Status::OK(); |
38 | 4.56k | } |
39 | | |
40 | | CHECKED_STATUS Executor::PTJsonOperatorToPB(const PTJsonOperator::SharedPtr& json_pt, |
41 | 1.55k | QLJsonOperationPB *op_pb) { |
42 | 1.55k | switch (json_pt->json_operator()) { |
43 | 726 | case JsonOperator::JSON_TEXT: |
44 | 726 | op_pb->set_json_operator(JsonOperatorPB::JSON_TEXT); |
45 | 726 | break; |
46 | 830 | case JsonOperator::JSON_OBJECT: |
47 | 830 | op_pb->set_json_operator(JsonOperatorPB::JSON_OBJECT); |
48 | 830 | break; |
49 | 1.55k | } |
50 | 1.55k | return PTExprToPB(json_pt->arg(), op_pb->mutable_operand()); |
51 | 1.55k | } |
52 | | |
53 | | } // namespace ql |
54 | | } // namespace yb |