classResultSlots
final class ResultSlots
Derives the output columns of set operations and VALUES statements from the columns they combine.
Rule: MYSQL-RESULT-SLOTS-001. A set operation is named by the columns of its first operand. The type of a column is the aggregation of the types at its position over the operands or rows (MYSQL-TYPE-AGGREGATION, the rule of the expression family). A UNION column can be NULL when it can in either operand, an INTERSECT column only when it can in both, an EXCEPT column when it can in the left operand. A VALUES column is named column_N, counting from zero, and can be NULL when one of its values can. Operands or rows of different lengths are reported, and a column one of them lacks is invalid; while the first operand has columns that are not known the output is open. Source: https://dev.mysql.com/doc/refman/8.4/en/union.html ("Result Set Column Names and Data Types"), https://dev.mysql.com/doc/refman/8.4/en/values.html. Status: Implemented.
Methods§
public function combine(
QueryFact $left,
QueryFact $right,
SetOperator $operator,
Derivation $derivation,
): list<Field|OpenStar>Combines the outputs of the two operands of a set operation.
Parameters
$left | QueryFact | |
$right | QueryFact | |
$operator | SetOperator | |
$derivation | Derivation |
Test cases 1
Called from 1
Calls 14
- new OpenStar line 53
- function-call
countline 56 - new CountMismatch line 57
- class-const CountedList::SetOperands() line 57
- method-call Derivation::report() line 58
- method-call TypeAggregation::aggregate() line 64
- new TypeAggregation line 64
- method-call ResultSlots::nullability() line 65
- new Invalid line 67
- class-const Nullability::Dependent() line 68
- new Dependent line 70
- class-const SetOperator::Except() line 71
- new Field line 73
- new OutputSlot line 73
public function nullability(
SetOperator $operator,
Nullability $left,
Nullability $right,
): NullabilityAnswers whether a column of a set operation can be NULL from the facts of both operands.
Parameters
$operator | SetOperator | |
$left | Nullability | |
$right | Nullability |
Returns
Test cases 1
Called from 1
Calls 6
- class-const SetOperator::Except() line 84
- class-const SetOperator::Union() line 87
- method-call Nullability::propagate() line 88
- class-const Nullability::NotNull() line 90
- class-const Nullability::Nullable() line 94
- class-const Nullability::Dependent() line 94
public function values(
ValuesQuery $values,
Derivation $derivation,
Environment $outer,
): QueryFactDerives every value of a VALUES statement and answers its output.
Parameters
$values | ValuesQuery | |
$derivation | Derivation | |
$outer | Environment |
Returns
Test cases 1
Called from 1
Calls 16
- function-call
countline 103 - method-call Derivation::report() line 106
- new CountMismatch line 106
- class-const CountedList::ValueRows() line 106
- method-call Operands::single() line 109
- new Operands line 109
- method-call Derivation::scalar() line 109
- new Environment line 109
- class-const Nullability::NotNull() line 114
- method-call TypeAggregation::aggregate() line 118
- new TypeAggregation line 118
- function-call
array_mapline 118 - new Field line 119
- new OutputSlot line 119
- new Name line 119
- new QueryFact line 122
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.