Skip to content

Commit

Permalink
Update calcite to fix handling of queries with nested group by (#96)
Browse files Browse the repository at this point in the history
* Bump linkedin-calcite version to 1.21.0.146

Motivation for version bump is fix for handling
translation for queries with nested group by.

* Add regression test for nested group by conversion
  • Loading branch information
losipiuk authored Jun 9, 2021
1 parent 3c23a3d commit 265ed15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion coral-hive/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'antlr'

dependencies {
antlr deps.'antlr'
compile('com.linkedin.calcite:calcite-core:1.21.0.140') {
compile('com.linkedin.calcite:calcite-core:1.21.0.146') {
artifact {
name = 'calcite-core'
extension = 'jar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,15 @@ public void testUnionExtractUDF() {
assertEquals(generated2, expected2);
}

@Test
public void testNestedGroupBy() {
final String sql = "SELECT a, count(1) count FROM (SELECT a FROM foo GROUP BY a ) t GROUP BY a ";
RelNode rel = toRel(sql);
final String expectedSql =
"SELECT a, COUNT(*) count\nFROM (SELECT a, 1 $f1\nFROM hive.default.foo\nGROUP BY a) t1\nGROUP BY a";
assertEquals(relToHql(rel), expectedSql);
}

private String relToString(String sql) {
return RelOptUtil.toString(converter.convertSql(sql));
}
Expand Down

0 comments on commit 265ed15

Please sign in to comment.