Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 48 additions & 28 deletions keywords.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -350,8 +358,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with

<a id="J" class="letter" href="#J">J</a>

- JOB (R)
- JOBS (R)
- JOB
- JOBS
- JOIN (R)
- JSON

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -514,7 +523,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- PROFILE
- PROFILES
- PROXY
- PUMP (R)
- PUMP
- PURGE

<a id="Q" class="letter" href="#Q">Q</a>
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

<a id="S" class="letter" href="#S">S</a>

- SAMPLES (R)
- SAMPLERATE
- SAMPLES
- SAN
- SAVEPOINT
- SECOND
- SECOND_MICROSECOND (R)
- SECONDARY
- SECONDARY_ENGINE
- SECONDARY_LOAD
- SECONDARY_UNLOAD
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
30 changes: 21 additions & 9 deletions scripts/check-keywords.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)