YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/master/yql_aggregates_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_aggregates_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
YQLAggregatesVTable::YQLAggregatesVTable(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 YQLAggregatesVTable::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("aggregate_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
3.00k
  CHECK_OK(builder.AddColumn("final_func", QLType::Create(DataType::STRING)));
36
3.00k
  CHECK_OK(builder.AddColumn("initcond", QLType::Create(DataType::STRING)));
37
3.00k
  CHECK_OK(builder.AddColumn("state_func", QLType::Create(DataType::STRING)));
38
3.00k
  CHECK_OK(builder.AddColumn("state_type", QLType::Create(DataType::STRING)));
39
3.00k
  return builder.Build();
40
3.00k
}
41
42
}  // namespace master
43
}  // namespace yb