materialize icon indicating copy to clipboard operation
materialize copied to clipboard

test/sqllogictest/dates-times.slt fails

Open nrainer-materialize opened this issue 1 year ago • 9 comments

What version of Materialize are you using?

2ddde540c480e5f3da569a9f7d9d1f9960efd2ae

What is the issue?

date-times.slt fails (https://buildkite.com/materialize/sql-logic-tests/builds/5834#018dacbf-c5fd-4e37-8d81-ce099751d34c).

_bk;t=1708000738923    SELECT '"?!?2024-02-13 17:01:58.37848 ?+  00  + '::timestamp with time zone;
_bk;t=1708000738939    InconsistentViewOutcome:test/sqllogictest/dates-times.slt:1305
_bk;t=1708000738939            expected from query: Success
_bk;t=1708000738939            actually from indexed view: PlanFailure { error: db error: ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
_bk;t=1708000738939    
_bk;t=1708000738939    Caused by:
_bk;t=1708000738939        ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
_bk;t=1708000738939    
_bk;t=1708000738939    Stack backtrace:
_bk;t=1708000738939       0: <mz_sqllogictest::runner::RunnerInner>::execute_query::{closure#0}
_bk;t=1708000738939       1: <mz_sqllogictest::runner::RunnerInner>::execute_view::{closure#0}
_bk;t=1708000738939       2: <mz_sqllogictest::runner::RunnerInner>::run_record::{closure#0}
_bk;t=1708000738939       3: <mz_sqllogictest::runner::Runner>::run_record::{closure#0}
_bk;t=1708000738939       4: sqllogictest::main::{closure#0}
_bk;t=1708000738939       5: <tracing::instrument::Instrumented<sqllogictest::main::{closure#0}> as core::future::future::Future>::poll
_bk;t=1708000738939       6: <tokio::runtime::context::blocking::BlockingRegionGuard>::block_on::<tracing::instrument::Instrumented<sqllogictest::main::{closure#0}>>
_bk;t=1708000738939       7: sqllogictest::main
_bk;t=1708000738939       8: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn() -> std::process::ExitCode, std::process::ExitCode>
_bk;t=1708000738939       9: std::rt::lang_start::<std::process::ExitCode>::{closure#0}
_bk;t=1708000738939      10: std::rt::lang_start_internal
_bk;t=1708000738939      11: main
_bk;t=1708000738939      12: <unknown>
_bk;t=1708000738939      13: __libc_start_main
_bk;t=1708000738939      14: <unknown>, location: Location { file: "test/sqllogictest/dates-times.slt", line: 1305 } }
_bk;t=1708000738939            
_bk;t=1708000738939    ----
_bk;t=1708000739834    SELECT '"?!?2024-02-13 17:01:58.37848 ?+  00  + '::timestamp with time zone;
_bk;t=1708000739834    InconsistentViewOutcome:test/sqllogictest/dates-times.slt:1309
_bk;t=1708000739834            expected from query: Success
_bk;t=1708000739834            actually from indexed view: PlanFailure { error: db error: ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
_bk;t=1708000739834    
_bk;t=1708000739834    Caused by:
_bk;t=1708000739834        ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
_bk;t=1708000739834    
_bk;t=1708000739834    Stack backtrace:
_bk;t=1708000739834       0: <mz_sqllogictest::runner::RunnerInner>::execute_query::{closure#0}
_bk;t=1708000739834       1: <mz_sqllogictest::runner::RunnerInner>::execute_view::{closure#0}
_bk;t=1708000739834       2: <mz_sqllogictest::runner::RunnerInner>::run_record::{closure#0}
_bk;t=1708000739834       3: <mz_sqllogictest::runner::Runner>::run_record::{closure#0}
_bk;t=1708000739834       4: sqllogictest::main::{closure#0}
_bk;t=1708000739834       5: <tracing::instrument::Instrumented<sqllogictest::main::{closure#0}> as core::future::future::Future>::poll
_bk;t=1708000739834       6: <tokio::runtime::context::blocking::BlockingRegionGuard>::block_on::<tracing::instrument::Instrumented<sqllogictest::main::{closure#0}>>
_bk;t=1708000739834       7: sqllogictest::main
_bk;t=1708000739834       8: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn() -> std::process::ExitCode, std::process::ExitCode>
_bk;t=1708000739834       9: std::rt::lang_start::<std::process::ExitCode>::{closure#0}
_bk;t=1708000739834      10: std::rt::lang_start_internal
_bk;t=1708000739834      11: main
_bk;t=1708000739834      12: <unknown>
_bk;t=1708000739834      13: __libc_start_main
_bk;t=1708000739834      14: <unknown>, location: Location { file: "test/sqllogictest/dates-times.slt", line: 1309 } }
_bk;t=1708000739834            
_bk;t=1708000739834    ----
_bk;t=1708000740748    SELECT '"?!?2024-02-13 17:01:58.37848+  0 0'::timestamp with time zone;
_bk;t=1708000740748    InconsistentViewOutcome:test/sqllogictest/dates-times.slt:1313
_bk;t=1708000740748            expected from query: Success
_bk;t=1708000740748            actually from indexed view: PlanFailure { error: db error: ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: Cannot parse timezone offset +  0 0: "\"?!?2024-02-13 17:01:58.37848+  0 0"
_bk;t=1708000740748    
_bk;t=1708000740748    Caused by:
_bk;t=1708000740748        ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: Cannot parse timezone offset +  0 0: "\"?!?2024-02-13 17:01:58.37848+  0 0"
_bk;t=1708000740748    
_bk;t=1708000740748    Stack backtrace:
_bk;t=1708000740748       0: <mz_sqllogictest::runner::RunnerInner>::execute_query::{closure#0}
_bk;t=1708000740748       1: <mz_sqllogictest::runner::RunnerInner>::execute_view::{closure#0}
_bk;t=1708000740748       2: <mz_sqllogictest::runner::RunnerInner>::run_record::{closure#0}
_bk;t=1708000740748       3: <mz_sqllogictest::runner::Runner>::run_record::{closure#0}
_bk;t=1708000740748       4: sqllogictest::main::{closure#0}
_bk;t=1708000740748       5: <tracing::instrument::Instrumented<sqllogictest::main::{closure#0}> as core::future::future::Future>::poll
_bk;t=1708000740748       6: <tokio::runtime::context::blocking::BlockingRegionGuard>::block_on::<tracing::instrument::Instrumented<sqllogictest::main::{closure#0}>>
_bk;t=1708000740748       7: sqllogictest::main
_bk;t=1708000740748       8: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn() -> std::process::ExitCode, std::process::ExitCode>
_bk;t=1708000740748       9: std::rt::lang_start::<std::process::ExitCode>::{closure#0}
_bk;t=1708000740748      10: std::rt::lang_start_internal
_bk;t=1708000740748      11: main
_bk;t=1708000740748      12: <unknown>
_bk;t=1708000740748      13: __libc_start_main
_bk;t=1708000740748      14: <unknown>, location: Location { file: "test/sqllogictest/dates-times.slt", line: 1313 } }
_bk;t=1708000740748            
_bk;t=1708000740748    ----
_bk;t=1708000741667    SELECT '"?!?2024-02-13 17:01:58.37848+ ? 00'::timestamp with time zone;
_bk;t=1708000741667    InconsistentViewOutcome:test/sqllogictest/dates-times.slt:1317
_bk;t=1708000741667            expected from query: Success
_bk;t=1708000741667            actually from indexed view: PlanFailure { error: db error: ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: Cannot parse timezone offset + ? 00: "\"?!?2024-02-13 17:01:58.37848+ ? 00"
_bk;t=1708000741667    
_bk;t=1708000741667    Caused by:
_bk;t=1708000741667        ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: Cannot parse timezone offset + ? 00: "\"?!?2024-02-13 17:01:58.37848+ ? 00"
_bk;t=1708000741667    
_bk;t=1708000741667    Stack backtrace:
_bk;t=1708000741667       0: <mz_sqllogictest::runner::RunnerInner>::execute_query::{closure#0}
_bk;t=1708000741667       1: <mz_sqllogictest::runner::RunnerInner>::execute_view::{closure#0}
_bk;t=1708000741667       2: <mz_sqllogictest::runner::RunnerInner>::run_record::{closure#0}
_bk;t=1708000741667       3: <mz_sqllogictest::runner::Runner>::run_record::{closure#0}
_bk;t=1708000741667       4: sqllogictest::main::{closure#0}
_bk;t=1708000741667       5: <tracing::instrument::Instrumented<sqllogictest::main::{closure#0}> as core::future::future::Future>::poll
_bk;t=1708000741667       6: <tokio::runtime::context::blocking::BlockingRegionGuard>::block_on::<tracing::instrument::Instrumented<sqllogictest::main::{closure#0}>>
_bk;t=1708000741667       7: sqllogictest::main
_bk;t=1708000741667       8: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn() -> std::process::ExitCode, std::process::ExitCode>
_bk;t=1708000741667       9: std::rt::lang_start::<std::process::ExitCode>::{closure#0}
_bk;t=1708000741667      10: std::rt::lang_start_internal
_bk;t=1708000741667      11: main
_bk;t=1708000741667      12: <unknown>
_bk;t=1708000741667      13: __libc_start_main
_bk;t=1708000741667      14: <unknown>, location: Location { file: "test/sqllogictest/dates-times.slt", line: 1317 } }

nrainer-materialize avatar Feb 15 '24 17:02 nrainer-materialize

@jkosh44, I haven't bisected it (yet), but could this be caused by changes in https://github.com/MaterializeInc/materialize/pull/25202?

nrainer-materialize avatar Feb 15 '24 17:02 nrainer-materialize

@jkosh44, I haven't bisected it (yet), but could this be caused by changes in #25202?

I think that's unlikely. The linked PR affects interval parsing, while this panic looks like it's due to timestamp with timezone parsing. I think it might be related to https://github.com/MaterializeInc/materialize/pull/25216.

jkosh44 avatar Feb 15 '24 17:02 jkosh44

Hmm, I'm actually a little confused about what the error actually means.

 SELECT '"?!?2024-02-13 17:01:58.37848 ?+  00  + '::timestamp with time zone;
�_bk;t=1708000738939�    InconsistentViewOutcome:test/sqllogictest/dates-times.slt:1305
�_bk;t=1708000738939�            expected from query: Success
�_bk;t=1708000738939�            actually from indexed view: PlanFailure { error: db error: ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
�_bk;t=1708000738939�    
�_bk;t=1708000738939�    Caused by:
�_bk;t=1708000738939�        ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
�_bk;t=1708000738939�    

That test looks like

# + is prohibited after numerals
query error db error: ERROR: invalid input syntax for type timestamp with time zone: have unprocessed tokens \+  0: "\\"\?!\?2024\-02\-13 17:01:58\.37848 \?\+  00  \+ "
SELECT '"?!?2024-02-13 17:01:58.37848 ?+  00  + '::timestamp with time zone;

So it's expected to fail. I'm not sure why the error says expected from query: Success. I'm also not sure what InconsistentViewOutcome means.

jkosh44 avatar Feb 15 '24 18:02 jkosh44

I'm also confused about the relationship between the first code block pasted in the issue, with test/sqllogictest/explain/broken_statements.slt, and the second code block with test/sqllogictest/dates-times.slt. How are they related?

jkosh44 avatar Feb 15 '24 18:02 jkosh44

This failure seems spurious:

materialize=> create view abc as SELECT '"?!?2024-02-13 17:01:58.37848 ?+  00  + '::timestamp with time zone;
CREATE VIEW
materialize=> select * from abc;
ERROR:  invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
materialize=> SELECT '"?!?2024-02-13 17:01:58.37848 ?+  00  + '::timestamp with time zone;
ERROR:  invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "

I don't have time to dig into this much before the release today nor do I think it's a release blocker.

sploiselle avatar Feb 15 '24 19:02 sploiselle

There is apparently a panic in test/sqllogictest/explain/broken_statements.slt and a comparison failure intest/sqllogictest/dates-times.slt.

I managed to bisect failing test/sqllogictest/explain/broken_statements.slt to the merge commit https://github.com/MaterializeInc/materialize/commit/f6082b7ebba55115cd7647220d8980f8437437b3 of https://github.com/MaterializeInc/materialize/pull/25216.

I have not been able to repro test/sqllogictest/dates-times.slt in isolation so far. I will trigger a full build on the merge commit in CI and dig deeper tomorrow.

I don't have time to dig into this much before the release today nor do I think it's a release blocker.

Ack!

nrainer-materialize avatar Feb 15 '24 20:02 nrainer-materialize

test/sqllogictest/dates-times.slt also fails since https://github.com/MaterializeInc/materialize/commit/f6082b7ebba55115cd7647220d8980f8437437b3 but might not fail in isolation (build before, build at merge commit).

To run the tests like in the failing build step:

export BUILDKITE_PARALLEL_JOB="1"
export BUILDKITE_PARALLEL_JOB_COUNT="10"
bin/mzcompose --find sqllogictest down -v && bin/mzcompose --find sqllogictest run sqllogictest

I will disable the failing tests in the mean time.

nrainer-materialize avatar Feb 16 '24 16:02 nrainer-materialize

forced optimizer panic is something that should just be ignored, and is already. The inconsistent-view-outcome is the interesting part.

def- avatar Feb 16 '24 18:02 def-

forced optimizer panic is something that should just be ignored, and is already. The inconsistent-view-outcome is the interesting part.

I changed the PR description accordingly. Only dates-times.slt needs to be addressed.

nrainer-materialize avatar Feb 16 '24 18:02 nrainer-materialize

This issue repros for me 100% of the time when running locally. I went through the SLT code and the error message is very misleading IMO.

�_bk;t=1708000738923� SELECT '"?!?2024-02-13 17:01:58.37848 ?+ 00 + '::timestamp with time zone; �_bk;t=1708000738939� InconsistentViewOutcome:test/sqllogictest/dates-times.slt:1305 �_bk;t=1708000738939� expected from query: Success �_bk;t=1708000738939� actually from indexed view: PlanFailure { error: db error: ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens + 0: ""?!?2024-02-13 17:01:58.37848 ?+ 00 + " �_bk;t=1708000738939�
�_bk;t=1708000738939� Caused by: �_bk;t=1708000738939� ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens + 0: ""?!?2024-02-13 17:01:58.37848 ?+ 00 + " �_bk;t=1708000738939�
�_bk;t=1708000738939� Stack backtrace: �_bk;t=1708000738939� 0: <mz_sqllogictest::runner::RunnerInner>::execute_query::{closure#0} �_bk;t=1708000738939� 1: <mz_sqllogictest::runner::RunnerInner>::execute_view::{closure#0} �_bk;t=1708000738939� 2: <mz_sqllogictest::runner::RunnerInner>::run_record::{closure#0} �_bk;t=1708000738939� 3: <mz_sqllogictest::runner::Runner>::run_record::{closure#0} �_bk;t=1708000738939� 4: sqllogictest::main::{closure#0} �_bk;t=1708000738939� 5: <tracing::instrument::Instrumentedsqllogictest::main::{closure#0} as core::future::future::Future>::poll �_bk;t=1708000738939� 6: tokio::runtime::context::blocking::BlockingRegionGuard::block_on::<tracing::instrument::Instrumentedsqllogictest::main::{closure#0}> �_bk;t=1708000738939� 7: sqllogictest::main �_bk;t=1708000738939� 8: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn() -> std::process::ExitCode, std::process::ExitCode> �_bk;t=1708000738939� 9: std::rt::lang_start::std::process::ExitCode::{closure#0} �_bk;t=1708000738939� 10: std::rt::lang_start_internal �_bk;t=1708000738939� 11: main �_bk;t=1708000738939� 12: �_bk;t=1708000738939� 13: __libc_start_main �_bk;t=1708000738939� 14: , location: Location { file: "test/sqllogictest/dates-times.slt", line: 1305 } } �_bk;t=1708000738939�
�_bk;t=1708000738939� ----

expected from query: Success does NOT mean that executing the raw SELECT query was successful and did not return an error. It means that the result of the SELECT query had the response that we were expecting. In this case the SELECT returned an error that matched the error we were expecting. The error that we're expecting is db error: ERROR: invalid input syntax for type timestamp with time zone: have unprocessed tokens \+ 0: "\\"\?!\?2024\-02\-13 17:01:58\.37848 \?\+ 00 \+ ".

actually from indexed view: PlanFailure { error: db error: ERROR: Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens + 0: "\"?!?2024-02-13 17:01:58.37848 ?+ 00 + " means that the SELECT from the indexed view did not return the error that we were expecting. The issue here is that the the indexed view error also includes Evaluation error: which causes the error regex not to match.

Here's is an example of the differences in error messages when running locally:

materialize=> SELECT '"?!?2024-02-13 17:01:58.37848 ?+  00  + '::timestamp with time zone;
ERROR:  invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
materialize=> CREATE VIEW v AS SELECT '"?!?2024-02-13 17:01:58.37848 ?+  00  + '::timestamp with time zone;
CREATE VIEW
materialize=> SELECT * FROM v;
ERROR:  invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "
materialize=> CREATE DEFAULT INDEX on v;
CREATE INDEX
materialize=> SELECT * FROM v;
ERROR:  Evaluation error: invalid input syntax for type timestamp with time zone: have unprocessed tokens +  0: "\"?!?2024-02-13 17:01:58.37848 ?+  00  + "

The quick fix for this is to remove the db error: Error: from the expected error. I can push a quick PR for this. However, IMO there are two additional followups we should make:

  1. Improve the error messages to not be misleading.
  2. Make sure the error messages of indexed views and raw SELECTs match.

jkosh44 avatar Feb 20 '24 16:02 jkosh44

the error message is very misleading IMO.

https://github.com/MaterializeInc/materialize/issues/25394

jkosh44 avatar Feb 20 '24 17:02 jkosh44