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

Fix renaming properties for flat joins #872

Merged
merged 2 commits into from
Sep 8, 2017
Merged

Conversation

mosyp
Copy link
Collaborator

@mosyp mosyp commented Sep 7, 2017

Fixes #859

Problem

When using flat joins, rename properties via querySchema/schemaMeta didn't work.

Solution

Fix the issue, more in comments to patch

Checklist

  • Unit test all changes
  • Update README.md if applicable
  • Add [WIP] to the pull request title if it's work in progress
  • Squash commits that aren't meaningful changes
  • Run sbt scalariformFormat test:scalariformFormat to make sure that the source files are formatted

@getquill/maintainers

@@ -80,7 +80,7 @@ object RenameProperties extends StatelessTransformer {
case (a, schemaA) =>
val replaceA = replacements(iA, schemaA)
val onr = BetaReduction(on, replaceA: _*)
(FlatJoin(typ, a, iA, onr), Tuple(List(schemaA)))
(FlatJoin(typ, a, iA, onr), schemaA)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

replacements function later prepends x._1. to path hence BetaReduction could not properly replace aliases

} yield x.map(x => x.i -> x.s)
}
testContext.run(q).string mustEqual
"SELECT b.field_i, b.field_s FROM TestEntity2 a LEFT JOIN test_entity b ON a.s = b.field_s"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Before patch it was like
SELECT b.i, b.s FROM TestEntity2 a LEFT JOIN test_entity b ON a.s = b.field_s

@mosyp mosyp merged commit ec83092 into zio:master Sep 8, 2017
@mosyp mosyp deleted the flat_join_rename branch October 9, 2017 12:05
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.

3 participants