Skip to content

Commit

Permalink
Added test for an any set comparison subquery.
Browse files Browse the repository at this point in the history
  • Loading branch information
EpsilonPrime committed Feb 8, 2024
1 parent 2b70788 commit 1d1a909
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/substrait/textplan/converter/PlanPrinterVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ std::any PlanPrinterVisitor::visitSubquerySetComparison(
const ::substrait::proto::Expression_Subquery_SetComparison& query) {
std::stringstream result;
if (query.has_left()) {
result << ANY_CAST(std::string, visitExpression(query.left()));
result << ANY_CAST(std::string, visitExpression(query.left())) << " ";
} else {
errorListener_->addError(
"No expression defined for set comparison operation.");
Expand Down
126 changes: 126 additions & 0 deletions src/substrait/textplan/data/set-comparision-any.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# isthmus -c "CREATE TABLE NATION (N_REGIONKEY BIGINT NOT NULL)" "SELECT * FROM NATION WHERE N_REGIONKEY IN (SELECT N_REGIONKEY FROM NATION)"
{
"extensionUris": [],
"extensions": [],
"relations": [{
"root": {
"input": {
"project": {
"common": {
"emit": {
"outputMapping": [1]
}
},
"input": {
"filter": {
"common": {
"direct": {
}
},
"input": {
"read": {
"common": {
"direct": {
}
},
"baseSchema": {
"names": ["N_REGIONKEY"],
"struct": {
"types": [{
"i64": {
"typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}],
"typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
"namedTable": {
"names": ["NATION"]
}
}
},
"condition": {
"subquery": {
"setComparison": {
"comparisonOp": 3,
"reductionOp": 1,
"left": {
"selection": {
"directReference": {
"structField": {
"field": 0
}
},
"rootReference": {
}
}
},
"right": {
"project": {
"common": {
"emit": {
"outputMapping": [1]
}
},
"input": {
"read": {
"common": {
"direct": {
}
},
"baseSchema": {
"names": ["N_REGIONKEY"],
"struct": {
"types": [{
"i64": {
"typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}],
"typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
"namedTable": {
"names": ["NATION"]
}
}
},
"expressions": [{
"selection": {
"directReference": {
"structField": {
"field": 0
}
},
"rootReference": {
}
}
}]
}
}
}
}
}
}
},
"expressions": [{
"selection": {
"directReference": {
"structField": {
"field": 0
}
},
"rootReference": {
}
}
}]
}
},
"names": ["N_REGIONKEY"]
}
}],
"expectedTypeUrls": []
}

0 comments on commit 1d1a909

Please sign in to comment.