The above SQL has many UNION ALL and subqueries. If the UNION_MERGE rule is applied, an IgniteUnionAll operator with 9 child nodes will be generated. From the above figure, we can see that each child node has 7 possibilities, that is, 7 7 7 7 7 7 7 7 7 = 40353607. This will cause the plan space in CBO to explode, and directly cause the result HashSet in the TraitUtils#fillRecursive method to occupy a huge amount of memory, causing the Java program to be stuck due to GC.
union_query.txt union_query_plan.txt
The above SQL has many UNION ALL and subqueries. If the UNION_MERGE rule is applied, an IgniteUnionAll operator with 9 child nodes will be generated. From the above figure, we can see that each child node has 7 possibilities, that is, 7 7 7 7 7 7 7 7 7 = 40353607. This will cause the plan space in CBO to explode, and directly cause the result HashSet in the TraitUtils#fillRecursive method to occupy a huge amount of memory, causing the Java program to be stuck due to GC.
The related rules should be disabled is: