// Copyright 2023 Greptime Team
//
// Licensed 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 = "proto3";

package greptime.v1;

option java_package = "io.greptime.v1";
option java_outer_classname = "Columns";
option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1";

import "greptime/v1/common.proto";

message Column {
  string column_name = 1;
  SemanticType semantic_type = 2;

  message Values {
    repeated int32 i8_values = 1;
    repeated int32 i16_values = 2;
    repeated int32 i32_values = 3;
    repeated int64 i64_values = 4;

    repeated uint32 u8_values = 5;
    repeated uint32 u16_values = 6;
    repeated uint32 u32_values = 7;
    repeated uint64 u64_values = 8;

    repeated float f32_values = 9;
    repeated double f64_values = 10;

    repeated bool bool_values = 11;
    repeated bytes binary_values = 12;
    repeated string string_values = 13;

    repeated int32 date_values = 14;
    repeated int64 datetime_values = 15;
    repeated int64 timestamp_second_values = 16;
    repeated int64 timestamp_millisecond_values = 17;
    repeated int64 timestamp_microsecond_values = 18;
    repeated int64 timestamp_nanosecond_values = 19;
    repeated int64 time_second_values = 20;
    repeated int64 time_millisecond_values = 21;
    repeated int64 time_microsecond_values = 22;
    repeated int64 time_nanosecond_values = 23;
    repeated int32 interval_year_month_values = 24;
    repeated int64 interval_day_time_values = 25;
    repeated IntervalMonthDayNano interval_month_day_nano_values = 26;
    repeated Decimal128 decimal128_values = 31;
  }
  // The array of non-null values in this column.
  //
  // For example: suppose there is a column "foo" that contains some int32
  // values (1, 2, 3, 4, 5, null, 7, 8, 9, null);
  //   column:
  //     column_name: foo
  //     semantic_type: Tag
  //     values: 1, 2, 3, 4, 5, 7, 8, 9
  //     null_masks: 00100000 00000010
  Values values = 3;

  // Mask maps the positions of null values.
  // If a bit in null_mask is 1, it indicates that the column value at that
  // position is null.
  bytes null_mask = 4;

  // Helpful in creating vector from column.
  ColumnDataType datatype = 5;

  // Extension for ColumnDataType.
  ColumnDataTypeExtension datatype_extension = 6;

  // Additional column options.
  ColumnOptions options = 7;
}
