Skip to content

Commit dddb35c

Browse files
wt0530githubgxll
authored andcommitted
[fix][dingo-calcite] Fix GROUP BY expression with argument name same with SELECT field and alias causes validation error
1 parent b95f4d9 commit dddb35c

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

dingo-calcite/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ configurations {
2727

2828
dependencies {
2929
annotationProcessor group: 'org.immutables', name: 'value', version: 'immutables'.v()
30-
api group: 'io.dingodb', name: 'calcite-core', version: '1.33.0-SNAPSHOT'
30+
implementation group: 'io.dingodb', name: 'calcite-core', version: '1.33.0-SNAPSHOT'
3131
api project(':dingo-exec')
3232
implementation project(':dingo-partition-api')
3333
implementation project(':dingo-codec-api')

dingo-calcite/src/test/java/io/dingodb/calcite/TestAggregate.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ public void testCountGroup() throws SqlParseException {
133133
RelRoot relRoot = parser.convert(sqlNode);
134134
Assert.relNode(relRoot.rel)
135135
.isA(LogicalDingoRoot.class)
136-
.soleInput().isA(LogicalProject.class)
137136
.soleInput().isA(LogicalAggregate.class)
138137
.soleInput().isA(LogicalProject.class)
139138
.soleInput().isA(LogicalDingoTableScan.class);
@@ -256,7 +255,6 @@ public void testAvg1() throws SqlParseException {
256255
RelRoot relRoot = parser.convert(sqlNode);
257256
Assert.relNode(relRoot.rel)
258257
.isA(LogicalDingoRoot.class)
259-
.soleInput().isA(LogicalProject.class)
260258
.soleInput().isA(LogicalAggregate.class)
261259
.soleInput().isA(LogicalProject.class)
262260
.soleInput().isA(LogicalDingoTableScan.class);
@@ -276,7 +274,6 @@ public void testAvg2() throws SqlParseException {
276274
RelRoot relRoot = parser.convert(sqlNode);
277275
Assert.relNode(relRoot.rel)
278276
.isA(LogicalDingoRoot.class)
279-
.soleInput().isA(LogicalProject.class)
280277
.soleInput().isA(LogicalAggregate.class)
281278
.soleInput().isA(LogicalProject.class)
282279
.soleInput().isA(LogicalDingoTableScan.class);
@@ -353,7 +350,6 @@ public void testMultiDistinctCountWithGroup() throws SqlParseException {
353350
RelRoot relRoot = parser.convert(sqlNode);
354351
Assert.relNode(relRoot.rel)
355352
.isA(LogicalDingoRoot.class)
356-
.soleInput().isA(LogicalProject.class)
357353
.soleInput().isA(LogicalAggregate.class)
358354
.soleInput().isA(LogicalProject.class)
359355
.soleInput().isA(LogicalDingoTableScan.class);

dingo-test/src/test/java/io/dingodb/test/dsl/BasicQueryCases.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ public BasicQueryCases() {
2727

2828
@Override
2929
public void build() {
30+
table("test_group_by", file("cases/tables/test_group_by.create.sql"))
31+
.init(file("cases/tables/test_group_by.data.sql"), 2);
32+
33+
test("Select group by timestamp")
34+
.use("table", "test_group_by")
35+
.step(
36+
"select substr(charge_start_time, 1, 16) as charge_start_time from {table} group by substr(charge_start_time, 1, 16)",
37+
csv(
38+
"charge_start_time",
39+
"STRING",
40+
"2025-09-21 22:30",
41+
"2025-05-06 11:50"
42+
)
43+
);
44+
3045
table("i4k_vs_f80", file("cases/tables/i4k_vs_f80.create.sql"))
3146
.init(file("cases/tables/i4k_vs_f80.data.sql"), 9);
3247

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
create table {table} (
2+
id int,
3+
name varchar(255),
4+
charge_start_time timestamp,
5+
primary key(id)
6+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
insert into {table} values
2+
(1, 'cccc', '2025-05-06 11:50:40'),
3+
(2, 'dddd', '2025-09-21 22:30:12')

dingo-verify/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
dependencies {
88
annotationProcessor group: 'com.google.auto.service', name: 'auto-service', version: 'auto-service'.v()
99
compileOnly group: 'com.google.auto.service', name: 'auto-service', version: 'auto-service'.v()
10-
api group: 'org.apache.calcite', name: 'calcite-core', version: 'calcite'.v()
10+
api group: 'io.dingodb', name: 'calcite-core', version: '1.33.0-SNAPSHOT'
1111
api group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
1212
implementation project(":dingo-common")
1313
implementation project(":dingo-net-api")

0 commit comments

Comments
 (0)