YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/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.01k
CHECKED_STATUS Executor::PTUMinusToPB(const PTOperator1 *op_pt, QLExpressionPB *op_pb) {
26
4.01k
  return PTUMinusToPB(op_pt, op_pb->mutable_value());
27
4.01k
}
28
29
4.07k
CHECKED_STATUS Executor::PTUMinusToPB(const PTOperator1 *op_pt, QLValuePB *const_pb) {
30
  // Negate the value.
31
4.07k
  if (op_pt->is_constant()) {
32
4.07k
    RETURN_NOT_OK(PTConstToPB(op_pt->op1(), const_pb, true));
33
0
  } else {
34
0
    LOG(FATAL) << "Unary minus operator is only supported for literals";
35
0
  }
36
37
4.07k
  return Status::OK();
38
4.07k
}
39
40
CHECKED_STATUS Executor::PTJsonOperatorToPB(const PTJsonOperator::SharedPtr& json_pt,
41
1.36k
                                            QLJsonOperationPB *op_pb) {
42
1.36k
  switch (json_pt->json_operator()) {
43
698
    case JsonOperator::JSON_TEXT:
44
698
      op_pb->set_json_operator(JsonOperatorPB::JSON_TEXT);
45
698
      break;
46
670
    case JsonOperator::JSON_OBJECT:
47
670
      op_pb->set_json_operator(JsonOperatorPB::JSON_OBJECT);
48
670
      break;
49
1.36k
  }
50
1.36k
  return PTExprToPB(json_pt->arg(), op_pb->mutable_operand());
51
1.36k
}
52
53
}  // namespace ql
54
}  // namespace yb