From 49d20674721249eb823e7e38c31c8d73d036038e Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Tue, 5 Dec 2023 11:26:49 +0800 Subject: [PATCH] Update keywords (#15443) (#15593) --- keywords.md | 76 ++++++++++++++++++++++++--------------- scripts/check-keywords.sh | 30 +++++++++++----- 2 files changed, 69 insertions(+), 37 deletions(-) diff --git a/keywords.md b/keywords.md index 7d0097576f0a2..0e38131f6d745 100644 --- a/keywords.md +++ b/keywords.md @@ -66,7 +66,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - ACCOUNT - ACTION - ADD (R) -- ADMIN (R) +- ADMIN - ADVISE - AFTER - AGAINST @@ -96,6 +96,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - BACKEND - BACKUP - BACKUPS +- BATCH +- BDR - BEGIN - BERNOULLI - BETWEEN (R) @@ -112,8 +114,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - BOOLEAN - BOTH (R) - BTREE -- BUCKETS (R) -- BUILTINS (R) +- BUCKETS +- BUILTINS - BY (R) - BYTE @@ -122,8 +124,9 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - CACHE - CALIBRATE - CALL (R) -- CANCEL (R) +- CANCEL - CAPTURE +- CARDINALITY - CASCADE (R) - CASCADED - CASE (R) @@ -143,12 +146,13 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - CLOSE - CLUSTER - CLUSTERED -- CMSKETCH (R) +- CMSKETCH - COALESCE - COLLATE (R) - COLLATION - COLUMN (R) - COLUMN_FORMAT +- COLUMN_STATS_USAGE - COLUMNS - COMMENT - COMMIT @@ -165,6 +169,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - CONTEXT - CONTINUE (R) - CONVERT (R) +- CORRELATION - CPU - CREATE (R) - CROSS (R) @@ -197,7 +202,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - DAY_MICROSECOND (R) - DAY_MINUTE (R) - DAY_SECOND (R) -- DDL (R) +- DDL - DEALLOCATE - DECIMAL (R) - DECLARE @@ -207,7 +212,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - DELAYED (R) - DELETE (R) - DENSE_RANK (R-Window) -- DEPTH (R) +- DEPENDENCY +- DEPTH - DESC (R) - DESCRIBE (R) - DIGEST @@ -221,8 +227,9 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - DIV (R) - DO - DOUBLE (R) -- DRAINER (R) +- DRAINER - DROP (R) +- DRY - DUAL (R) - DUPLICATE - DYNAMIC @@ -302,6 +309,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - HELP - HIGH_PRIORITY (R) - HISTOGRAM +- HISTOGRAMS_IN_FLIGHT - HISTORY - HOSTS - HOUR @@ -350,8 +358,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with J -- JOB (R) -- JOBS (R) +- JOB +- JOBS - JOIN (R) - JSON @@ -384,6 +392,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - LIST - LOAD (R) - LOCAL +- LOCAL_ONLY - LOCALTIME (R) - LOCALTIMESTAMP (R) - LOCATION @@ -439,8 +448,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - NOCACHE - NOCYCLE - NODEGROUP -- NODE_ID (R) -- NODE_STATE (R) +- NODE_ID +- NODE_STATE - NOMAXVALUE - NOMINVALUE - NONCLUSTERED @@ -468,7 +477,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - ONLINE - ONLY - OPEN -- OPTIMISTIC (R) +- OPTIMISTIC - OPTIMIZE (R) - OPTION (R) - OPTIONAL @@ -496,7 +505,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - PERCENT_RANK (R-Window) - PER_DB - PER_TABLE -- PESSIMISTIC (R) +- PESSIMISTIC - PLACEMENT (S) - PLUGINS - POINT @@ -514,7 +523,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - PROFILE - PROFILES - PROXY -- PUMP (R) +- PUMP - PURGE Q @@ -537,8 +546,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - REDUNDANT - REFERENCES (R) - REGEXP (R) -- REGION (R) -- REGIONS (R) +- REGION +- REGIONS - RELEASE (R) - RELOAD - REMOVE @@ -553,6 +562,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - REPLICATION - REQUIRE (R) - REQUIRED +- RESET - RESOURCE - RESPECT - RESTART @@ -575,14 +585,17 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - ROW_NUMBER (R-Window) - ROWS (R-Window) - RTREE +- RUN S -- SAMPLES (R) +- SAMPLERATE +- SAMPLES - SAN - SAVEPOINT - SECOND - SECOND_MICROSECOND (R) +- SECONDARY - SECONDARY_ENGINE - SECONDARY_LOAD - SECONDARY_UNLOAD @@ -594,6 +607,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - SERIAL - SERIALIZABLE - SESSION +- SESSION_STATES - SET (R) - SETVAL - SHARD_ROW_ID_BITS @@ -612,7 +626,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - SOME - SOURCE - SPATIAL (R) -- SPLIT (R) +- SPLIT - SQL (R) - SQL_BIG_RESULT (R) - SQL_BUFFER_RESULT @@ -634,19 +648,22 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - SSL (R) - START - STARTING (R) -- STATS (R) +- STATISTICS +- STATS - STATS_AUTO_RECALC -- STATS_BUCKETS (R) +- STATS_BUCKETS - STATS_COL_CHOICE - STATS_COL_LIST - STATS_EXTENDED (R) -- STATS_HEALTHY (R) -- STATS_HISTOGRAMS (R) -- STATS_META (R) +- STATS_HEALTHY +- STATS_HISTOGRAMS +- STATS_LOCKED +- STATS_META - STATS_OPTIONS - STATS_PERSISTENT - STATS_SAMPLE_PAGES - STATS_SAMPLE_RATE +- STATS_TOPN - STATUS - STORAGE - STORED (R) @@ -668,15 +685,17 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - TABLESAMPLE (R) - TABLESPACE - TABLE_CHECKSUM +- TELEMETRY +- TELEMETRY_ID - TEMPORARY - TEMPTABLE - TERMINATED (R) - TEXT - THAN - THEN (R) -- TIDB (R) +- TIDB - TiDB_CURRENT_TSO (R) -- TIFLASH (R) +- TIFLASH - TIKV_IMPORTER - TIME - TIMESTAMP @@ -685,7 +704,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - TINYTEXT (R) - TO (R) - TOKEN_ISSUER -- TOPN (R) +- TOPN - TPCC - TPCH_10 - TRACE @@ -696,6 +715,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - TRIGGERS - TRUE (R) - TRUNCATE +- TSO - TTL - TTL_ENABLE - TTL_JOB_INTERVAL @@ -745,7 +765,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - WHEN (R) - WHERE (R) - WHILE (R) -- WIDTH (R) +- WIDTH - WINDOW (R-Window) - WITH (R) - WITHOUT diff --git a/scripts/check-keywords.sh b/scripts/check-keywords.sh index 6df1183902982..fcee793d7fa87 100755 --- a/scripts/check-keywords.sh +++ b/scripts/check-keywords.sh @@ -16,33 +16,45 @@ keywords = kwdocs.read_text() errors = 0 section = "Unknown" for line in parser.read_text().split("\n"): - if line.find("The following tokens belong to ReservedKeyword") >= 0: + if line == "": + section = "NotKeywordToken" + + elif line.find("The following tokens belong to ReservedKeyword") >= 0: section = "ReservedKeyword" - if line.find("The following tokens belong to UnReservedKeyword") >= 0: + elif line.find("The following tokens belong to UnReservedKeyword") >= 0: section = "UnReservedKeyword" - if line.find("The following tokens belong to NotKeywordToken") >= 0: + elif line.find("The following tokens belong to TiDBKeyword") >= 0: + section = "TiDBKeyword" + + elif line.find("The following tokens belong to NotKeywordToken") >= 0: section = "NotKeywordToken" if section == "ReservedKeyword": if m := re.match(r'^\t\w+\s+"(\w+)"$', line): kw = m.groups()[0] if not ( - kwm := re.search(f"^- {kw} \((R|R-Window)\)$", keywords, re.MULTILINE) + kwm := re.search(f"^- {kw} \\((R|R-Window)\\)$", keywords, re.MULTILINE) ): if kwm := re.search(f"^- {kw}$", keywords, re.MULTILINE): - print(f"Keyword not labeled as reserved: {kw}") - errors += 1 + print(f"Reserved keyword not labeled as reserved: {kw}") else: print(f"Missing docs for reserved keyword: {kw}") - errors += 1 + errors += 1 - if section == "UnReservedKeyword": + if section in ["UnReservedKeyword", "TiDBKeyword"]: if m := re.match(r'^\t\w+\s+"(\w+)"$', line): kw = m.groups()[0] if not (kwm := re.search(f"^- {kw}$", keywords, re.MULTILINE)): - print(f"Missing docs for non-reserved keyword: {kw}") + if kwm := re.search( + f"^- {kw} \\((R|R-Window)\\)$", keywords, re.MULTILINE + ): + print( + f"Non-reserved keyword from {section} labeled as reserved: {kw}" + ) + else: + print(f"Missing docs for non-reserved keyword from {section}: {kw}") errors += 1 sys.exit(errors)