UNION ALL appends both bags.

highlighted = computed this step

UNION ALL keeps duplicates

UNION ALL appends the right bag after the left bag.

duplicates stay\text{duplicates stay}

Append both bags

The result has 8 rows.

result rows=8\text{result rows}=8

Set-operation examples are tiny finite bag transforms; SQL dialect details, type coercion, collations, ordering clauses, performance, and product behavior are out of scope.

UNION ALL keeps duplicates: left input bagidtag1red1red2blue3green UNION ALL keeps duplicates: right input bagidtag1red3green3green4gold bag countsrowleftCountrightCountresultCount[1, red]213[2, blue]101[3, green]123[4, gold]011 result rowsidtag1red1red2blue3green1red3green3green4gold set operation factsfactvalueopunion_allleftRowCount4rightRowCount4resultRowCount8distinctResultRows4rejectednorejectionReasonnonerowOrdersource

Read source order

The result order is left source order followed by right source order.

source order\text{source order}

Summary

No duplicate row is removed by UNION ALL.

bag append\text{bag append}