// 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 = "proto3";

package spark.spark_partitioning;

import "expr.proto";

option java_package = "org.apache.comet.serde";

// The basic message representing a Spark partitioning.
message Partitioning {
  oneof partitioning_struct {
    HashPartition hash_partition = 1;
    SinglePartition single_partition = 2;
    RangePartition range_partition = 3;
    RoundRobinPartition round_robin_partition = 4;
  }
}

message HashPartition {
  repeated spark.spark_expression.Expr hash_expression = 1;
  int32 num_partitions = 2;
}

message SinglePartition {
}

message BoundaryRow {
  repeated spark.spark_expression.Expr partition_bounds = 1;
}

message RangePartition {
  repeated spark.spark_expression.Expr sort_orders = 1;
  int32 num_partitions = 2;
  repeated BoundaryRow boundary_rows = 4;
}

message RoundRobinPartition {
  int32 num_partitions = 1;
  // Maximum number of columns to hash. 0 means no limit (hash all columns).
  int32 max_hash_columns = 2;
}
