1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Semantic type classification for connector data types across SQL dialects.
//!
//! Rather than forcing every database connector to map its proprietary data type
//! spellings into an exhaustive enum (which frequently breaks on minor type widenings
//! or dialect aliases), SAYA uses semantic type classifiers.
/// Classifies whether a connector's raw data type string represents a temporal
/// value (date, time, timestamp, or datetime).
///
/// We classify types by semantic substring matching rather than exact type enum
/// matching because database dialects express temporal representations with
/// varied spellings, precision parameters, and timezone suffixes (e.g. Postgres
/// `timestamp with time zone` and `timestamptz`, MySQL `datetime`, Snowflake
/// `TIMESTAMP_NTZ`/`LTZ`/`TZ`, DuckDB `time`). Substring matching also allows
/// harmless schema evolution (such as widening `TIMESTAMP` to `TIMESTAMPTZ`)
/// without falsely invalidating user-taught temporal knowledge like default time.
/// Classifies whether a connector's raw data type string represents a numeric
/// value (integers, floating point, decimals, serials, and numbers).
///
/// We classify types by semantic substring matching because database engines
/// use dialect-specific naming and parameterized widths (e.g. Postgres
/// `bigserial` / `double precision`, MySQL `int(11)` / `decimal(10,2)`,
/// Snowflake `NUMBER(38,0)`, DuckDB `HUGEINT`, SQLite `real`). Facts with
/// numeric requirements (such as measure roles) remain valid when schemas evolve
/// across numeric precision widenings (e.g. `int` to `bigint`).