-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for empty list literals (#227)
BREAKING CHANGE: ExpressionVisitor now has a `visit(Expression.EmptyListLiteral)` method BREAKING CHANGE: LiteralConstructorConverter constructor now requires a TypeConverter
- Loading branch information
1 parent
f148bbb
commit 2a98e3c
Showing
13 changed files
with
156 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
isthmus/src/test/java/io/substrait/isthmus/EmptyArrayLiteralTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.substrait.isthmus; | ||
|
||
import io.substrait.dsl.SubstraitBuilder; | ||
import io.substrait.expression.ExpressionCreator; | ||
import io.substrait.relation.Rel; | ||
import io.substrait.type.TypeCreator; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class EmptyArrayLiteralTest extends PlanTestBase { | ||
private static final TypeCreator N = TypeCreator.of(true); | ||
|
||
private final SubstraitBuilder b = new SubstraitBuilder(extensions); | ||
|
||
@Test | ||
void emptyArrayLiteral() { | ||
var colType = N.I8; | ||
var emptyListLiteral = ExpressionCreator.emptyList(false, N.I8); | ||
var rel = | ||
b.project( | ||
input -> List.of(emptyListLiteral), | ||
Rel.Remap.offset(1, 1), | ||
b.namedScan(List.of("t"), List.of("col"), List.of(colType))); | ||
assertFullRoundTrip(rel); | ||
} | ||
|
||
@Test | ||
void nullableEmptyArrayLiteral() { | ||
var colType = N.I8; | ||
var emptyListLiteral = ExpressionCreator.emptyList(true, N.I8); | ||
var rel = | ||
b.project( | ||
input -> List.of(emptyListLiteral), | ||
Rel.Remap.offset(1, 1), | ||
b.namedScan(List.of("t"), List.of("col"), List.of(colType))); | ||
assertFullRoundTrip(rel); | ||
} | ||
} |