YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/master/yql_functions_vtable.cc
Line
Count
Source
1
// Copyright (c) YugaByte, Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4
// in compliance with the License.  You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software distributed under the License
9
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10
// or implied.  See the License for the specific language governing permissions and limitations
11
// under the License.
12
//
13
#include "yb/master/yql_functions_vtable.h"
14
15
#include "yb/common/ql_type.h"
16
#include "yb/common/schema.h"
17
#include "yb/util/status_log.h"
18
19
namespace yb {
20
namespace master {
21
22
YQLFunctionsVTable::YQLFunctionsVTable(const TableName& table_name,
23
                                       const NamespaceName& namespace_name,
24
                                       Master * const master)
25
2.00k
    : YQLEmptyVTable(table_name, namespace_name, master, CreateSchema()) {
26
2.00k
}
27
28
2.00k
Schema YQLFunctionsVTable::CreateSchema() const {
29
2.00k
  SchemaBuilder builder;
30
2.00k
  CHECK_OK(builder.AddHashKeyColumn("keyspace_name", DataType::STRING));
31
2.00k
  CHECK_OK(builder.AddKeyColumn("function_name", DataType::STRING));
32
  // TODO: argument_types should be part of the primary key, but since we don't support the CQL
33
  // 'frozen' type, we can't have collections in our primary key.
34
2.00k
  CHECK_OK(builder.AddColumn("argument_types", QLType::CreateTypeList(DataType::STRING)));
35
  // TODO: argument_names should be a frozen list.
36
2.00k
  CHECK_OK(builder.AddColumn("argument_names", QLType::CreateTypeList(DataType::STRING)));
37
2.00k
  CHECK_OK(builder.AddColumn("called_on_null_input", QLType::Create(DataType::BOOL)));
38
2.00k
  CHECK_OK(builder.AddColumn("language", QLType::Create(DataType::STRING)));
39
2.00k
  CHECK_OK(builder.AddColumn("return_type", QLType::Create(DataType::STRING)));
40
2.00k
  return builder.Build();
41
2.00k
}
42
43
}  // namespace master
44
}  // namespace yb