github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/ordering/statement.go (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package ordering
    12  
    13  import (
    14  	"github.com/cockroachdb/cockroach/pkg/sql/opt/memo"
    15  	"github.com/cockroachdb/cockroach/pkg/sql/opt/props/physical"
    16  )
    17  
    18  func explainBuildChildReqOrdering(
    19  	parent memo.RelExpr, required *physical.OrderingChoice, childIdx int,
    20  ) physical.OrderingChoice {
    21  	return parent.(*memo.ExplainExpr).Props.Ordering
    22  }
    23  
    24  func alterTableSplitBuildChildReqOrdering(
    25  	parent memo.RelExpr, required *physical.OrderingChoice, childIdx int,
    26  ) physical.OrderingChoice {
    27  	if childIdx != 0 {
    28  		return physical.OrderingChoice{}
    29  	}
    30  	return parent.(*memo.AlterTableSplitExpr).Props.Ordering
    31  }
    32  
    33  func alterTableUnsplitBuildChildReqOrdering(
    34  	parent memo.RelExpr, required *physical.OrderingChoice, childIdx int,
    35  ) physical.OrderingChoice {
    36  	if childIdx != 0 {
    37  		return physical.OrderingChoice{}
    38  	}
    39  	return parent.(*memo.AlterTableUnsplitExpr).Props.Ordering
    40  }
    41  
    42  func alterTableRelocateBuildChildReqOrdering(
    43  	parent memo.RelExpr, required *physical.OrderingChoice, childIdx int,
    44  ) physical.OrderingChoice {
    45  	if childIdx != 0 {
    46  		return physical.OrderingChoice{}
    47  	}
    48  	return parent.(*memo.AlterTableRelocateExpr).Props.Ordering
    49  }
    50  
    51  func controlJobsBuildChildReqOrdering(
    52  	parent memo.RelExpr, required *physical.OrderingChoice, childIdx int,
    53  ) physical.OrderingChoice {
    54  	if childIdx != 0 {
    55  		return physical.OrderingChoice{}
    56  	}
    57  	return parent.(*memo.ControlJobsExpr).Props.Ordering
    58  }
    59  
    60  func cancelQueriesBuildChildReqOrdering(
    61  	parent memo.RelExpr, required *physical.OrderingChoice, childIdx int,
    62  ) physical.OrderingChoice {
    63  	if childIdx != 0 {
    64  		return physical.OrderingChoice{}
    65  	}
    66  	return parent.(*memo.CancelQueriesExpr).Props.Ordering
    67  }
    68  
    69  func cancelSessionsBuildChildReqOrdering(
    70  	parent memo.RelExpr, required *physical.OrderingChoice, childIdx int,
    71  ) physical.OrderingChoice {
    72  	if childIdx != 0 {
    73  		return physical.OrderingChoice{}
    74  	}
    75  	return parent.(*memo.CancelSessionsExpr).Props.Ordering
    76  }
    77  
    78  func exportBuildChildReqOrdering(
    79  	parent memo.RelExpr, required *physical.OrderingChoice, childIdx int,
    80  ) physical.OrderingChoice {
    81  	if childIdx != 0 {
    82  		return physical.OrderingChoice{}
    83  	}
    84  	return parent.(*memo.ExportExpr).Props.Ordering
    85  }