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

timeutil: unify parsing of AT TIME ZONE and SET TIME ZONE #43414

Merged
merged 1 commit into from
Jan 13, 2020

Conversation

otan
Copy link
Contributor

@otan otan commented Dec 20, 2019

Resolves cockroachdb/django-cockroachdb#97.

We previously had multiple permutations of parsing TIME ZONE params
using the two different syntaxes of AT TIME ZONE and SET TIME ZONE.
This aims to bring them all under one roof.

Furthermore, we upgrade SET TIME ZONE functionality to respect colons
in time names without the GMT/UTC prefix, e.g. '3:00'.

Release note (sql change, bug fix):

  • We previously did not support AT TIME ZONE parsing for anything
    other than precise location strings, e.g. only AT TIME ZONE 'Australia/Sydney' works. This PR adds support for parsing AT TIME ZONE with various other offset behaviour that is supported by,
    SET TIME ZONE e.g. AT TIME ZONE '+3', AT TIME ZONE 'GMT+4'
  • We previously did not support SET TIME ZONE with colons, e.g.
    +4:00. This PR adds that support in.

@otan otan requested review from solongordon and a team December 20, 2019 18:24
@cockroach-teamcity
Copy link
Member

This change is Reviewable

We previously had multiple permutations of parsing TIME ZONE params
using the two different syntaxes of `AT TIME ZONE` and `SET TIME ZONE`.
This aims to bring them all under one roof.

Furthermore, we upgrade SET TIME ZONE functionality to respect colons
in time names without the GMT/UTC prefix, e.g. '3:00'.

Release note (sql change, bug fix):
* We previously did not support `AT TIME ZONE` parsing for anything
other than precise location strings, e.g. only `AT TIME ZONE
'Australia/Sydney'` works. This PR adds support for parsing `AT TIME
ZONE` with various other offset behaviour that is supported by,
SET TIME ZONE e.g. `AT TIME ZONE '+3'`, `AT TIME ZONE 'GMT+4'`
* We previously did not support SET TIME ZONE with colons, e.g.
`+4:00`. This PR adds that support in.
Copy link
Contributor

@solongordon solongordon left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @solongordon)

@otan
Copy link
Contributor Author

otan commented Jan 13, 2020

bors r=solongordon

craig bot pushed a commit that referenced this pull request Jan 13, 2020
43379: tree: fix various interval parsing bugs with interval qualifiers r=solongordon a=otan

This PR aims to address all issues related to bugs with intervals when
we have interval qualifiers (e.g. DAY TO HOUR, etc).

The major thing of note is removing one block of parsing from
`ParseDInterval` into `sqlStdToDuration`, to simplify the logic for
these bug fixes. The other ones are (hopefully) straightforward to review.

Release note (sql change, bug fix):
* Previously, `SELECT interval '1-2 1' DAY TO HOUR` would fail, but is
permitted as per the SQL standard. This is now fixed.
* Previously, adding spaces to intervals with qualifiers, e.g. `SELECT
interval '  1  ' YEAR` would try evaluate it as seconds always. Patched
to use the qualifier as the multiplier instead.
* Previously, adding a decimal point to days, e.g. `SELECT interval '1.5
01:00:00'` would return `1 day 01:00:00`, instead of postgres which
returns `1 day 13:00:00`. This PR fixes that behaviour to match postgres.
* Previously, using the `Y-M <constant>` format for intervals, e.g.
`SELECT INTERVAL '1-2 3'` will always resolve the '<constant>' component
(3) as seconds. However, for items such as `SELECT INTERVAL '1-2 3' DAY`,
the constant (3) should represent days, as does postgres.

43414: timeutil: unify parsing of AT TIME ZONE and SET TIME ZONE r=solongordon a=otan

Resolves cockroachdb/django-cockroachdb#97.

We previously had multiple permutations of parsing TIME ZONE params
using the two different syntaxes of `AT TIME ZONE` and `SET TIME ZONE`.
This aims to bring them all under one roof.

Furthermore, we upgrade SET TIME ZONE functionality to respect colons
in time names without the GMT/UTC prefix, e.g. '3:00'.

Release note (sql change, bug fix):
* We previously did not support `AT TIME ZONE` parsing for anything
other than precise location strings, e.g. only `AT TIME ZONE
'Australia/Sydney'` works. This PR adds support for parsing `AT TIME
ZONE` with various other offset behaviour that is supported by,
SET TIME ZONE e.g. `AT TIME ZONE '+3'`, `AT TIME ZONE 'GMT+4'`
* We previously did not support SET TIME ZONE with colons, e.g.
`+4:00`. This PR adds that support in.

43798: demo: add splits to movr dataset r=knz a=rohany

Fixes #42592.

This PR adds split points to the movr dataset so that ranges
will be spread out among all of the nodes in the cluster.

Release note (cli change): The movr dataset will be split among
all nodes in the demo cluster.

Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
Co-authored-by: Rohan Yadav <rohany@alumni.cmu.edu>
@craig
Copy link
Contributor

craig bot commented Jan 13, 2020

Build succeeded

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.

Unsupported query: timezone() doesn't support UTC offsets
3 participants