fix: map switch expression to a Calcite CASE statement #452
Annotations
2 errors
Build with Gradle:
task ':isthmus:spotlessJavaCheck'#L1
Execution failed for task ':isthmus:spotlessJavaCheck':
The following files had format violations:
src/main/java/io/substrait/isthmus/expression/ExpressionRexConverter.java
@@ -266,9 +266,13 @@
··public·RexNode·visit(Switch·expr)·throws·RuntimeException·{
····RexNode·match·=·expr.match().accept(this);
····Stream<RexNode>·caseThenArgs·=
-········expr.switchClauses().stream().flatMap(clause·->·Stream.of(
-············rexBuilder.makeCall(SqlStdOperatorTable.EQUALS,·match,·clause.condition().accept(this)),
-············clause.then().accept(this)));
+········expr.switchClauses().stream()
+············.flatMap(
+················clause·->
+····················Stream.of(
+························rexBuilder.makeCall(
+····························SqlStdOperatorTable.EQUALS,·match,·clause.condition().accept(this)),
+························clause.then().accept(this)));
····Stream<RexNode>·defaultArg·=·Stream.of(expr.defaultClause().accept(this));
····List<RexNode>·args·=·Stream.concat(caseThenArgs,·defaultArg).collect(Collectors.toList());
····return·rexBuilder.makeCall(SqlStdOperatorTable.CASE,·args);
src/test/java/io/substrait/isthmus/ExpressionConvertabilityTest.java
@@ -20,9 +20,7 @@
import·org.apache.calcite.sql.parser.SqlParseException;
import·org.junit.jupiter.api.Test;
-/**
-·*·Tests·which·test·that·an·expression·can·be·converted·to·and·from·Calcite·expressions.
-·*/
+/**·Tests·which·test·that·an·expression·can·be·converted·to·and·from·Calcite·expressions.·*/
public·class·ExpressionConvertabilityTest·extends·PlanTestBase·{
··static·final·TypeCreator·R·=·TypeCreator.of(false);
@@ -81,7 +79,8 @@
····················R.BOOLEAN,
····················b.fieldReference(commonTable,·0),
····················b.i32(10)))
-············.accept(to),·expression.accept(to));
+············.accept(to),
+········expression.accept(to));
··}
··@test
@@ -89,10 +88,13 @@
····Plan.Root·root·=
········b.root(
············b.filter(
-················input·->·b.switchExpression(b.fieldReference(input,·0),
-····················List.of(b.switchClause(b.i32(5),·b.i32(1)),
-························b.switchClause(b.i32(10),·b.i32(2))),
-····················b.i32(3)),
+················input·->
+····················b.switchExpression(
... (48 more lines that didn't fit)
Violations also present in:
src/test/java/io/substrait/isthmus/SubstraitRelNodeConverterTest.java
Run './gradlew :isthmus:spotlessApply' to fix these violations.
at com.diffplug.gradle.spotless.SpotlessCheck.performAction(SpotlessCheck.java:111)
at com.diffplug.gradle.spotless.SpotlessCheck.performAction(SpotlessCheck.java:53)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:248)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOpera
|
Build with Gradle
Process completed with exit code 1.
|
The logs for this run have expired and are no longer available.
Loading