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

Class String

misc/python/materialize/checks/all_checks/string.py:15–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15class String(Check):
16 def initialize(self) -> Testdrive:
17 return Testdrive(dedent("""
18 > CREATE TABLE string_table (f1 STRING, f2 STRING, f3 STRING, f4 INT, f5 INT, f6 INT[]);
19 > INSERT INTO string_table VALUES (' foobar ', ' abc ', ' xyz ', 2, 3, '{1,NULL,3}');
20 """))
21
22 def manipulate(self) -> list[Testdrive]:
23 return [
24 Testdrive(dedent(s))
25 for s in [
26 """
27 > CREATE MATERIALIZED VIEW string_view1 AS SELECT
28 f1 BETWEEN f2 AND f3 AS c1,
29 'foo' BETWEEN 'abc' AND 'xyz' AS c2,
30 f1 NOT BETWEEN f2 AND f3 AS c3,
31 substring(f1 FROM f4 FOR f5) AS c4,
32 substring(f1 FROM f4) AS c5,
33 substring(f1 FOR f5) AS c6,
34 trim(BOTH f1) AS c7,
35 trim(LEADING f1) AS c8,
36 trim(TRAILING f1) AS c9,
37 trim(LEADING ' f' FROM f1) AS c10,
38 trim(' fr' FROM f1) AS c11,
39 array_to_string(f6, ',', 'NULL') AS c12
40 FROM string_table;
41 > INSERT INTO string_table VALUES (' foo ', ' abc ', ' xyz ', 2, 3, '{1,2,3,4,NULL,NULL}');
42 """,
43 """
44 > CREATE MATERIALIZED VIEW string_view2 AS SELECT
45 f1 BETWEEN f2 AND f3 AS c1,
46 'foo' BETWEEN 'abc' AND 'xyz' AS c2,
47 f1 NOT BETWEEN f2 AND f3 AS c3,
48 substring(f1 FROM f4 FOR f5) AS c4,
49 substring(f1 FROM f4) AS c5,
50 substring(f1 FOR f5) AS c6,
51 trim(BOTH f1) AS c7,
52 trim(LEADING f1) AS c8,
53 trim(TRAILING f1) AS c9,
54 trim(LEADING ' f' FROM f1) AS c10,
55 trim(' fr' FROM f1) AS c11,
56 array_to_string(f6, ',', 'NULL') AS c12
57 FROM string_table;
58 > INSERT INTO string_table VALUES (' bar ', 'abc', 'xyz', 2, 3, '{NULL}');
59 """,
60 ]
61 ]
62
63 def validate(self) -> Testdrive:
64 return Testdrive(dedent("""
65 > SELECT * FROM string_view1;
66 true true false foo "foobar " " fo" "foobar" "foobar " " foobar" "oobar " "ooba" 1,NULL,3
67 true true false foo "foo " " fo" foo "foo " " foo" "oo " oo 1,2,3,4,NULL,NULL
68 false true true bar "bar " " ba" bar "bar " " bar" "bar " ba NULL
69
70 > SELECT * FROM string_view2;
71 true true false foo "foobar " " fo" "foobar" "foobar " " foobar" "oobar " "ooba" 1,NULL,3
72 true true false foo "foo " " fo" foo "foo " " foo" "oo " oo 1,2,3,4,NULL,NULL

Callers 15

printConcurrencySummaryFunction · 0.85
setItemFunction · 0.85
nullsLastFunction · 0.85
FreshnessFilterPanelFunction · 0.85
WindowControlFunction · 0.85
multiSelectChipsFunction · 0.85
buildPrivilegeTableQueryFunction · 0.85

Calls

no outgoing calls