Skip to content

fix: map switch expression to a Calcite CASE statement #452

fix: map switch expression to a Calcite CASE statement

fix: map switch expression to a Calcite CASE statement #452

Triggered via pull request October 19, 2023 19:54
Status Failure
Total duration 2m 53s
Artifacts

pr.yml

on: pull_request
Build and Test Java
2m 42s
Build and Test Java
Check editorconfig
4s
Check editorconfig
Lint commits for semantic-release
15s
Lint commits for semantic-release
Security validation
3s
Security validation
Dry-run release
16s
Dry-run release
Matrix: Build Isthmus Native Image
Fit to window
Zoom out
Zoom in

Annotations

2 errors
Build and Test Java: 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 and Test Java
Process completed with exit code 1.