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

Change stance on SQL dialect support #130

Merged
merged 4 commits into from
Jun 9, 2021

Conversation

kemp-verily
Copy link
Contributor

This greatly softens the language around SQL support. A short list of
functions are specified as SHOULD implement, rather than a long list of MUST
implement.

The expectation is that we will revise this list over time as usage dictates.

This addresses issue #128.

This greatly softens the language around SQL support.  A short list of
functions are specified as SHOULD implement, rather than a long list of MUST
implement.

The expectation is that we will revise this list over time as usage dictates.

This addresses issue ga4gh-discovery#128.
@kemp-verily kemp-verily requested review from mcupak and jfuerth May 12, 2021 15:22
@kemp-verily
Copy link
Contributor Author

I significantly reduced the set of functions here based on two criteria:

  1. How critical I thought it might be
  2. How broadly implemented it was

Please, push back on a removal if you think it's critical that it be done in query as opposed to after query.

@mcupak
Copy link
Collaborator

mcupak commented May 13, 2021

Thanks @kemp-verily. I think this is a good base, but there are probably a few more that seem at the same level of importance to me, and we've used them in examples before. How do you feel about json_extract_scalar, the other substring, like, case, cast? Maybe also contains, || and coalesce (less important)?

The broader question is - do you feel strongly about removing the remaining functions completely vs. leaving them in as optional, maybe with a MAY keyword? The idea being that you really don't have to implement them, but if you do, this is how they should behave.

SPEC.md Outdated

* ga4gh_type (described above)
* **Logical Operators**
* `AND`, `OR`, `NOT`
* **Comparison Operators**
* `<`, `>`, `<=`, `>=`, `=`, `<>`, `!=`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've just noticed < is not escaped correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this just to < since it shouldn't be escaped at all AFAIK.

Copy link
Contributor

@jfuerth jfuerth left a comment

Choose a reason for hiding this comment

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

I've highlighted some of the functions and operators that I've found indispensable so far while working with phenotypic data in the context of Data Connect. I have certainly used other functions too.

What would you think about a MUST/SHOULD/MAY system where the very small set you propose (perhaps with the addition of NOW() or CURRENT_TIMESTAMP()), but then a SHOULD with more functions and operators and finally a MAY with the most.

My concern is that in accommodating non-SQL-backed implementations, we shouldn't actively encourage diversity in operator and function names. Without guidance and with the ANSI SQL spec being somewhat hard to get, people will naturally make diverse choices when implementing the non-mandatory functions.

* `uuid()*`
* **Session Information Functions**
* `current_user`*
* `IF`
Copy link
Contributor

Choose a reason for hiding this comment

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

If I could only have one conditional expression, I'd want CASE. I can't think of a time I've seen IF in a SQL query, but CASE pops up quite a bit. I'm not aware of any incompatibilities between SQL implementations here.

COALESCE isn't 100% necessary, but it's part of ANSI SQL and because of the way SQL handles nulls, it's often important to have.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced IF with CASE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added COALESCE and IF both actually

* **String manipulation**
* **Operators:**
* `Concatenation (||)`*
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we will need a way to splice strings together

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added, was an oversight!

SPEC.md Show resolved Hide resolved
Comment on lines -545 to -548
* `current_date`
* `current_time`
* `current_timestamp`
* `current_timestamp(p)`*
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need these (or now()) along with date arithmetic to convert a date of birth to an age at time of observation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, of course I should have said date of birth and observation date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@kemp-verily
Copy link
Contributor Author

filed #134 to track the regex work

@kemp-verily kemp-verily merged commit 3a9be1f into ga4gh-discovery:develop Jun 9, 2021
@kemp-verily kemp-verily deleted the sql branch June 9, 2021 19:29
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