if (subqueryNode.getLeftOperand() != null) {
try {
subqueryNode.getLeftOperand().accept(this);
}
catch (StandardException ex) {
throw new SQLParserInternalException(ex);
}
}
ResultSetNode resultSet = subqueryNode.getResultSet();
ResultColumnList resultColumns = resultSet.getResultColumns();
// The parser does not enforce the fact that a subquery can only
// return a single column, so we must check here.
if (resultColumns.size() != 1) {
switch (subqueryNode.getSubqueryType()) {
case IN:
case NOT_IN:
case EXISTS:
case NOT_EXISTS:
break;
case EXPRESSION:
if (allowSubqueryMultipleColumns)
break;
/* else falls through */
default:
throw new SubqueryOneColumnException();
}
}
SubqueryNode.SubqueryType subqueryType = subqueryNode.getSubqueryType();
/* Verify the usage of "*" in the select list:
* o Only valid in EXISTS subqueries
* o If the AllResultColumn is qualified, then we have to verify
* that the qualification is a valid exposed name.
* NOTE: The exposed name can come from an outer query block.
*/
verifySelectStarSubquery(resultSet, subqueryType);
/* For an EXISTS subquery:
* o If the SELECT list is a "*", then we convert it to a true.
* (We need to do the conversion since we don't want the "*" to
* get expanded.)
*/
if (subqueryType == SubqueryNode.SubqueryType.EXISTS) {
try {
resultSet = setResultToBooleanTrueNode(resultSet);
}
catch (StandardException ex) {
throw new SQLParserInternalException(ex);
}
subqueryNode.setResultSet(resultSet);
}
}