Calcite allows operators in SqlStdOperatorTable to be overridden when users would like to have their customized operators to be used instead. (see
CALCITE-1062 as an example).
If this logic is applied to SqlSetOperator, the systems which leverage Calcite can define their own output types (based on customized implicit casting rule) for Union-All, Intersect, etc.
Below is more implementation-oriented:
As is shown here , as opposed to calling deriveType(), the code calls validateOperands(). By doing so, the logic of overriding SqlOperator is skipped.
However, if we call deriveType() here, the logic of overriding SqlOperator will happen and validateOperands() will be called right afterwards .