|
1679 | 1679 | },
|
1680 | 1680 | "skip_e2e": true
|
1681 | 1681 | },
|
| 1682 | + { |
| 1683 | + "comment": "union with the same target shard (using `IN` with multiple matching values)", |
| 1684 | + "query": "SELECT id FROM music WHERE music.user_id IN (1, 2, 3) UNION SELECT id FROM music WHERE music.user_id IN (1, 2, 3)", |
| 1685 | + "plan": { |
| 1686 | + "Type": "Complex", |
| 1687 | + "QueryType": "SELECT", |
| 1688 | + "Original": "SELECT id FROM music WHERE music.user_id IN (1, 2, 3) UNION SELECT id FROM music WHERE music.user_id IN (1, 2, 3)", |
| 1689 | + "Instructions": { |
| 1690 | + "OperatorType": "Distinct", |
| 1691 | + "Collations": [ |
| 1692 | + "(0:1)" |
| 1693 | + ], |
| 1694 | + "ResultColumns": 1, |
| 1695 | + "Inputs": [ |
| 1696 | + { |
| 1697 | + "OperatorType": "Route", |
| 1698 | + "Variant": "IN", |
| 1699 | + "Keyspace": { |
| 1700 | + "Name": "user", |
| 1701 | + "Sharded": true |
| 1702 | + }, |
| 1703 | + "FieldQuery": "select dt.c0 as id, weight_string(dt.c0) from (select id from music where 1 != 1 union select id from music where 1 != 1) as dt(c0) where 1 != 1", |
| 1704 | + "Query": "select dt.c0 as id, weight_string(dt.c0) from (select id from music where music.user_id in ::__vals union select id from music where music.user_id in (1, 2, 3)) as dt(c0)", |
| 1705 | + "Values": [ |
| 1706 | + "(1, 2, 3)" |
| 1707 | + ], |
| 1708 | + "Vindex": "user_index" |
| 1709 | + } |
| 1710 | + ] |
| 1711 | + }, |
| 1712 | + "TablesUsed": [ |
| 1713 | + "user.music" |
| 1714 | + ] |
| 1715 | + } |
| 1716 | + }, |
| 1717 | + { |
| 1718 | + "comment": "union with the same target shard (using `IN` with the same normalized value)", |
| 1719 | + "query": "SELECT id FROM music WHERE music.user_id IN ::vtg1 UNION SELECT id FROM music WHERE music.user_id IN ::vtg1", |
| 1720 | + "plan": { |
| 1721 | + "Type": "Complex", |
| 1722 | + "QueryType": "SELECT", |
| 1723 | + "Original": "SELECT id FROM music WHERE music.user_id IN ::vtg1 UNION SELECT id FROM music WHERE music.user_id IN ::vtg1", |
| 1724 | + "Instructions": { |
| 1725 | + "OperatorType": "Distinct", |
| 1726 | + "Collations": [ |
| 1727 | + "(0:1)" |
| 1728 | + ], |
| 1729 | + "ResultColumns": 1, |
| 1730 | + "Inputs": [ |
| 1731 | + { |
| 1732 | + "OperatorType": "Route", |
| 1733 | + "Variant": "IN", |
| 1734 | + "Keyspace": { |
| 1735 | + "Name": "user", |
| 1736 | + "Sharded": true |
| 1737 | + }, |
| 1738 | + "FieldQuery": "select dt.c0 as id, weight_string(dt.c0) from (select id from music where 1 != 1 union select id from music where 1 != 1) as dt(c0) where 1 != 1", |
| 1739 | + "Query": "select dt.c0 as id, weight_string(dt.c0) from (select id from music where music.user_id in ::__vals union select id from music where music.user_id in ::vtg1) as dt(c0)", |
| 1740 | + "Values": [ |
| 1741 | + "::vtg1" |
| 1742 | + ], |
| 1743 | + "Vindex": "user_index" |
| 1744 | + } |
| 1745 | + ] |
| 1746 | + }, |
| 1747 | + "TablesUsed": [ |
| 1748 | + "user.music" |
| 1749 | + ] |
| 1750 | + } |
| 1751 | + }, |
| 1752 | + { |
| 1753 | + "comment": "union with the same target shard (using a mix of `IN` and `=` conditions)", |
| 1754 | + "query": "SELECT id FROM music WHERE music.user_id IN (1) UNION SELECT id FROM music WHERE music.user_id = 1", |
| 1755 | + "plan": { |
| 1756 | + "Type": "Passthrough", |
| 1757 | + "QueryType": "SELECT", |
| 1758 | + "Original": "SELECT id FROM music WHERE music.user_id IN (1) UNION SELECT id FROM music WHERE music.user_id = 1", |
| 1759 | + "Instructions": { |
| 1760 | + "OperatorType": "Route", |
| 1761 | + "Variant": "EqualUnique", |
| 1762 | + "Keyspace": { |
| 1763 | + "Name": "user", |
| 1764 | + "Sharded": true |
| 1765 | + }, |
| 1766 | + "FieldQuery": "select id from music where 1 != 1 union select id from music where 1 != 1", |
| 1767 | + "Query": "select id from music where music.user_id in (1) union select id from music where music.user_id = 1", |
| 1768 | + "Values": [ |
| 1769 | + "1" |
| 1770 | + ], |
| 1771 | + "Vindex": "user_index" |
| 1772 | + }, |
| 1773 | + "TablesUsed": [ |
| 1774 | + "user.music" |
| 1775 | + ] |
| 1776 | + } |
| 1777 | + }, |
1682 | 1778 | {
|
1683 | 1779 | "comment": "union with the same target shard last_insert_id",
|
1684 | 1780 | "query": "select *, last_insert_id() from music where user_id = 1 union select * from user where id = 1",
|
|
0 commit comments