// 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 doris;

import "types.proto";

message PSlotDescriptor {
    required int32 id = 1;
    required int32 parent = 2; // tuple id which this slot is belong to
    required PTypeDesc slot_type = 3;
    required int32 column_pos = 4;   // in originating table
    required int32 byte_offset = 5;  // into tuple
    required int32 null_indicator_byte = 6;
    required int32 null_indicator_bit = 7;
    required string col_name = 8;
    required int32 slot_idx = 9;
    required bool is_materialized = 10;
};

message PTupleDescriptor {
    required int32 id = 1;
    required int32 byte_size = 2;
    required int32 num_null_bytes = 3;
    optional int64 table_id = 4;
    optional int32 num_null_slots = 5;
};

message POlapTableIndexSchema {
    required int64 id = 1;
    repeated string columns = 2;
    required int32 schema_hash = 3;
};

message POlapTableSchemaParam {
    required int64 db_id = 1;
    required int64 table_id = 2;
    required int64 version = 3;

    // Logical columns, contain all column that in logical table
    repeated PSlotDescriptor slot_descs = 4;
    required PTupleDescriptor tuple_desc = 5;
    repeated POlapTableIndexSchema indexes = 6;
};

