Comprehensive, granular implementation roadmap to achieve 100% pass rate on all GoogleSQL compliance/conformance test cases (excluding differential privacy) in tinylamb.
Never write quick-and-dirty hacks, special-case string matchers, or isolated shortcuts just to pass a test case. Every operator, expression, type, function, and query shape must be implemented cleanly according to the formal GoogleSQL specification and standard relational algebra. The implementation must be robust and general enough to support future Cascades query optimization, vectorized/morsel execution, LLVM JIT code generation, and distributed query execution.
All additions must respect the 12-layer DAG documented in
ARCHITECTURE.mdand mechanically enforced bypython3 scripts/check_layering.py. Never introduce upward dependency violations.When introducing scalar functions or operators:
- AST (
Expression::Evaluate/EvaluateBinary) is the semantic reference (Ground Truth).- Bytecode VM (
BytecodeProgram) must be updated for batch execution.- Differential tests (
expression/differential_test.cpp) must verify semantic equivalence between AST and Bytecode/JIT.Existing production paths (PostgreSQL wire-protocol server, 22 TPC-H queries, TPC-C transactions, MVCC recovery) must remain 100% green at all times.
- Fix
#comment line skipping in.testfile parser (query/googlesql_compliance_file.cpp) - Fix multi-line / duplicate
[name=...]and trailing metadata inclusion into SQL query text - Parse
[required_features]and[required_feature]tags robustly - Parse
[prepare_database]sections as multi-statement setup sequences - Support
[unknown_order]result comparison with unordered multiset matching - Support floating-point comparison with epsilon tolerance (NaN, Infinity, precision diffs)
- Support STRUCT tokenization and recursive structural equality in
ComplianceValueMatches - Support ARRAY tokenization and element-by-element equality in
ComplianceValueMatches - Support NULL token matching (
NULL,null) - Support string literal unquoting and escape sequences in compliance output matcher
- Support expected error substring matching for negative test cases (
ERROR: ...) - Add automated script
scripts/compliance_summary.pyto report per-file and per-case pass rates
-
IS TRUEoperator in AST visitor and scalar engine -
IS NOT TRUEoperator -
IS FALSEoperator -
IS NOT FALSEoperator -
IS NULLoperator -
IS NOT NULLoperator -
IS UNKNOWNoperator -
IS NOT UNKNOWNoperator - Three-valued boolean logic for
AND/ORwith NULL operands - Strict NULL propagation in
NOT(handlingNOT NULLevaluating to NULL vs literal NULL argument rejection)
-
BETWEEN ... AND ...operator -
NOT BETWEEN ... AND ...operator -
LIKEpattern matching with%and_wildcards -
NOT LIKEpattern matching -
LIKE ANY (...)andLIKE ALL (...)quantification -
IN (val1, val2, ...)with static constant lists -
NOT IN (val1, val2, ...)with static constant lists -
DISTINCT FROM/IS NOT DISTINCT FROM(NULL-safe equality)
-
IF(condition, true_expr, false_expr)function -
COALESCE(expr1, expr2, ...)function (short-circuiting first non-null) -
NULLIF(expr1, expr2)function -
IFNULL(expr, default_expr)function - Simple
CASE expr WHEN val THEN ... ELSE ... ENDexpression - Searched
CASE WHEN cond THEN ... ELSE ... ENDexpression
-
CONCAT(s1, s2, ...)function -
SUBSTR(str, pos[, len])/SUBSTRING -
LENGTH(str)/CHAR_LENGTH(str) -
BYTE_LENGTH(str) -
UPPER(str) -
LOWER(str) -
TRIM(str[, chars]) -
LTRIM(str[, chars]) -
RTRIM(str[, chars]) -
STARTS_WITH(str, prefix) -
ENDS_WITH(str, suffix) -
STRPOS(str, substr)/INSTR -
REPLACE(str, from, to) -
REPEAT(str, n) -
REVERSE(str) -
LPAD(str, len[, pad]) -
RPAD(str, len[, pad]) -
SPLIT(str[, delimiter]) -
REGEXP_CONTAINS(str, pattern) -
REGEXP_EXTRACT(str, pattern) -
REGEXP_REPLACE(str, pattern, replacement) -
REGEXP_MATCH(str, pattern) -
REGEXP_INSTR(str, pattern, ...) -
REGEXP_EXTRACT_ALL(str, pattern) -
SOUNDEX(str) -
TRANSLATE(str, from, to) -
FORMAT(fmt, ...) -
JSON_EXTRACT,JSON_QUERY,JSON_VALUE,JSON_EXTRACT_SCALAR,JSON_EXTRACT_ARRAY,JSON_EXTRACT_STRING_ARRAY,TO_JSON_STRING
-
ABS(x) -
SIGN(x) -
ROUND(x[, n]) -
TRUNC(x[, n])/TRUNCATE -
MOD(x, y) -
POW(x, y)/POWER -
SQRT(x) -
CBRT(x) -
CEIL(x)/CEILING -
FLOOR(x) -
GREATEST(x1, x2, ...) -
LEAST(x1, x2, ...) -
LN(x)/ Natural logarithm -
LOG(x[, base]) -
LOG10(x) -
EXP(x) -
ACOS(x),ASIN(x),ATAN(x),ATAN2(y, x) -
COS(x),SIN(x),TAN(x) -
COSH(x),SINH(x),TANH(x) -
IEEE_DIVIDE(x, y) -
SAFE_DIVIDE(x, y),SAFE_ADD,SAFE_SUBTRACT,SAFE_MULTIPLY,SAFE_NEGATE
-
CAST(x AS INT64) -
CAST(x AS DOUBLE)/FLOAT64 -
CAST(x AS STRING) -
CAST(x AS BOOL) -
CAST(x AS DATE) -
CAST(x AS TIMESTAMP) -
SAFE_CAST(x AS TargetType) - Hexadecimal literal conversion:
0x...integers
-
CURRENT_DATE([timezone]) -
CURRENT_TIMESTAMP() -
DATE(year, month, day)constructor -
DATE_ADD(date, INTERVAL n unit) -
DATE_SUB(date, INTERVAL n unit) -
DATE_DIFF(date1, date2, unit) -
DATE_TRUNC(date, unit) -
EXTRACT(part FROM date_or_timestamp)forYEAR,MONTH,DAY,DAYOFWEEK,DAYOFYEAR,QUARTER,HOUR,MINUTE,SECOND -
FORMAT_DATE(format_string, date) -
PARSE_DATE(format_string, date_string)
- Multi-statement execution support in
SqlEnginefor[prepare_database]blocks - Clean isolation and cleanup between compliance test runs
- AST resolution of
CREATE TABLE table_name AS SELECT ... - Infer column names and types from logical plan schema
- Physical table creation in
Databasecatalog - Batch row insertion from plan executor into newly created table
- Transaction commit and catalog sync for CTAS
- Parse explicit column definitions (
column_name TYPE [NOT NULL] [DEFAULT expr]) - Support all scalar column types (
INT64,DOUBLE,STRING,BOOL,DATE,TIMESTAMP) - Support primary key column annotations (
PRIMARY KEY) - Create table metadata in system catalog
- Multi-row bulk
INSERT INTO table VALUES (...), (...), ... -
INSERT INTO table (col1, col2) VALUES (...)with column reordering -
INSERT INTO table SELECT ...(insert from query) -
UPDATE table SET col = expr WHERE condition -
DELETE FROM table WHERE condition - DML
RETURNINGclause support (INSERT/UPDATE/DELETE ... RETURNING col1, col2)
- Introduce
Value::Arrayrepresenting dynamic vector of homogenousValues - Introduce
Value::Structrepresenting ordered tuple of named/unnamedValues - Type serialization/deserialization for
ARRAYandSTRUCT - Nullability and empty array semantics (
[]vsNULL)
- Untyped array literal:
[elem1, elem2, ...] - Typed array literal:
ARRAY<TYPE>[elem1, elem2, ...] - Explicit STRUCT literal:
STRUCT(val1 AS name1, val2 AS name2) - Anonymous struct literal:
(val1, val2, ...)
- Dot-notation struct field accessor:
struct_expr.field_name - Positional struct field accessor:
struct_expr.1 - 0-based array subscript:
array_expr[OFFSET(n)] - 1-based array subscript:
array_expr[ORDINAL(n)] - Safe array offset accessor:
array_expr[SAFE_OFFSET(n)] - Safe array ordinal accessor:
array_expr[SAFE_ORDINAL(n)]
-
ARRAY_CONCAT(arr1, arr2, ...) -
ARRAY_LENGTH(arr) -
ARRAY_TO_STRING(arr, delimiter[, null_text]) -
GENERATE_ARRAY(start, end[, step]) -
GENERATE_DATE_ARRAY(start_date, end_date[, INTERVAL n unit]) -
ARRAY_REVERSE(arr)
- AST translation for
FROM UNNEST(array_expr) [AS alias] -
UnnestPlanrelational plan node inplan/ -
UnnestExecutorphysical iterator inexecutor/ -
WITH OFFSET [AS offset_alias]support inUNNEST - Lateral/Correlated join with
UNNEST:FROM table t, UNNEST(t.array_col) a -
LEFT JOIN UNNEST(...) ON ...outer unnesting semantics
-
ARRAY_AGG(expr [ORDER BY ...] [LIMIT ...])aggregate function -
ARRAY_CONCAT_AGG(arr [ORDER BY ...] [LIMIT ...])aggregate function -
STRING_AGG(str[, delimiter] [ORDER BY ...] [LIMIT ...])aggregate function
-
UNION ALLwith type coercion across multiple branches -
UNION DISTINCTwith duplicate elimination -
INTERSECT DISTINCTrelational operator and executor -
INTERSECT ALLrelational operator and executor -
EXCEPT DISTINCTrelational operator and executor -
EXCEPT ALLrelational operator and executor -
CORRESPONDINGcolumn-name matching for set operations - Parenthesized set operation subtrees:
(SELECT ...) UNION ALL (SELECT ...)
- Multi-statement CTE resolution (
WITH q1 AS (...), q2 AS (...) SELECT ...) - Scalar subquery with local
WITHclause:SELECT (WITH q AS (...) SELECT x FROM q) -
INsubquery with localWITHclause:WHERE x IN (WITH q AS (...) SELECT y FROM q) - Forward reference prevention and shadowing rules in nested CTEs
-
WITH RECURSIVEfixed-point iteration for recursive CTEs
- Multi-column
INsubqueries:WHERE (a, b) IN (SELECT x, y FROM t) -
EXISTSandNOT EXISTSsubqueries with deep correlation - Scalar subqueries returning 0 rows (evaluated to
NULL) - Scalar subqueries returning >1 row (runtime cardinality check error)
-
QUALIFYclause for filtering over windowed expressions -
GROUP BY ALLautomatic grouping column derivation -
GROUPING SETS,ROLLUP, andCUBEmultidimensional aggregation
- Window specification AST node (
PARTITION BY,ORDER BY, frame clauses) -
WindowPlanlogical plan node inplan/ -
WindowExecutorstreaming/partition-buffered physical operator inexecutor/ - Frame specification parser:
ROWS BETWEEN ... AND ... - Frame specification parser:
RANGE BETWEEN ... AND ... - Frame bounds:
UNBOUNDED PRECEDING,n PRECEDING,CURRENT ROW,n FOLLOWING,UNBOUNDED FOLLOWING
-
ROW_NUMBER() OVER (...) -
RANK() OVER (...) -
DENSE_RANK() OVER (...) -
PERCENT_RANK() OVER (...) -
CUME_DIST() OVER (...) -
NTILE(num_buckets) OVER (...)
-
LEAD(expr[, offset[, default_expr]]) OVER (...) -
LAG(expr[, offset[, default_expr]]) OVER (...) -
FIRST_VALUE(expr) OVER (...) -
LAST_VALUE(expr) OVER (...) -
NTH_VALUE(expr, n) OVER (...) -
NULLS FIRST/NULLS LASTordering modifier in window definitions
-
SUM(expr) OVER (...)sliding / expanding frame evaluation -
COUNT(*) OVER (...)andCOUNT(expr) OVER (...) -
AVG(expr) OVER (...) -
MIN(expr) OVER (...) -
MAX(expr) OVER (...)
- Native
Value::Jsonrepresentation -
JSON_VALUE(json_expr, json_path) -
JSON_QUERY(json_expr, json_path) -
JSON_EXTRACT(json_expr, json_path) -
JSON_EXTRACT_SCALAR(json_expr, json_path) -
TO_JSON_STRING(value) -
PARSE_JSON(json_string)
-
NUMERIC(128-bit fixed-point decimal, 38 digits precision, 9 scale) -
BIGNUMERIC(256-bit fixed-point decimal, 76 digits precision, 38 scale) -
BYTESliteral support:b"..."andB'...' - Binary encoding/decoding:
TO_HEX,FROM_HEX,TO_BASE64,FROM_BASE64 - Hash functions:
MD5,SHA1,SHA256,SHA512,FARM_FINGERPRINT
-
TIMESTAMP WITH TIME ZONEsupport -
TIME(time of day without date) -
DATETIME(civil date and time) -
STRING(timestamp, timezone)formatting -
TIMESTAMP(date_or_string, timezone)parsing
- Table-Valued Function (TVF) invocation syntax
- Time-window TVFs:
TUMBLE(...),HOP(...) - PIVOT / UNPIVOT relational operators
- Pipe syntax operators (
|> WHERE ... |> AGGREGATE ...)
- Baseline Measurement: Run
./build/googlesql_compliance_testto capture existing failures. - Feature Implementation:
- Implement functionality in the lowest appropriate architectural layer (
type/,expression/,executor/,plan/,query/). - Run
python3 scripts/check_layering.pyto confirm 0 architectural layering violations. - Add differential test cases in
expression/differential_test.cppto verify AST ↔ Bytecode ↔ JIT equivalence.
- Implement functionality in the lowest appropriate architectural layer (
- Validation & Checkoff:
- Run the corresponding
.testfiles ingooglesql_compliance_testto verify 100% test pass. - Run regression tests (
ctest --test-dir build --output-on-failure). - Check off the completed feature item (
[x]) in this roadmap.
- Run the corresponding