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

Field keystone to non dynmic for casting #10

Merged
merged 7 commits into from
Mar 14, 2022

Conversation

pmonson711
Copy link
Contributor

@pmonson711 pmonson711 commented Mar 11, 2022

Basic approach, revert to the previous field lookups for realized fields in comparisons. Only use the dynamic value lookup when utilizing a fragment.

TODO TADONE

  • I think this means I should rename the field_or_alias to field_or_dynamic, thoughts?
  • I'm not sure I like the tuple structure after the update, it really needs a more consistent either type to be more readable and maintainable. Do I refactor those calls now?
  • Update the tests for null first / last to have a schema that can have nulls to show the behaviour is correct and to get coverage.
    After some review and thought, the todo approach changed slightly.
  1. we switched to maybe_expression instead of field_or_dynamic, and split the calls in fob by the two distinct branches of field and expression.
  2. The above addresses this mildly annoying function structure.
  3. Added tests for null first and last on day of week date sorting.

- missing coverage on nil comparision, I'm going to need to change the
  tests to a different schema to get full converage.
@the-mikedavis
Copy link
Contributor

Only use the dynamic value lookup when utilizing a fragment.

seems like a reasonable approach

I think field_or_dynamic sounds good 👍

I don't have strong feelings about a refactor now. The tuple is a bit messy but it's still readable imo.

@pmonson711 pmonson711 marked this pull request as ready for review March 14, 2022 16:14
@pmonson711
Copy link
Contributor Author

See #11 for some details as we updated the implementation

Copy link
Contributor

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

Nice. Seems like a good approach to allow the old behavior where we use a field/2 to explicitly list the column when possible and use the fragment/dynamic approach when a field/2 just won't cut it.

Also the wording around "route_" sgtm 👍

|> Enum.map(fn {{date, count}, index} ->
%{id: index, date: date, count: count}
end)
records = c.schema.seed()
Copy link
Contributor

Choose a reason for hiding this comment

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

I like 👍

@pmonson711 pmonson711 merged commit ebfb7f6 into main Mar 14, 2022
@pmonson711 pmonson711 deleted the field-keystone-to-non-dynmic-for-casting branch March 14, 2022 16:52
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.

2 participants