You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// having and group by clause may reference aliases defined in select projection
1042
1048
let projected_plan = self.project(plan.clone(), select_exprs.clone())?;
1043
1049
@@ -3191,21 +3197,35 @@ mod tests {
3191
3197
3192
3198
#[test]
3193
3199
fnselect_repeated_column(){
3194
-
let sql = "SELECT age, age FROM person";
3195
-
let err = logical_plan(sql).expect_err("query should have failed");
3196
-
assert_eq!(
3197
-
r##"Plan("Projections require unique expression names but the expression \"#person.age\" at position 0 and \"#person.age\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3198
-
format!("{:?}", err)
3200
+
// let sql = "SELECT age, age FROM person";
3201
+
// let err = logical_plan(sql).expect_err("query should have failed");
3202
+
// assert_eq!(
3203
+
// r##"Plan("Projections require unique expression names but the expression \"#person.age\" at position 0 and \"#person.age\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3204
+
// format!("{:?}", err)
3205
+
// );
3206
+
3207
+
// NOTE: this is supported with cubesql patches
3208
+
quick_test(
3209
+
"SELECT age, age FROM person",
3210
+
"Projection: #person.age, #person.age AS age__1\
3211
+
\n TableScan: person projection=None",
3199
3212
);
3200
3213
}
3201
3214
3202
3215
#[test]
3203
3216
fnselect_wildcard_with_repeated_column(){
3204
-
let sql = "SELECT *, age FROM person";
3205
-
let err = logical_plan(sql).expect_err("query should have failed");
3206
-
assert_eq!(
3207
-
r##"Plan("Projections require unique expression names but the expression \"#person.age\" at position 3 and \"#person.age\" at position 8 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3208
-
format!("{:?}", err)
3217
+
// let sql = "SELECT *, age FROM person";
3218
+
// let err = logical_plan(sql).expect_err("query should have failed");
3219
+
// assert_eq!(
3220
+
// r##"Plan("Projections require unique expression names but the expression \"#person.age\" at position 3 and \"#person.age\" at position 8 have the same name. Consider aliasing (\"AS\") one of them.")"##,
let sql = "SELECT MIN(age), MIN(age) FROM person";
3783
-
let err = logical_plan(sql).expect_err("query should have failed");
3784
-
assert_eq!(
3785
-
r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age)\" at position 0 and \"MIN(#person.age)\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3786
-
format!("{:?}", err)
3802
+
// let sql = "SELECT MIN(age), MIN(age) FROM person";
3803
+
// let err = logical_plan(sql).expect_err("query should have failed");
3804
+
// assert_eq!(
3805
+
// r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age)\" at position 0 and \"MIN(#person.age)\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3806
+
// format!("{:?}", err)
3807
+
// );
3808
+
3809
+
// NOTE: this is supported with cubesql patches
3810
+
quick_test(
3811
+
"SELECT MIN(age), MIN(age) FROM person",
3812
+
"Projection: #MIN(person.age), #MIN(person.age) AS MIN(person.age)__1\
let sql = "SELECT MIN(age) AS a, MIN(age) AS a FROM person";
3813
-
let err = logical_plan(sql).expect_err("query should have failed");
3814
-
assert_eq!(
3815
-
r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age) AS a\" at position 0 and \"MIN(#person.age) AS a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3816
-
format!("{:?}", err)
3840
+
// let sql = "SELECT MIN(age) AS a, MIN(age) AS a FROM person";
3841
+
// let err = logical_plan(sql).expect_err("query should have failed");
3842
+
// assert_eq!(
3843
+
// r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age) AS a\" at position 0 and \"MIN(#person.age) AS a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3844
+
// format!("{:?}", err)
3845
+
// );
3846
+
3847
+
// NOTE: this is supported with cubesql patches
3848
+
quick_test(
3849
+
"SELECT MIN(age) AS a, MIN(age) AS a FROM person",
3850
+
"Projection: #MIN(person.age) AS a, #MIN(person.age) AS a__1\
let sql = "SELECT state AS a, MIN(age) AS a FROM person GROUP BY state";
3843
-
let err = logical_plan(sql).expect_err("query should have failed");
3844
-
assert_eq!(
3845
-
r##"Plan("Projections require unique expression names but the expression \"#person.state AS a\" at position 0 and \"MIN(#person.age) AS a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3846
-
format!("{:?}", err)
3878
+
// let sql = "SELECT state AS a, MIN(age) AS a FROM person GROUP BY state";
3879
+
// let err = logical_plan(sql).expect_err("query should have failed");
3880
+
// assert_eq!(
3881
+
// r##"Plan("Projections require unique expression names but the expression \"#person.state AS a\" at position 0 and \"MIN(#person.age) AS a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")"##,
3882
+
// format!("{:?}", err)
3883
+
// );
3884
+
3885
+
// NOTE: this is supported with cubesql patches
3886
+
quick_test(
3887
+
"SELECT state AS a, MIN(age) AS a FROM person GROUP BY state",
3888
+
"Projection: #person.state AS a, #MIN(person.age) AS a__1\
let sql = "SELECT state, MIN(age), MIN(age) FROM person GROUP BY state";
4012
-
let err = logical_plan(sql).expect_err("query should have failed");
4013
-
assert_eq!(
4014
-
r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age)\" at position 1 and \"MIN(#person.age)\" at position 2 have the same name. Consider aliasing (\"AS\") one of them.")"##,
4015
-
format!("{:?}", err)
4016
-
);
4055
+
// let sql = "SELECT state, MIN(age), MIN(age) FROM person GROUP BY state";
4056
+
// let err = logical_plan(sql).expect_err("query should have failed");
4057
+
// assert_eq!(
4058
+
// r##"Plan("Projections require unique expression names but the expression \"MIN(#person.age)\" at position 1 and \"MIN(#person.age)\" at position 2 have the same name. Consider aliasing (\"AS\") one of them.")"##,
4059
+
// format!("{:?}", err)
4060
+
// );
4061
+
4062
+
// NOTE: this is supported with cubesql patches
4063
+
quick_test(
4064
+
"SELECT state, MIN(age), MIN(age) FROM person GROUP BY state",
4065
+
"Projection: #person.state, #MIN(person.age), #MIN(person.age) AS MIN(person.age)__1\
0 commit comments