Skip to content

Commit

Permalink
Allow empty array (#101)
Browse files Browse the repository at this point in the history
* Bump calcite version to 1.21.0.148

* Allow users to select empty array with calcite 1.21.0.149
  • Loading branch information
ljfgem authored Jun 18, 2021
1 parent 2ae7fe4 commit 4a06bc3
Show file tree
Hide file tree
Showing 2 changed files with 16 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.148') {
compile('com.linkedin.calcite:calcite-core:1.21.0.149') {
artifact {
name = 'calcite-core'
extension = 'jar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,21 @@ public void testArrayType() {
assertEquals(RelOptUtil.toString(converter.convertSql(sql)), expected);
}

@Test
public void testSelectEmptyArray() {
final String sql = "SELECT array()";
final String expected = "LogicalProject(EXPR$0=[ARRAY()])\n" + " LogicalValues(tuples=[[{ 0 }]])\n";
assertEquals(RelOptUtil.toString(converter.convertSql(sql)), expected);
}

@Test
public void testEmptyArrayInFilter() {
String sql = "SELECT 1 WHERE array_contains(array(), '1')";
String expected = "LogicalProject(EXPR$0=[1])\n" + " LogicalFilter(condition=[array_contains(ARRAY(), '1')])\n"
+ " LogicalValues(tuples=[[{ 0 }]])\n";
assertEquals(RelOptUtil.toString(converter.convertSql(sql)), expected);
}

@Test
public void testSelectArrayElement() {
final String sql = "SELECT c[0] from complex";
Expand Down

0 comments on commit 4a06bc3

Please sign in to comment.