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: vectorized engine incorrectly formats interval output #83094

Closed
rytaft opened this issue Jun 20, 2022 · 0 comments · Fixed by #83944
Closed

sql: vectorized engine incorrectly formats interval output #83094

rytaft opened this issue Jun 20, 2022 · 0 comments · Fixed by #83944
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team

Comments

@rytaft
Copy link
Collaborator

rytaft commented Jun 20, 2022

Consider the following difference between the vectorized engine and the row engine:

[email protected]:26257/defaultdb> CREATE TABLE t (t1 timestamptz, t2 timestamptz);
CREATE TABLE


Time: 5ms total (execution 5ms / network 0ms)

[email protected]:26257/defaultdb> INSERT INTO t VALUES ('2032-08-15 21:25:37.000993+00:00', '2010-10-07 06:38:15.000078+00:00');
INSERT 0 1


Time: 6ms total (execution 6ms / network 0ms)

[email protected]:26257/defaultdb> SELECT (t1 - t2) FROM t;
       ?column?
-----------------------
  191606:47:22.000915
(1 row)


Time: 4ms total (execution 3ms / network 1ms)

[email protected]:26257/defaultdb> SET vectorize = off;
SET


Time: 0ms total (execution 0ms / network 0ms)

[email protected]:26257/defaultdb> SELECT (t1 - t2) FROM t;
          ?column?
-----------------------------
  7983 days 14:47:22.000915
(1 row)

The result with vectorize=off is what is also returned by Postgres.

Jira issue: CRDB-16860

@rytaft rytaft added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Jun 20, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Jun 20, 2022
yuzefovich added a commit to yuzefovich/cockroach that referenced this issue Jul 7, 2022
This commit adds the native cast from strings to ints, floats, and
timestamps. I was inspired to do this because the combination of this
commit and the vectorized rendering on top of the wrapped row-by-row
processors would expose some bugs (e.g. cockroachdb#83094).

Release note: None
@craig craig bot closed this as completed in 1abab4c Jul 7, 2022
yuzefovich added a commit to yuzefovich/cockroach that referenced this issue Jul 8, 2022
This commit adds the native casts from strings to all remaining
natively-supported types (dates, decimals, floats, ints, intervals,
timestamps, jsons).

I was inspired to do this because the combination of this
commit and the vectorized rendering on top of the wrapped row-by-row
processors would expose some bugs (e.g. cockroachdb#83094).

Release note: None
craig bot pushed a commit that referenced this issue Jul 11, 2022
83719: storage: remove dependency to sql/catalog/bootstrap r=Xiang-Gu a=Xiang-Gu

Previously, tests in `pkg/storage` depended on `sql/catalog/bootstrap`.
This was inadequate/weird because `storage` is a much lower layer in the
architectural stack. It will also help prevent dependency cycles in
other PRs when we introduce depencies (see #82172 if interested).

Release note: None

83958: colexecbase: add all remaining casts from strings r=yuzefovich a=yuzefovich

**tree: minor cleanup**

This commit does a few minor things:
- actually uses the error in a few places when constructing a ParseError
- refactors some of the interval-parsing functions to expose them to be
used in the follow-up commit
- extracts a helper method to construct an error when timestamp exceeds
bounds.

Release note: None

**colexecbase: sort native cast info lexicographically**

This commit sorts the information about natively supported casts
lexicographically so that it is easier to see what is actually
supported. This is simply a mechanical change.

Release note: None

**colexecbase: add all remaining casts from strings**

This commit adds the native casts from strings to all remaining
natively-supported types (dates, decimals, floats, ints, intervals,
timestamps, jsons).

I was inspired to do this because the combination of this
commit and the vectorized rendering on top of the wrapped row-by-row
processors would expose some bugs (e.g. #83094).

Addresses: #48135.

Release note: None

83984: storageccl: use NewPebbleIterator in restore data processor r=erikgrinaker a=msbutler

This PR replaces the multiIterator used in the restore data processor with the
PebbleSSTIterator, which has baked in range key support.

This patch is apart of a larger effort to teach backup and restore about MVCC
bulk operations. Next, the readAsOfIterator will need to learn how to
deal with range keys.

Informs #71155

Release note: none

84049: sql: fix memory accounting of prepared statements and portals in error cases r=yuzefovich a=yuzefovich

**sql: make sure to close mem acc of prepared stmt in case of an error**

Previously, it was possible that we would not close the memory account
created for a prepared statement when an error is encountered. This was
the case because we would not include the prepared stmt into the prep
stmts namespace, so it would just get lost. However, up until recently
this was not an issue since we mistakenly cleared that memory account
when creating the prepared statement.

Release note: None

**sql: only increment ref count of prep stmt in non-error case of portals**

Previously, it was possible to "leak" a reference to a prepared
statement if we made a portal from it (i.e. took a reference to the
prepared statement) and the memory reservation was denied. This could
lead to "leftover bytes" errors when stopping the "session" monitors.
However, the impact is minor because on release builds we'd still return
those "leftover bytes" and would just file a sentry issue. This is now
fixed.

Fixes: #83935

Release note: None

84097: DOC-4899: Remove linking on subdirectory from show_backup diagram r=RichardJCai a=nickvigilante

Release note: None

84143: Revert "kvstreamer: reuse incomplete Get requests on resume batches" r=yuzefovich a=yuzefovich

This reverts commit 21f2390.

Previously, I didn't realize that the KV layer would modify all requests
included into the BatchRequest in `txnSeqNumAllocator`, so we cannot
reuse even incomplete GetRequests. It is unfortunate, but not a big
deal.

Fixes: #83974.

Release note: None

84169: opt: fix incorrect column indexing in index recommendations r=mgartner a=mgartner

#### opt: fix incorrect column indexing in index recommendations

Fixes #83965

Release note (bug fix): A minor bug has been fixed that caused internal
errors and poor index recommendations when running `EXPLAIN` statements.

#### opt: clarify logic in Metadata.UpdateTableMeta

Release note: None


84188: roachtest: update supported tag for gorm r=ZhouXing19 a=ZhouXing19

fixes #83794
fixes #83797
fixes #83885

Release note: None

Co-authored-by: Xiang Gu <[email protected]>
Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Michael Butler <[email protected]>
Co-authored-by: Nick Vigilante <[email protected]>
Co-authored-by: Marcus Gartner <[email protected]>
Co-authored-by: Jane Xing <[email protected]>
@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants