| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| |
| syntax = "proto2"; |
| |
| package quickstep.serialization; |
| |
| import "storage/StorageBlockLayout.proto"; |
| import "types/Type.proto"; |
| import "types/TypedValue.proto"; |
| |
| message CatalogAttribute { |
| required string name = 1; |
| required Type type = 2; |
| optional string display_name = 3; |
| } |
| |
| // TODO(zuyu): Move PartitionScheme to a dedicate proto file. |
| message PartitionSchemeHeader { |
| enum PartitionType { |
| HASH = 0; |
| RANGE = 1; |
| } |
| |
| required PartitionType partition_type = 1; |
| |
| required uint64 num_partitions = 2; |
| repeated uint32 partition_attribute_ids = 3; |
| |
| // The convention for extension numbering is that extensions for a particular |
| // PartitionType should begin from (partition_type + 1) * 16. |
| extensions 16 to max; |
| } |
| |
| message PartitionValues { |
| repeated TypedValue partition_values = 1; |
| } |
| |
| message RangePartitionSchemeHeader { |
| extend PartitionSchemeHeader { |
| // All required. |
| repeated Type partition_attr_types = 32; |
| repeated PartitionValues partition_range_boundaries = 33; |
| } |
| } |
| |
| message Partition { |
| repeated fixed64 blocks = 1 [packed=true]; |
| } |
| |
| message PartitionScheme { |
| required PartitionSchemeHeader header = 1; |
| repeated Partition partitions = 2; |
| } |
| |
| message NUMAPlacementScheme { |
| required uint32 num_numa_nodes = 1; |
| |
| message BlockToNUMANodeEntry { |
| required fixed64 block_id = 1; |
| required int32 numa_node = 2; |
| } |
| repeated BlockToNUMANodeEntry block_to_numa_node_map = 2; |
| } |
| |
| message IndexScheme { |
| message IndexEntry { |
| required string index_name = 1; |
| required IndexSubBlockDescription index_description = 2; |
| } |
| repeated IndexEntry index_entries = 1; |
| } |
| |
| message CatalogRelationStatistics { |
| optional bool is_exact = 1; |
| optional TypedValue num_tuples = 2; |
| |
| message ColumnStats { |
| required int32 attr_id = 1; |
| optional TypedValue num_distinct_values = 2; |
| optional TypedValue min_value = 3; |
| optional TypedValue max_value = 4; |
| } |
| repeated ColumnStats column_stats = 3; |
| } |
| |
| message CatalogRelationSchema { |
| required int32 relation_id = 1; |
| required string name = 2; |
| required bool temporary = 3; |
| |
| repeated CatalogAttribute attributes = 4; |
| |
| extensions 16 to max; |
| } |
| |
| message CatalogRelation { |
| extend CatalogRelationSchema { |
| // Required. |
| optional StorageBlockLayoutDescription default_layout = 16; |
| |
| repeated fixed64 blocks = 17 [packed=true]; |
| optional IndexScheme index_scheme = 18; |
| optional PartitionScheme partition_scheme = 19; |
| optional NUMAPlacementScheme placement_scheme = 20; |
| optional CatalogRelationStatistics statistics = 21; |
| } |
| } |
| |
| message CatalogDatabase { |
| required string name = 1; |
| repeated CatalogRelationSchema relations = 2; |
| repeated int32 null_relations = 3; |
| } |
| |
| message Catalog { |
| repeated CatalogDatabase databases = 1; |
| } |