YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/yql/cql/ql/ptree/pt_insert_json_clause.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
// Tree node definitions for INSERT INTO ... JSON clause.
16
//--------------------------------------------------------------------------------------------------
17
#include "yb/yql/cql/ql/ptree/pt_insert_json_clause.h"
18
19
#include <boost/optional.hpp>
20
21
#include "yb/common/ql_type.h"
22
#include "yb/yql/cql/ql/ptree/pt_expr.h"
23
#include "yb/yql/cql/ql/ptree/yb_location.h"
24
25
namespace yb {
26
namespace ql {
27
28
PTInsertJsonClause::PTInsertJsonClause(MemoryContext* memctx,
29
                                       const YBLocation::SharedPtr& loc,
30
                                       const PTExpr::SharedPtr& json_expr,
31
                                       bool default_null)
32
    : PTCollection(memctx, loc),
33
      default_null_(default_null),
34
      json_expr_(json_expr),
35
      json_string_(""),
36
86
      json_document_(boost::none) {}
37
38
77
PTInsertJsonClause::~PTInsertJsonClause() = default;
39
40
172
CHECKED_STATUS PTInsertJsonClause::Analyze(SemContext* sem_context) {
41
172
  SemState sem_state(sem_context, QLType::Create(DataType::STRING), InternalType::kStringValue);
42
172
  sem_state.set_bindvar_name("json"); // To match Cassandra behaviour
43
172
  RETURN_NOT_OK(json_expr_->Analyze(sem_context));
44
  // Most of the work will be done in pre-exec phase
45
172
  return Status::OK();
46
172
}
47
48
0
void PTInsertJsonClause::PrintSemanticAnalysisResult(SemContext* sem_context) {
49
0
  VLOG(3) << "SEMANTIC ANALYSIS RESULT (" << *loc_ << "):\n" << "Not yet avail";
50
0
}
51
52
}  // namespace ql
53
}  // namespace yb