MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_explain_timestamp_table

Function test_explain_timestamp_table

src/environmentd/tests/sql.rs:1265–1299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1263#[mz_ore::test]
1264#[allow(clippy::disallowed_methods)]
1265fn test_explain_timestamp_table() {
1266 let server = test_util::TestHarness::default().start_blocking();
1267 let mut client = server.connect(postgres::NoTls).unwrap();
1268 let timestamp_re = Regex::new(r"\s*(\d+) \(\d+-\d\d-\d\d \d\d:\d\d:\d\d.\d\d\d\)").unwrap();
1269
1270 client.batch_execute("CREATE TABLE t1 (i1 int)").unwrap();
1271
1272 let expect = " query timestamp:<TIMESTAMP>
1273 oracle read timestamp:<TIMESTAMP>
1274largest not in advance of upper:<TIMESTAMP>
1275 upper:[<TIMESTAMP>]
1276 since:[<TIMESTAMP>]
1277 can respond immediately: true
1278 timeline: Some(EpochMilliseconds)
1279 session wall time:<TIMESTAMP>
1280
1281source materialize.public.t1 (u1, storage):
1282 read frontier:[<TIMESTAMP>]
1283 write frontier:[<TIMESTAMP>]
1284
1285binding constraints:
1286lower:
1287 (Isolation level: StrictSerializable): [<TIMESTAMP>]\n";
1288
1289 let row = client
1290 .query_one("EXPLAIN TIMESTAMP FOR SELECT * FROM t1;", &[])
1291 .unwrap();
1292 let explain: String = row.get(0);
1293 let explain = timestamp_re.replace_all(&explain, "<TIMESTAMP>");
1294 // The storage inputs constraint appears non-deterministically depending on
1295 // whether the storage frontier has advanced before the query runs.
1296 let storage_inputs_re = Regex::new(r" \(Storage inputs: \[.*\]\): \[<TIMESTAMP>\]\n").unwrap();
1297 let explain = storage_inputs_re.replace_all(&explain, "");
1298 assert_eq!(explain, expect, "{explain}\n\n{expect}");
1299}
1300
1301// Test `EXPLAIN TIMESTAMP AS JSON`
1302#[mz_ore::test]

Callers

nothing calls this directly

Calls 6

start_blockingMethod · 0.80
unwrapMethod · 0.80
batch_executeMethod · 0.80
connectMethod · 0.45
query_oneMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected