YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/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
3.00k
    : YQLEmptyVTable(table_name, namespace_name, master, CreateSchema()) {
26
3.00k
}
27
28
3.00k
Schema YQLFunctionsVTable::CreateSchema() const {
29
3.00k
  SchemaBuilder builder;
30
3.00k
  CHECK_OK(builder.AddHashKeyColumn("keyspace_name", DataType::STRING));
31
3.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
3.00k
  CHECK_OK(builder.AddColumn("argument_types", QLType::CreateTypeList(DataType::STRING)));
35
  // TODO: argument_names should be a frozen list.
36
3.00k
  CHECK_OK(builder.AddColumn("argument_names", QLType::CreateTypeList(DataType::STRING)));
37
3.00k
  CHECK_OK(builder.AddColumn("called_on_null_input", QLType::Create(DataType::BOOL)));
38
3.00k
  CHECK_OK(builder.AddColumn("language", QLType::Create(DataType::STRING)));
39
3.00k
  CHECK_OK(builder.AddColumn("return_type", QLType::Create(DataType::STRING)));
40
3.00k
  return builder.Build();
41
3.00k
}
42
43
}  // namespace master
44
}  // namespace yb