-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add proto roundtrips for Spark tests and fix issues it surfaces #315
base: main
Are you sure you want to change the base?
Changes from all commits
f25c736
16a7694
44c83dd
7fe9564
88d95d1
8c9c677
00eb750
f6494e2
fb36197
fb788e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -312,7 +312,7 @@ void scalarSubquery() { | |
Stream.of( | ||
Expression.ScalarSubquery.builder() | ||
.input(relWithEnhancement) | ||
.type(TypeCreator.REQUIRED.struct(TypeCreator.REQUIRED.I64)) | ||
.type(TypeCreator.REQUIRED.I64) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not 100% sure about this, is it actually meant to return a struct type? given it's scalar that seems a bit weird |
||
.build()) | ||
.collect(Collectors.toList()), | ||
commonTable); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,7 +134,7 @@ class ToSubstraitRel extends AbstractLogicalPlanVisitor with Logging { | |
val aggregates = collectAggregates(actualResultExprs, aggExprToOutputOrdinal) | ||
val aggOutputMap = aggregates.zipWithIndex.map { | ||
case (e, i) => | ||
AttributeReference(s"agg_func_$i", e.dataType)() -> e | ||
AttributeReference(s"agg_func_$i", e.dataType, nullable = e.nullable)() -> e | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these were causing wrong nullability for the type in the created pojos. I don't think that type field is used anywhere so it didn't cause harm, but still failed roundtrip tests as the type isn't written in proto and then it got correctly evaluated from other fields on read. |
||
} | ||
val aggOutput = aggOutputMap.map(_._1) | ||
|
||
|
@@ -148,7 +148,7 @@ class ToSubstraitRel extends AbstractLogicalPlanVisitor with Logging { | |
} | ||
val groupOutputMap = actualGroupExprs.zipWithIndex.map { | ||
case (e, i) => | ||
AttributeReference(s"group_col_$i", e.dataType)() -> e | ||
AttributeReference(s"group_col_$i", e.dataType, nullable = e.nullable)() -> e | ||
} | ||
val groupOutput = groupOutputMap.map(_._1) | ||
|
||
|
@@ -212,12 +212,15 @@ class ToSubstraitRel extends AbstractLogicalPlanVisitor with Logging { | |
} | ||
|
||
private def fetch(child: LogicalPlan, offset: Long, limit: Long = -1): relation.Fetch = { | ||
relation.Fetch | ||
val builder = relation.Fetch | ||
.builder() | ||
.input(visit(child)) | ||
.offset(offset) | ||
.count(limit) | ||
.build() | ||
if (limit != -1) { | ||
builder.count(limit) | ||
} | ||
|
||
builder.build() | ||
} | ||
|
||
override def visitGlobalLimit(p: GlobalLimit): relation.Rel = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the docs for this (https://substrait.io/relations/logical_relations/#set-operation-types), the output nullability depends on which set operation is being performed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, I realized that as well but forgot to fix 😅 I'll try to tomorrow..