github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/rowexec/subquery.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 rowexec 12 13 // SubqueryExecMode is an enum to indicate the type of a subquery. 14 type SubqueryExecMode int 15 16 const ( 17 // SubqueryExecModeUnknown is the default value, and is only used to indicate 18 // a subquery that was improperly initialized. 19 SubqueryExecModeUnknown SubqueryExecMode = iota 20 // SubqueryExecModeExists indicates that the subquery is an argument to 21 // EXISTS. Result type is Bool. 22 SubqueryExecModeExists 23 // SubqueryExecModeAllRowsNormalized indicates that the subquery is an 24 // argument to IN, ANY, SOME, or ALL. Any number of rows are 25 // expected. The result type is tuple of rows. As a special case, if 26 // there is only one column selected, the result is a tuple of the 27 // selected values (instead of a tuple of 1-tuples). 28 SubqueryExecModeAllRowsNormalized 29 // SubqueryExecModeAllRows indicates that the subquery is an 30 // argument to an ARRAY constructor. Any number of rows are expected, and 31 // exactly one column is expected. Result type is a tuple 32 // of selected values. 33 SubqueryExecModeAllRows 34 // SubqueryExecModeOneRow indicates that the subquery is an argument to 35 // another function. At most 1 row is expected. The result type is a tuple of 36 // columns, unless there is exactly 1 column in which case the result type is 37 // that column's type. If there are no rows, the result is NULL. 38 SubqueryExecModeOneRow 39 ) 40 41 // SubqueryExecModeNames maps SubqueryExecMode values to human readable 42 // strings for EXPLAIN queries. 43 var SubqueryExecModeNames = map[SubqueryExecMode]string{ 44 SubqueryExecModeUnknown: "<unknown>", 45 SubqueryExecModeExists: "exists", 46 SubqueryExecModeAllRowsNormalized: "all rows normalized", 47 SubqueryExecModeAllRows: "all rows", 48 SubqueryExecModeOneRow: "one row", 49 }