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

Destroy all GADTs; Removes the From GADT and SqlExpr GADT #228

Merged
merged 33 commits into from
May 26, 2021

Conversation

belevy
Copy link
Collaborator

@belevy belevy commented Nov 4, 2020

Remove From GADT. Renamed ToFrom to From and ToFromT to FromT.

There are a couple of orphan instances caused by this. It might make sense to move subqueries into the same module as the class. That orphan is basically the only one that can't be eliminated. The orphans caused by the different joins can be rectified.

@parsonsmatt Do you have feelings on this change. Better, worse, or the same?

Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR.
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts).

…g the need for the intermediate structure. Extract the parts of the Experimental module into submodules.
@parsonsmatt
Copy link
Collaborator

yeah this rules!

GADTs are neat but simple type classes are even better 👍

@parsonsmatt
Copy link
Collaborator

parsonsmatt commented Nov 4, 2020

This is a breaking change to the internals of experimental, so I'm cool with calling it 3.4.1.0. 3.5.0.0 would be reasonable too.

@belevy belevy marked this pull request as ready for review November 30, 2020 01:50
@belevy
Copy link
Collaborator Author

belevy commented Nov 30, 2020

This PR is relevant to #231. I went ahead and put it into what i think is a mergeable state. The checks failed even installing ghc into the action. @parsonsmatt any idea why?

@parsonsmatt
Copy link
Collaborator

fixed the CI stuff in #233 , merge that in and try again?

@belevy
Copy link
Collaborator Author

belevy commented Jan 20, 2021

Paging @parsonsmatt I don't want to merge this in without your consent.

…ation in select clause before adding AS <alias>
… though that info isnt currently used anywhere
@parsonsmatt
Copy link
Collaborator

Can you do a quick self-review? It's hard to tell what the functional changes are vs the "moving code around" changes are.

Convert SqlExpr to a final encoding
@belevy
Copy link
Collaborator Author

belevy commented Feb 5, 2021

This now includes the changes to SqlExpr

@belevy belevy changed the title Explode the From GADT. Move runFrom into the ToFrom typeclass removin… Destroy all GADTs; Removes the From GADT and SqlExpr GADT Feb 5, 2021
@parsonsmatt
Copy link
Collaborator

hell yeah buddy

-- the FromRaw FromClause constructor directly when converting
-- from a @From@ to a @SqlQuery@ using @from@
--
-- /Since: 3.5.0.0/
Copy link
Collaborator

Choose a reason for hiding this comment

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

the syntax for this annotation is:

Suggested change
-- /Since: 3.5.0.0/
-- @since 3.5.0.0

@parsonsmatt
Copy link
Collaborator

going to get my work for 2.12 in

then i want to merge the 2.12 support in, then try it on the mercury codebase

should be sweet

@belevy
Copy link
Collaborator Author

belevy commented May 7, 2021

@parsonsmatt Got your 2.13 changes merged in, mind testing on mercurys code base

@parsonsmatt
Copy link
Collaborator

bles't thx

@parsonsmatt
Copy link
Collaborator

Just tested on the Mercury codebase. No errors or warnings or anything. Nice.

@hdgarrood @arthurxavierx would one of y'all be willing to test this on the Lumi codebase?

@eborden any chance y'all could try this out at Freckle?

@parsonsmatt parsonsmatt linked an issue May 7, 2021 that may be closed by this pull request
@parsonsmatt parsonsmatt added this to the 3.5 milestone May 7, 2021
@hdgarrood
Copy link
Contributor

IIRC we are matching on SqlExpr constructors in a few places (I know, I know) so I not sure how long it will take me to get around to trying this out, but I'll try to fit it in at some point.

@eborden
Copy link

eborden commented May 7, 2021

@parsonsmatt I'll pass this along.

@codedmart
Copy link

@parsonsmatt @belevy this PR compiles fine on Lumi's code. There were warnings on SqlQuery and Table for deprecations as expected, but were simple to update.

Has something changed for the outputted SQL because I ran into a runtime error with a query. I logged the SQL with esqueleto 3.4.2.1 and then also logged the SQL with this PR. Here is the problem error and problem diff:
SqlError {sqlState = "42703", sqlExecStatus = FatalError, sqlErrorMsg = "column q3.id does not exist", sqlErrorDetail = "", sqlErrorHint = ""}

- "q3"."v11_id",         -- esqueleto 3.4.2.1
+ "q3"."id" AS "v17_id", -- esqueleto 3.5.0.0 (this PR)

@belevy
Copy link
Collaborator Author

belevy commented May 19, 2021

@codedmart Are you able to post the query code? To answer your question, the query generation code has been shuffled around pretty hard and there is very possibly a bug with subqueries.

@belevy
Copy link
Collaborator Author

belevy commented May 19, 2021

@codedmart The only thing i could figure was different was the realiasing of already referenced things, in the old code this was handled as a passthrough. I have updated to match that, would you be able to retest?

@belevy
Copy link
Collaborator Author

belevy commented May 20, 2021

@codedmart and I were able to work out the issue. @parsonsmatt do we wait on Freckle?

@parsonsmatt
Copy link
Collaborator

@belevy I just fixed a bug with composite primary keys in a group by. Can you resolve merge conflicts?

I'm happy to merge it in today or tomorrow and do the release with deprecations. @eborden if you want some more time to do testing please let us know.

@belevy
Copy link
Collaborator Author

belevy commented May 21, 2021

@parsonsmatt Change is merged in but it appears to be obviated by the change in representation of composite keys. Also fixed an issue in the SQLite tests where it was accidentally set to focus on the sqlite specific cases only. I'm cool with making 3.5 "A New Hope" and adding the deprecation warnings for the old syntax.

@parsonsmatt
Copy link
Collaborator

Man I gotta have the focus set of families fail CI

@3kyro 3kyro mentioned this pull request May 26, 2021
@parsonsmatt
Copy link
Collaborator

thanks @belevy for your patience! let's get this going 😎

@parsonsmatt parsonsmatt merged commit ea4ff33 into bitemyapp:master May 26, 2021
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.

'undefined' with joins in Experimental syntax
6 participants