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

sql: disambiguate float,decimal formatting #28129

Merged
merged 1 commit into from
Aug 1, 2018

Conversation

jordanlewis
Copy link
Member

Previously, the FmtParsable directive wouldn't produce a parsable
representation for some floats and decimals, in the context of other
expressions. In particular, negative floats and decimals would format
like -10.0:::FLOAT. This seems fine, but since the ::: operator
binds more closely than the - operator, an expression like
(-10.0:::FLOAT)::STRING would get formatted to
-10.0:::FLOAT::STRING, which is of course invalid as there's no unary
negative operator for the string datatype.

Now, floats and decimals are marked as unambiguously formatted datatypes
and take care of disambiguating themselves with a type annotation if
necessary, as well as further-disambiguating parentheses if the numbers
are nuegative.

Release note (bug fix): correct the round-trip formatting of negative
floats and decimals in the context of other expressions when executing
in a distributed flow.

@jordanlewis jordanlewis requested a review from a team August 1, 2018 06:23
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@jordanlewis jordanlewis requested a review from a team as a code owner August 1, 2018 14:42
@knz
Copy link
Contributor

knz commented Aug 1, 2018

can you double check the failing logic tests and fix the handling of NaN, then I'll have another look

@jordanlewis
Copy link
Member Author

Done, PTAL.

@knz
Copy link
Contributor

knz commented Aug 1, 2018 via email

Previously, the FmtParsable directive wouldn't produce a parsable
representation for some floats and decimals, in the context of other
expressions. In particular, negative floats and decimals would format
like `-10.0:::FLOAT`. This seems fine, but since the `:::` operator
binds more closely than the `-` operator, an expression like
`(-10.0:::FLOAT)::STRING` would get formatted to
`-10.0:::FLOAT::STRING`, which is of course invalid as there's no unary
negative operator for the string datatype.

Now, floats and decimals are marked as unambiguously formatted datatypes
and take care of disambiguating themselves with a type annotation if
necessary, as well as further-disambiguating parentheses if the numbers
are nuegative.

Release note (bug fix): correct the round-trip formatting of negative
floats and decimals in the context of other expressions when executing
in a distributed flow.
@jordanlewis
Copy link
Member Author

Done. TFTR!

@jordanlewis
Copy link
Member Author

bors r+

craig bot pushed a commit that referenced this pull request Aug 1, 2018
28072: rangefeed: create new rangefeed package r=nvanbenschoten a=nvanbenschoten

This is the first "mergable" part of #27285.

The change introduces a new rangefeed package, which exports a `Processor`
that manages a set of rangefeed registrations and handles the routing of
logical updates to these registrations. While routing logical updates to
rangefeed registrations, the processor performs two important tasks:
1. it translates logical updates into rangefeed events. These logical
   updates are provided to the Processor through its `ConsumeLogicalOps`
   method.
2. it transforms a range-level closed timestamp to a rangefeed-level resolved
   timestamp. Closed timestamp updates are passed to the Processor through
   its `ForwardClosedTS` method.

In order to perform its second task, a `Processor` hold on to a `resolvedTimestamp`
object. A rangefeed's "resolved timestamp" is defined as the timestamp at
which no future updates will be emitted to the feed at or before. The timestamp
is monotonically increasing and is communicated through RangeFeedCheckpoint
notifications whenever it changes. The `resolvedTimestamp` itself holds on
to a `unresolvedIntentQueue` (described in #26782) which allows it to efficiently
track unresolved intents that it observes in logical updates provided to the
Processor.

There are two major pieces of this package missing. The first is catch up
scans for new registrations and the second is a mechanism to push intents
that are old enough to be holding back the resolved timestamp.

The change doesn't plug anything in yet, but a rough draft of the plumbing
can be seen in #27285.

Release note: None

28129: sql: disambiguate float,decimal formatting r=jordanlewis a=jordanlewis

Previously, the FmtParsable directive wouldn't produce a parsable
representation for some floats and decimals, in the context of other
expressions. In particular, negative floats and decimals would format
like `-10.0:::FLOAT`. This seems fine, but since the `:::` operator
binds more closely than the `-` operator, an expression like
`(-10.0:::FLOAT)::STRING` would get formatted to
`-10.0:::FLOAT::STRING`, which is of course invalid as there's no unary
negative operator for the string datatype.

Now, floats and decimals are marked as unambiguously formatted datatypes
and take care of disambiguating themselves with a type annotation if
necessary, as well as further-disambiguating parentheses if the numbers
are nuegative.

Release note (bug fix): correct the round-trip formatting of negative
floats and decimals in the context of other expressions when executing
in a distributed flow.

Co-authored-by: Nathan VanBenschoten <[email protected]>
Co-authored-by: Jordan Lewis <[email protected]>
@craig
Copy link
Contributor

craig bot commented Aug 1, 2018

Build succeeded

@craig craig bot merged commit 22cbf6b into cockroachdb:master Aug 1, 2018
@jordanlewis jordanlewis deleted the disambig-float-dec branch August 1, 2018 18: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