Compare aliases for TableNode

This commit is contained in:
vdimir 2024-04-25 11:21:22 +00:00
parent 831c4dbffd
commit 02239dd9f9
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
3 changed files with 23 additions and 1 deletions

View File

@ -56,7 +56,7 @@ bool TableNode::isEqualImpl(const IQueryTreeNode & rhs, CompareOptions) const
{
const auto & rhs_typed = assert_cast<const TableNode &>(rhs);
return storage_id == rhs_typed.storage_id && table_expression_modifiers == rhs_typed.table_expression_modifiers &&
temporary_table_name == rhs_typed.temporary_table_name;
temporary_table_name == rhs_typed.temporary_table_name && getAlias() == rhs_typed.getAlias();
}
void TableNode::updateTreeHashImpl(HashState & state, CompareOptions) const

View File

@ -0,0 +1,6 @@
1
2
3
1 1
2 2
3 3

View File

@ -0,0 +1,16 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (x Int32) ENGINE = MergeTree ORDER BY x;
INSERT INTO t1 VALUES (1), (2), (3);
SET allow_experimental_analyzer = 1;
SELECT t2.x FROM t1 JOIN t1 as t2 ON t1.x = t2.x GROUP BY t1.x; -- { serverError NOT_AN_AGGREGATE }
SELECT t2.x FROM t1 as t0 JOIN t1 as t2 ON t1.x = t2.x GROUP BY t1.x; -- { serverError NOT_AN_AGGREGATE }
SELECT t2.x FROM t1 as t0 JOIN t1 as t2 ON t0.x = t2.x GROUP BY t0.x; -- { serverError NOT_AN_AGGREGATE }
SELECT t2.x FROM t1 JOIN t1 as t2 ON t1.x = t2.x GROUP BY x; -- { serverError NOT_AN_AGGREGATE }
SELECT t1.x FROM t1 JOIN t1 as t2 ON t1.x = t2.x GROUP BY t2.x; -- { serverError NOT_AN_AGGREGATE }
SELECT x FROM t1 JOIN t1 as t2 ON t1.x = t2.x GROUP BY t2.x; -- { serverError NOT_AN_AGGREGATE }
SELECT x FROM t1 JOIN t1 as t2 USING (x) GROUP BY t2.x; -- { serverError NOT_AN_AGGREGATE }
SELECT t1.x FROM t1 JOIN t1 as t2 ON t1.x = t2.x GROUP BY x ORDER BY ALL;
SELECT x, sum(t2.x) FROM t1 JOIN t1 as t2 ON t1.x = t2.x GROUP BY t1.x ORDER BY ALL;