Browse Source

YQL-16896: Common type inferring for SELECT combinators (#843)

Mars Agliullin 1 year ago
parent
commit
63660ad5e7

+ 62 - 7
ydb/library/yql/core/common_opt/yql_co_pgselect.cpp

@@ -1683,7 +1683,18 @@ TExprNode::TPtr BuildCrossJoinsBetweenGroups(TPositionHandle pos, const TExprNod
     return ctx.NewCallable(pos, "EquiJoin", std::move(args));
 }
 
-TExprNode::TPtr BuildProjectionLambda(TPositionHandle pos, const TExprNode::TPtr& result, bool subLink, bool emitPgStar, TExprContext& ctx) {
+TExprNode::TPtr BuildProjectionLambda(TPositionHandle pos, const TExprNode::TPtr& result, const TStructExprType* finalType,
+    const TColumnOrder& nodeColumnOrder, const TColumnOrder& setItemColumnOrder,
+    bool subLink, bool emitPgStar, TExprContext& ctx) {
+
+    YQL_ENSURE(nodeColumnOrder.size() == setItemColumnOrder.size());
+    TMap<TStringBuf, TStringBuf> columnNamesMap;
+    if (!emitPgStar) {
+        for (size_t i = 0; i < nodeColumnOrder.size(); ++i) {
+            columnNamesMap[setItemColumnOrder[i]] = nodeColumnOrder[i];
+        }
+    }
+
     return ctx.Builder(pos)
         .Lambda()
             .Param("row")
@@ -1705,26 +1716,68 @@ TExprNode::TPtr BuildProjectionLambda(TPositionHandle pos, const TExprNode::TPtr
                     .Seal();
                     listBuilder.Seal();
                 };
+
+                auto addAtomToListWithCast = [&addAtomToList] (TExprNodeBuilder& listBuilder, TExprNode* x,
+                                                           const TTypeAnnotationNode* expectedTypeNode) -> void {
+                    auto actualType = x->GetTypeAnn()->Cast<TPgExprType>();
+                    Y_ENSURE(expectedTypeNode);
+                    const auto expectedType = expectedTypeNode->Cast<TPgExprType>();
+
+                    if (actualType == expectedType) {
+                        addAtomToList(listBuilder, x);
+                        return;
+                    }
+                    listBuilder.Add(0, x->HeadPtr());
+                    listBuilder.Callable(1, "PgCast")
+                        .Apply(0, x->TailPtr())
+                            .With(0, "row")
+                        .Seal()
+                        .Callable(1, "PgType")
+                            .Atom(0, NPg::LookupType(expectedType->GetId()).Name)
+                            .Seal();
+                    listBuilder.Seal();
+                };
+
                 for (const auto& x : result->Tail().Children()) {
                     if (x->HeadPtr()->IsAtom()) {
                         if (!emitPgStar) {
+                            const auto& columnName = x->Child(0)->Content();
                             auto listBuilder = parent.List(index++);
-                            addAtomToList(listBuilder, x.Get());
+                            addAtomToListWithCast(listBuilder, x.Get(), finalType->FindItemType(columnNamesMap[columnName]));
                         }
                     } else {
                         auto type = x->Child(1)->GetTypeAnn()->Cast<TTypeExprType>()->GetType()->Cast<TStructExprType>();
+                        Y_ENSURE(type);
+
                         for (const auto& item : type->GetItems()) {
                             TStringBuf column = item->GetName();
                             auto columnName = subLink ? column : NTypeAnnImpl::RemoveAlias(column);
+
                             auto listBuilder = parent.List(index++);
                             if (overrideColumns.contains(columnName)) {
+                                // we never get here while processing SELECTs,
+                                // so no need to add PgCasts due to query combining with UNION ALL et al
                                 addAtomToList(listBuilder, overrideColumns[columnName]);
                             } else {
                                 listBuilder.Atom(0, columnName);
-                                listBuilder.Callable(1, "Member")
-                                    .Arg(0, "row")
-                                    .Atom(1, column);
-                                listBuilder.Seal();
+
+                                const auto expectedType = finalType->FindItemType(columnNamesMap[columnName]);
+                                if (item->GetItemType() == expectedType) {
+                                    listBuilder.Callable(1, "Member")
+                                        .Arg(0, "row")
+                                        .Atom(1, column)
+                                    .Seal();
+                                } else {
+                                    listBuilder.Callable(1, "PgCast")
+                                        .Callable(0, "Member")
+                                            .Arg(0, "row")
+                                            .Atom(1, column)
+                                        .Seal()
+                                        .Callable(1, "PgType")
+                                            .Atom(0, NPg::LookupType(expectedType->Cast<TPgExprType>()->GetId()).Name)
+                                        .Seal()
+                                    .Seal();
+                                }
                             }
                         }
                     }
@@ -3159,7 +3212,9 @@ TExprNode::TPtr ExpandPgSelectImpl(const TExprNode::TPtr& node, TExprContext& ct
             }
         } else {
             YQL_ENSURE(result);
-            TExprNode::TPtr projectionLambda = BuildProjectionLambda(node->Pos(), result, subLinkId.Defined(), emitPgStar, ctx);
+            auto finalType = node->GetTypeAnn()->Cast<TListExprType>()->GetItemType()->Cast<TStructExprType>();
+            Y_ENSURE(finalType);
+            TExprNode::TPtr projectionLambda = BuildProjectionLambda(node->Pos(), result, finalType, *order, *childOrder, subLinkId.Defined(), emitPgStar, ctx);
             TExprNode::TPtr projectionArg = projectionLambda->Head().HeadPtr();
             TExprNode::TPtr projectionRoot = projectionLambda->TailPtr();
             TVector<TString> inputAliases;

+ 125 - 13
ydb/library/yql/core/type_ann/type_ann_pg.cpp

@@ -12,6 +12,7 @@
 #include <ydb/library/yql/parser/pg_wrapper/interface/utils.h>
 
 #include <util/generic/set.h>
+#include <util/generic/hash.h>
 
 namespace NYql {
 
@@ -64,8 +65,8 @@ bool ValidateInputTypes(TExprNode& node, TExprContext& ctx) {
     return true;
 }
 
-TExprNodePtr WrapWithPgCast(TExprNodePtr&& node, ui32 targetTypeId, TContext& ctx) {
-    return ctx.Expr.Builder(node->Pos())
+TExprNodePtr WrapWithPgCast(TExprNodePtr&& node, ui32 targetTypeId, TExprContext& ctx) {
+    return ctx.Builder(node->Pos())
         .Callable("PgCast")
             .Add(0, std::move(node))
             .Callable(1, "PgType")
@@ -75,6 +76,113 @@ TExprNodePtr WrapWithPgCast(TExprNodePtr&& node, ui32 targetTypeId, TContext& ct
         .Build();
 };
 
+TExprNodePtr FindLeftCombinatorOfNthSetItem(const TExprNode* setItems, const TExprNode* setOps, ui32 n) {
+    TVector<ui32> setItemsStack(setItems->ChildrenSize());
+    i32 sp = -1;
+    ui32 itemIdx = 0;
+    for (const auto& op : setOps->Children()) {
+        if (op->Content() == "push") {
+            setItemsStack[++sp] = itemIdx++;
+        } else {
+            if (setItemsStack[sp] == n) {
+                return op;
+            }
+            --sp;
+            Y_ENSURE(0 <= sp);
+        }
+    }
+    Y_UNREACHABLE();
+}
+
+IGraphTransformer::TStatus InferPgCommonType(TPositionHandle pos, const TExprNode* setItems, const TExprNode* setOps,
+    TColumnOrder& resultColumnOrder, const TStructExprType*& resultStructType, TExtContext& ctx)
+{
+    TVector<TVector<ui32>> pgTypes;
+    size_t fieldsCnt = 0;
+
+    for (size_t i = 0; i < setItems->ChildrenSize(); ++i) {
+        const auto* child = setItems->Child(i);
+
+        if (!EnsureListType(*child, ctx.Expr)) {
+            return IGraphTransformer::TStatus::Error;
+        }
+        auto itemType = child->GetTypeAnn()->Cast<TListExprType>()->GetItemType();
+        YQL_ENSURE(itemType);
+
+        if (!EnsureStructType(child->Pos(), *itemType, ctx.Expr)) {
+            return IGraphTransformer::TStatus::Error;
+        }
+
+        auto childColumnOrder = ctx.Types.LookupColumnOrder(*child);
+        if (!childColumnOrder) {
+            ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(child->Pos()), TStringBuilder()
+                << "Input #" << i << " does not have ordered columns. "
+                << "Consider making column order explicit by using SELECT with column names"));
+            return IGraphTransformer::TStatus::Error;
+        }
+
+        if (0 == i) {
+            resultColumnOrder = *childColumnOrder;
+            fieldsCnt = resultColumnOrder.size();
+
+            pgTypes.resize(fieldsCnt);
+            for (size_t j = 0; j < fieldsCnt; ++j) {
+                pgTypes[j].reserve(setItems->ChildrenSize());
+            }
+        } else {
+            if ((*childColumnOrder).size() != fieldsCnt) {
+                TExprNodePtr combinator = FindLeftCombinatorOfNthSetItem(setItems, setOps, i);
+                Y_ENSURE(combinator);
+
+                TString op(combinator->Content());
+                if (op.EndsWith("_all")) {
+                    op.erase(op.length() - 4);
+                }
+                op.to_upper();
+
+                ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(child->Pos()), TStringBuilder()
+                    << "each " << op << " query must have the same number of columns"));
+
+                return IGraphTransformer::TStatus::Error;
+            }
+        }
+
+        const auto structType = itemType->Cast<TStructExprType>();
+        {
+            size_t j = 0;
+            for (const auto& col : *childColumnOrder) {
+                auto itemIdx = structType->FindItem(col);
+                YQL_ENSURE(itemIdx);
+                pgTypes[j].push_back(structType->GetItems()[*itemIdx]->GetItemType()->Cast<TPgExprType>()->GetId());
+
+                ++j;
+            }
+        }
+    }
+
+    TVector<const TItemExprType*> structItems;
+    for (size_t j = 0; j < fieldsCnt; ++j) {
+        const NPg::TTypeDesc* commonType;
+        if (const auto issue = NPg::LookupCommonType(pgTypes[j],
+            [j, &setItems, &ctx](size_t i) {
+                return ctx.Expr.GetPosition(setItems->Child(i)->Child(j)->Pos());
+            }, commonType))
+        {
+            ctx.Expr.AddError(*issue);
+            return IGraphTransformer::TStatus::Error;
+        }
+        structItems.push_back(ctx.Expr.MakeType<TItemExprType>(resultColumnOrder[j],
+            ctx.Expr.MakeType<TPgExprType>(commonType->TypeId)));
+    }
+
+    resultStructType = ctx.Expr.MakeType<TStructExprType>(structItems);
+    if (!resultStructType->Validate(pos, ctx.Expr)) {
+        return IGraphTransformer::TStatus::Error;
+    }
+
+    return IGraphTransformer::TStatus::Ok;
+}
+
 IGraphTransformer::TStatus PgStarWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) {
     Y_UNUSED(output);
     if (!EnsureArgsCount(*input, 0, ctx.Expr)) {
@@ -212,12 +320,12 @@ IGraphTransformer::TStatus PgCallWrapper(const TExprNode::TPtr& input, TExprNode
                 const auto& fargTypes = (*procPtr)->ArgTypes;
                 for (size_t i = 0; i < argTypes.size(); ++i) {
                     if (IsCastRequired(argTypes[i], fargTypes[i])) {
-                        children[i+3] = WrapWithPgCast(std::move(children[i+3]), fargTypes[i], ctx);
+                        children[i+3] = WrapWithPgCast(std::move(children[i+3]), fargTypes[i], ctx.Expr);
                     }
                 }
                 output = ctx.Expr.NewCallable(input->Pos(), "PgResolvedCall", std::move(children));
             } else if (const auto* typePtr = std::get_if<const NPg::TTypeDesc*>(&procOrType)) {
-                output = WrapWithPgCast(std::move(children[2]), (*typePtr)->TypeId, ctx);
+                output = WrapWithPgCast(std::move(children[2]), (*typePtr)->TypeId, ctx.Expr);
             } else {
                 Y_UNREACHABLE();
             }
@@ -454,16 +562,16 @@ IGraphTransformer::TStatus PgOpWrapper(const TExprNode::TPtr& input, TExprNode::
             switch(oper.Kind) {
                 case NPg::EOperKind::LeftUnary:
                     if (IsCastRequired(argTypes[0], oper.RightType)) {
-                        children[1] = WrapWithPgCast(std::move(children[1]), oper.RightType, ctx);
+                        children[1] = WrapWithPgCast(std::move(children[1]), oper.RightType, ctx.Expr);
                     }
                     break;
 
                 case NYql::NPg::EOperKind::Binary:
                     if (IsCastRequired(argTypes[0], oper.LeftType)) {
-                        children[1] = WrapWithPgCast(std::move(children[1]), oper.LeftType, ctx);
+                        children[1] = WrapWithPgCast(std::move(children[1]), oper.LeftType, ctx.Expr);
                     }
                     if (IsCastRequired(argTypes[1], oper.RightType)) {
-                        children[2] = WrapWithPgCast(std::move(children[2]), oper.RightType, ctx);
+                        children[2] = WrapWithPgCast(std::move(children[2]), oper.RightType, ctx.Expr);
                     }
                     break;
 
@@ -648,7 +756,7 @@ IGraphTransformer::TStatus PgAggWrapper(const TExprNode::TPtr& input, TExprNode:
     for (ui32 i = 0; i < argTypes.size(); ++i, ++argIdx) {
         if (IsCastRequired(argTypes[i], aggDesc.ArgTypes[i])) {
             auto& argNode = input->ChildRef(argIdx);
-            argNode = WrapWithPgCast(std::move(argNode), aggDesc.ArgTypes[i], ctx);
+            argNode = WrapWithPgCast(std::move(argNode), aggDesc.ArgTypes[i], ctx.Expr);
             needRetype = true;
         }
     }
@@ -4155,7 +4263,7 @@ IGraphTransformer::TStatus PgValuesListWrapper(const TExprNode::TPtr& input, TEx
             if (item->GetTypeAnn()->Cast<TPgExprType>()->GetId() == commonTypes[j]) {
                 rowValues.push_back(item);
             } else {
-                rowValues.push_back(WrapWithPgCast(std::move(item), commonTypes[j], ctx));
+                rowValues.push_back(WrapWithPgCast(std::move(item), commonTypes[j], ctx.Expr));
             }
         }
         resultValues.push_back(ctx.Expr.NewList(value->Pos(), std::move(rowValues)));
@@ -4338,7 +4446,11 @@ IGraphTransformer::TStatus PgSelectWrapper(const TExprNode::TPtr& input, TExprNo
 
     TColumnOrder resultColumnOrder;
     const TStructExprType* resultStructType = nullptr;
-    auto status = InferPositionalUnionType(input->Pos(), setItems->ChildrenList(), resultColumnOrder, resultStructType, ctx);
+
+    auto status = (1 == setItems->ChildrenSize() && HasSetting(*setItems->Child(0)->Child(0), "unknowns_allowed"))
+        ? InferPositionalUnionType(input->Pos(), setItems->ChildrenList(), resultColumnOrder, resultStructType, ctx)
+        : InferPgCommonType(input->Pos(), setItems, setOps, resultColumnOrder, resultStructType, ctx);
+
     if (status != IGraphTransformer::TStatus::Ok) {
         return status;
     }
@@ -4471,7 +4583,7 @@ IGraphTransformer::TStatus PgArrayWrapper(const TExprNode::TPtr& input, TExprNod
         if (argTypes[i] == elemType) {
             castArrayElems.push_back(child);
         } else {
-            castArrayElems.push_back(WrapWithPgCast(std::move(child), elemType, ctx));
+            castArrayElems.push_back(WrapWithPgCast(std::move(child), elemType, ctx.Expr));
         }
     }
     output = ctx.Expr.NewCallable(input->Pos(), "PgArray", std::move(castArrayElems));
@@ -4587,7 +4699,7 @@ IGraphTransformer::TStatus PgLikeWrapper(const TExprNode::TPtr& input, TExprNode
         if (argTypes[i] != textTypeId) {
             if (argTypes[i] == NPg::UnknownOid) {
                 auto& argNode = input->ChildRef(i);
-                argNode = WrapWithPgCast(std::move(argNode), textTypeId, ctx);
+                argNode = WrapWithPgCast(std::move(argNode), textTypeId, ctx.Expr);
                 return IGraphTransformer::TStatus::Repeat;
             }
             ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(input->Pos()),
@@ -4656,7 +4768,7 @@ IGraphTransformer::TStatus PgInWrapper(const TExprNode::TPtr& input, TExprNode::
     if (itemTypePg && inputTypePg && itemTypePg != inputTypePg) {
         if (inputTypePg == NPg::UnknownOid) {
 
-            input->ChildRef(0) = WrapWithPgCast(std::move(input->Child(0)), itemTypePg, ctx);
+            input->ChildRef(0) = WrapWithPgCast(std::move(input->Child(0)), itemTypePg, ctx.Expr);
             return IGraphTransformer::TStatus::Repeat;
         }
         if (itemTypePg == NPg::UnknownOid) {

+ 1 - 0
ydb/library/yql/core/type_ann/type_ann_pg.h

@@ -8,6 +8,7 @@
 namespace NYql {
 namespace NTypeAnnImpl {
 
+TExprNodePtr WrapWithPgCast(TExprNodePtr&& node, ui32 targetTypeId, TExprContext& ctx);
 TString MakeAliasedColumn(TStringBuf alias, TStringBuf column);
 const TItemExprType* AddAlias(const TString& alias, const TItemExprType* item, TExprContext& ctx);
 TStringBuf RemoveAlias(TStringBuf column);

+ 6 - 5
ydb/library/yql/sql/pg/pg_sql.cpp

@@ -705,6 +705,7 @@ public:
             }
         }
 
+        bool hasCombiningQueries = (1 < setItems.size());
 
         TAstNode* sort = nullptr;
         if (ListLength(value->sortClause) > 0) {
@@ -716,7 +717,7 @@ public:
                     return nullptr;
                 }
 
-                auto sort = ParseSortBy(CAST_NODE_EXT(PG_SortBy, T_SortBy, node), setItems.size() == 1, true);
+                auto sort = ParseSortBy(CAST_NODE_EXT(PG_SortBy, T_SortBy, node), !hasCombiningQueries, true);
                 if (!sort) {
                     return nullptr;
                 }
@@ -728,7 +729,7 @@ public:
         }
 
         TVector<TAstNode*> setItemNodes;
-        for (size_t id = 0; id < setItems.size(); id++) {
+        for (size_t id = 0; id < setItems.size(); ++id) {
             const auto& x = setItems[id];
             bool hasDistinctAll = false;
             TVector<TAstNode*> distinctOnItems;
@@ -1051,11 +1052,11 @@ public:
                 setItemOptions.push_back(QL(QA("distinct_on"), distinctOn));
             }
 
-            if (setItems.size() == 1 && sort) {
+            if (!hasCombiningQueries && sort) {
                 setItemOptions.push_back(QL(QA("sort"), sort));
             }
 
-            if (unknownsAllowed) {
+            if (unknownsAllowed || hasCombiningQueries) {
                 setItemOptions.push_back(QL(QA("unknowns_allowed")));
             }
 
@@ -1106,7 +1107,7 @@ public:
         selectOptions.push_back(QL(QA("set_items"), QVL(setItemNodes.data(), setItemNodes.size())));
         selectOptions.push_back(QL(QA("set_ops"), QVL(setOpsNodes.data(), setOpsNodes.size())));
 
-        if (setItems.size() > 1 && sort) {
+        if (hasCombiningQueries && sort) {
             selectOptions.push_back(QL(QA("sort"), sort));
         }
 

+ 22 - 0
ydb/library/yql/tests/sql/dq_file/part0/canondata/result.json

@@ -2129,6 +2129,28 @@
         }
     ],
     "test.test[pg-select_agg_expr_having-default.txt-Results]": [],
+    "test.test[pg-select_common_type_exceptall-default.txt-Analyze]": [
+        {
+            "checksum": "b4dd508a329723c74293d80f0278c705",
+            "size": 505,
+            "uri": "https://{canondata_backend}/1931696/12a17fd03ea37900d110696f266c04ad62432625/resource.tar.gz#test.test_pg-select_common_type_exceptall-default.txt-Analyze_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_exceptall-default.txt-Debug]": [
+        {
+            "checksum": "86def4c7f4efdf6e26a45f06259e1c67",
+            "size": 1385,
+            "uri": "https://{canondata_backend}/1931696/12a17fd03ea37900d110696f266c04ad62432625/resource.tar.gz#test.test_pg-select_common_type_exceptall-default.txt-Debug_/opt.yql_patched"
+        }
+    ],
+    "test.test[pg-select_common_type_exceptall-default.txt-Plan]": [
+        {
+            "checksum": "b4dd508a329723c74293d80f0278c705",
+            "size": 505,
+            "uri": "https://{canondata_backend}/1931696/12a17fd03ea37900d110696f266c04ad62432625/resource.tar.gz#test.test_pg-select_common_type_exceptall-default.txt-Plan_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_exceptall-default.txt-Results]": [],
     "test.test[pg-select_from_columns_star-default.txt-Analyze]": [
         {
             "checksum": "fc5340bdc777120c01eb5f7df2b5c38d",

+ 22 - 0
ydb/library/yql/tests/sql/dq_file/part1/canondata/result.json

@@ -1866,6 +1866,28 @@
         }
     ],
     "test.test[pg-select_alias_partial-default.txt-Results]": [],
+    "test.test[pg-select_common_type_union-default.txt-Analyze]": [
+        {
+            "checksum": "b4dd508a329723c74293d80f0278c705",
+            "size": 505,
+            "uri": "https://{canondata_backend}/1924537/3ef7ee54911365a79534947d32d1e7c271e9edf3/resource.tar.gz#test.test_pg-select_common_type_union-default.txt-Analyze_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_union-default.txt-Debug]": [
+        {
+            "checksum": "72cd603bf6af4ab0c6e3c748d945dbd4",
+            "size": 1710,
+            "uri": "https://{canondata_backend}/1924537/3ef7ee54911365a79534947d32d1e7c271e9edf3/resource.tar.gz#test.test_pg-select_common_type_union-default.txt-Debug_/opt.yql_patched"
+        }
+    ],
+    "test.test[pg-select_common_type_union-default.txt-Plan]": [
+        {
+            "checksum": "b4dd508a329723c74293d80f0278c705",
+            "size": 505,
+            "uri": "https://{canondata_backend}/1924537/3ef7ee54911365a79534947d32d1e7c271e9edf3/resource.tar.gz#test.test_pg-select_common_type_union-default.txt-Plan_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_union-default.txt-Results]": [],
     "test.test[pg-select_join_inner_equi-default.txt-Analyze]": [
         {
             "checksum": "a3b64a2cf9903b3868a2dd88a18fc46e",

+ 22 - 0
ydb/library/yql/tests/sql/dq_file/part10/canondata/result.json

@@ -1785,6 +1785,28 @@
         }
     ],
     "test.test[pg-select_case-default.txt-Results]": [],
+    "test.test[pg-select_common_type_except-default.txt-Analyze]": [
+        {
+            "checksum": "b4dd508a329723c74293d80f0278c705",
+            "size": 505,
+            "uri": "https://{canondata_backend}/1924537/dd93ed409770f0ece7fecd435f3849c139b141e9/resource.tar.gz#test.test_pg-select_common_type_except-default.txt-Analyze_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_except-default.txt-Debug]": [
+        {
+            "checksum": "fa39fdb658a4672e3a1d73ae6a11cf99",
+            "size": 1169,
+            "uri": "https://{canondata_backend}/1924537/dd93ed409770f0ece7fecd435f3849c139b141e9/resource.tar.gz#test.test_pg-select_common_type_except-default.txt-Debug_/opt.yql_patched"
+        }
+    ],
+    "test.test[pg-select_common_type_except-default.txt-Plan]": [
+        {
+            "checksum": "b4dd508a329723c74293d80f0278c705",
+            "size": 505,
+            "uri": "https://{canondata_backend}/1924537/dd93ed409770f0ece7fecd435f3849c139b141e9/resource.tar.gz#test.test_pg-select_common_type_except-default.txt-Plan_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_except-default.txt-Results]": [],
     "test.test[pg-select_proj_ref_distinct_on_star-default.txt-Analyze]": [
         {
             "checksum": "b4dd508a329723c74293d80f0278c705",

+ 44 - 0
ydb/library/yql/tests/sql/dq_file/part11/canondata/result.json

@@ -1684,6 +1684,50 @@
         }
     ],
     "test.test[pg-select_and_or_group-default.txt-Results]": [],
+    "test.test[pg-select_common_type_intersect-default.txt-Analyze]": [
+        {
+            "checksum": "a3b64a2cf9903b3868a2dd88a18fc46e",
+            "size": 922,
+            "uri": "https://{canondata_backend}/1942173/93413c7f437227eab2052810218d1df60ced3a52/resource.tar.gz#test.test_pg-select_common_type_intersect-default.txt-Analyze_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_intersect-default.txt-Debug]": [
+        {
+            "checksum": "b7f886ac72541468ca11daae8a5eb4df",
+            "size": 1761,
+            "uri": "https://{canondata_backend}/1942173/93413c7f437227eab2052810218d1df60ced3a52/resource.tar.gz#test.test_pg-select_common_type_intersect-default.txt-Debug_/opt.yql_patched"
+        }
+    ],
+    "test.test[pg-select_common_type_intersect-default.txt-Plan]": [
+        {
+            "checksum": "a3b64a2cf9903b3868a2dd88a18fc46e",
+            "size": 922,
+            "uri": "https://{canondata_backend}/1942173/93413c7f437227eab2052810218d1df60ced3a52/resource.tar.gz#test.test_pg-select_common_type_intersect-default.txt-Plan_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_intersect-default.txt-Results]": [],
+    "test.test[pg-select_common_type_unionall--Analyze]": [
+        {
+            "checksum": "d3ddb17f7bc55de2042bf5496146e95d",
+            "size": 9436,
+            "uri": "https://{canondata_backend}/1942525/16208faf1c4299915ddd3945e2017b318594867c/resource.tar.gz#test.test_pg-select_common_type_unionall--Analyze_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_unionall--Debug]": [
+        {
+            "checksum": "2f74bbe13c3925beb55fea98975d9dd1",
+            "size": 6664,
+            "uri": "https://{canondata_backend}/1942525/16208faf1c4299915ddd3945e2017b318594867c/resource.tar.gz#test.test_pg-select_common_type_unionall--Debug_/opt.yql_patched"
+        }
+    ],
+    "test.test[pg-select_common_type_unionall--Plan]": [
+        {
+            "checksum": "d3ddb17f7bc55de2042bf5496146e95d",
+            "size": 9436,
+            "uri": "https://{canondata_backend}/1942525/16208faf1c4299915ddd3945e2017b318594867c/resource.tar.gz#test.test_pg-select_common_type_unionall--Plan_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_unionall--Results]": [],
     "test.test[pg-select_except-default.txt-Analyze]": [
         {
             "checksum": "b2a2eb5d6b0a138ee924c128fc7738ef",

+ 22 - 0
ydb/library/yql/tests/sql/dq_file/part7/canondata/result.json

@@ -1885,6 +1885,28 @@
         }
     ],
     "test.test[pg-pg_types_window1-default.txt-Results]": [],
+    "test.test[pg-select_common_type_intersectall-default.txt-Analyze]": [
+        {
+            "checksum": "b4dd508a329723c74293d80f0278c705",
+            "size": 505,
+            "uri": "https://{canondata_backend}/1924537/8552d3077ff10f95a9d6ae208c13d115e0b5bdf8/resource.tar.gz#test.test_pg-select_common_type_intersectall-default.txt-Analyze_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_intersectall-default.txt-Debug]": [
+        {
+            "checksum": "97abca176b213d94abcd898879168598",
+            "size": 1233,
+            "uri": "https://{canondata_backend}/1924537/8552d3077ff10f95a9d6ae208c13d115e0b5bdf8/resource.tar.gz#test.test_pg-select_common_type_intersectall-default.txt-Debug_/opt.yql_patched"
+        }
+    ],
+    "test.test[pg-select_common_type_intersectall-default.txt-Plan]": [
+        {
+            "checksum": "b4dd508a329723c74293d80f0278c705",
+            "size": 505,
+            "uri": "https://{canondata_backend}/1924537/8552d3077ff10f95a9d6ae208c13d115e0b5bdf8/resource.tar.gz#test.test_pg-select_common_type_intersectall-default.txt-Plan_/plan.txt"
+        }
+    ],
+    "test.test[pg-select_common_type_intersectall-default.txt-Results]": [],
     "test.test[pg-select_join_right3-default.txt-Analyze]": [
         {
             "checksum": "a3b64a2cf9903b3868a2dd88a18fc46e",

+ 3 - 3
ydb/library/yql/tests/sql/dq_file/part8/canondata/result.json

@@ -2186,9 +2186,9 @@
     ],
     "test.test[pg-pg_like--Debug]": [
         {
-            "checksum": "3742490a569a528f4ebd4d94bab4c292",
-            "size": 2840,
-            "uri": "https://{canondata_backend}/1889210/084e90712790a8b88d6411c0965093f72cfd32fb/resource.tar.gz#test.test_pg-pg_like--Debug_/opt.yql_patched"
+            "checksum": "045f463bdaf4036293debac3556efb8f",
+            "size": 3216,
+            "uri": "https://{canondata_backend}/1936997/74ffff2742274f6b91add68347458117e389d491/resource.tar.gz#test.test_pg-pg_like--Debug_/opt.yql_patched"
         }
     ],
     "test.test[pg-pg_like--Plan]": [

Some files were not shown because too many files changed in this diff