Skip to content
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

[wip] fix: add proto roundtrips for Spark tests and fix issues it surfaces #315

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Blizzara
Copy link
Contributor

No description provided.

// count only needs to be set when it is not -1
builder.count(rel.getCount());
}
var builder = Fetch.builder().input(input).offset(rel.getOffset()).count(rel.getCount());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while the idea of not setting count if it's -1 is fine, this makes roundtrip tests fail if count is set in the pojo. Alternative fix is to ensure in the pojo it's never set if -1.

@@ -131,7 +131,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
Copy link
Contributor Author

@Blizzara Blizzara Oct 28, 2024

Choose a reason for hiding this comment

The 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 windowExpressions = window.windowExpressions
.flatMap(expr => expr.collect { case w: WindowExpression => w })
.map(fromWindowCall(_, window.child.output))
.asJava
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous code would fail if there was a column like Alias(Alias(WindowExpression(..))), this catches those. It doesn't explicitly fail if there's some other wrappers for WindowExpressions than Alias, but I hope that's not the case in valid Spark plans

@Blizzara Blizzara force-pushed the avo/stronger-testing branch from 61faef5 to 623ee12 Compare November 21, 2024 17:14
@Blizzara Blizzara force-pushed the avo/stronger-testing branch from 623ee12 to e374c85 Compare November 21, 2024 17:31
@@ -312,7 +312,7 @@ void scalarSubquery() {
Stream.of(
Expression.ScalarSubquery.builder()
.input(relWithEnhancement)
.type(TypeCreator.REQUIRED.struct(TypeCreator.REQUIRED.I64))
.type(TypeCreator.REQUIRED.I64)
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant