diff --git a/core/src/main/java/io/substrait/expression/proto/ProtoExpressionConverter.java b/core/src/main/java/io/substrait/expression/proto/ProtoExpressionConverter.java index 8857614f8..3120c8941 100644 --- a/core/src/main/java/io/substrait/expression/proto/ProtoExpressionConverter.java +++ b/core/src/main/java/io/substrait/expression/proto/ProtoExpressionConverter.java @@ -197,15 +197,20 @@ public Expression from(io.substrait.proto.Expression expr) { var rel = protoRelConverter.from(expr.getSubquery().getScalar().getInput()); yield ImmutableExpression.ScalarSubquery.builder() .input(rel) - .type(rel.getRecordType().accept(new TypeVisitor.TypeThrowsVisitor("Expected struct field") { - @Override - public Type visit(Type.Struct type) throws RuntimeException { - if (type.fields().size() != 1) { - throw new UnsupportedOperationException("Scalar subquery must have exactly one field"); - } - return type.fields().get(0); - } - })) + .type( + rel.getRecordType() + .accept( + new TypeVisitor.TypeThrowsVisitor( + "Expected struct field") { + @Override + public Type visit(Type.Struct type) throws RuntimeException { + if (type.fields().size() != 1) { + throw new UnsupportedOperationException( + "Scalar subquery must have exactly one field"); + } + return type.fields().get(0); + } + })) .build(); } case IN_PREDICATE -> { diff --git a/spark/src/main/scala/io/substrait/spark/logical/ToSubstraitRel.scala b/spark/src/main/scala/io/substrait/spark/logical/ToSubstraitRel.scala index 695f93919..3451c1166 100644 --- a/spark/src/main/scala/io/substrait/spark/logical/ToSubstraitRel.scala +++ b/spark/src/main/scala/io/substrait/spark/logical/ToSubstraitRel.scala @@ -186,8 +186,8 @@ class ToSubstraitRel extends AbstractLogicalPlanVisitor with Logging { override def visitWindow(window: Window): relation.Rel = { val windowExpressions = window.windowExpressions - .flatMap(expr => expr.collect { case w: WindowExpression => w }) - .map(fromWindowCall(_, window.child.output)) + .flatMap(expr => expr.collect { case w: WindowExpression => w }) + .map(fromWindowCall(_, window.child.output)) .asJava val partitionExpressions = window.partitionSpec.map(toExpression(window.child.output)).asJava