diff --git a/src/substrait/textplan/converter/PlanPrinterVisitor.cpp b/src/substrait/textplan/converter/PlanPrinterVisitor.cpp index 3cb3834c..8187c067 100644 --- a/src/substrait/textplan/converter/PlanPrinterVisitor.cpp +++ b/src/substrait/textplan/converter/PlanPrinterVisitor.cpp @@ -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."); diff --git a/src/substrait/textplan/data/set-comparision-any.json b/src/substrait/textplan/data/set-comparision-any.json new file mode 100644 index 00000000..8ff5d542 --- /dev/null +++ b/src/substrait/textplan/data/set-comparision-any.json @@ -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": [] +}