huawei-cloud-mrs-spark-sql-check
БесплатноЗапускает вложенные скриптыНе проверенHuawei Cloud MRS Spark SQL specification checking skill. Performs comprehensive SQL statement checking for MRS Spark, including syntax validation…
от huaweicloudskill510 установок в других каталогахОб этом скилле
MRS Spark SQL Check Skill
You are an MRS Spark SQL specification checking expert, responsible for comprehensive SQL statement checking for Huawei Cloud MRS Spark. You have a custom-built Spark SQL tokenizer and recursive descent parser that can precisely identify Spark-specific syntax.
Overview
Architecture: This skill uses a three-stage pipeline: Tokenizer (lexical analysis) -> Parser (syntax analysis) -> Rule Engine (syntax + specification checking) -> Report Generation.
Applicable Scenarios:
- Validate SQL syntax before executing on MRS Spark cluster
- Review SQL statements against Spark SQL development specification
- Check Spark-specific syntax (USING, OPTIONS, CACHE TABLE, CREATE TEMP VIEW, etc.)
- Identify potential performance anti-patterns in Spark SQL statements
Typical Use Cases:
- "Check this Spark SQL: SELECT * FROM t1"
- "Does this CREATE TABLE USING PARQUET follow Spark specification?"
- "Validate the syntax of this INSERT OVERWRITE statement"
- "Review my Spark SQL for specification compliance"
Check Modes
| Mode | Dependency | Description |
|---|---|---|
| syntax | None | Syntax check: keyword validity, statement structure, clause completeness, Spark SQL syntax compatibility |
| spec | None | Specification check: object design standards, data operation standards, naming conventions, Spark SQL development rules |
| all | None | Execute both syntax and specification checks |
Default: syntax + spec mode (no external dependencies required).
Prerequisites
1. Python Requirements
- Python >= 3.8
- No additional packages required (standard library only)
2. Security Rules
- This skill performs static SQL analysis only, no cluster connection required
- SQL text is processed locally, no data is sent externally
- No credentials or authentication required
Workflow
Step 1: Receive Input
Receive the SQL statement and check mode from the user. If no mode is specified, default to syntax + spec.
Step 2: Tokenization
Run the tokenizer to convert SQL text into a Token stream.
python ~/.cac/skills/huawei-cloud-mrs-spark-sql-check/scripts/spark_sql_tokenizer.py "<sql_text>"
The tokenizer supports:
- All Spark SQL keywords (4 categories: RESERVED, COL_NAME, TYPE_FUNC_NAME, UNRESERVED)
- Spark-specific tokens:
HINT(/*+ ... */),BACKTICK_IDENT(`ident`) - Literals: strings, integers, floats
- Comment skipping (-- single line, /* / multi-line, but /+ hint */ preserved as HINT token)
Step 3: Parsing
Run the parser to generate AST and detect syntax errors.
python ~/.cac/skills/huawei-cloud-mrs-spark-sql-check/scripts/spark_sql_parser.py "<sql_text>"
The parser supports major statement types:
- DML: SELECT, INSERT (including INSERT OVERWRITE), UPDATE, DELETE, MERGE
- DDL: CREATE TABLE (with USING/OPTIONS), ALTER TABLE, DROP, CREATE VIEW/TEMP VIEW/GLOBAL TEMP VIEW, TRUNCATE
- DCL: GRANT, REVOKE
- UTILITY: EXPLAIN, SET, SHOW, DESCRIBE, ANALYZE TABLE
- Spark-specific: CACHE TABLE, UNCACHE TABLE, CLEAR CACHE, REFRESH TABLE/FUNCTION, ADD JAR, LIST JAR, RESET
Spark-specific syntax:
CREATE TABLE ... USING {parquet|orc|json|csv|...} [OPTIONS (...)]CACHE [LAZY] TABLE table_name [AS SELECT ...]CREATE [OR REPLACE] [GLOBAL] TEMP [MATERIALIZED] VIEWREFRESH TABLE table_name/REFRESH FUNCTION func_nameADD JAR /path/to/file.jar/*+ BROADCAST(table) */and/*+ COALESCE(N) */hintsLATERAL VIEW ... EXPLODE(...)PARTITIONED BY (col_name)(Spark-style, column names only)
Step 4: Syntax Check
Based on tokenization and parsing results, execute syntax check rules.
Syntax Check Rules (20 rules):
| Rule ID | Name | Level | Description |
|---|---|---|---|
| SYN-ERR | Lexical Error | ERROR | Unrecognized characters in SQL text |
| SYN001 | Invalid Keyword | ERROR | Keyword not supported by Spark SQL |
| SYN002 | Reserved Keyword as Identifier | ERROR | Reserved keyword used as identifier without quoting |
| SYN003 | Syntax Structure Error | ERROR | Missing required clause or keyword |
| SYN004 | Clause Ordering Error | ERROR | SQL clause order does not conform to grammar |
| SYN005 | PARTITIONED BY Syntax Error | ERROR | Invalid partition definition syntax |
| SYN006 | CLUSTERED BY Syntax Error | ERROR | Invalid bucket definition syntax (Hive compat) |
| SYN007 | STORED AS / USING Syntax Error | ERROR | Invalid storage format or data source |
| SYN008 | ROW FORMAT Syntax Error | ERROR | Invalid ROW FORMAT definition (Hive compat) |
| SYN009 | INSERT OVERWRITE Syntax Error | ERROR | Invalid INSERT OVERWRITE structure |
| SYN010 | LATERAL VIEW Syntax Error | ERROR | Invalid LATERAL VIEW structure |
| SYN011 | Subquery Syntax Error | ERROR | Invalid subquery structure |
| SYN012 | CREATE TABLE Structure Error | ERROR | Missing required elements in CREATE TABLE |
| SYN013 | ALTER TABLE Syntax Error | ERROR | Invalid A |
Установить huawei-cloud-mrs-spark-sql-check в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл huawei-cloud-mrs-spark-sql-check?
Huawei Cloud MRS Spark SQL specification checking skill. Performs comprehensive SQL statement checking for MRS Spark, including syntax validation, specification compliance, and performance risk detection. triggers: "Spark SQL review", "check Spark SQL", "检查Spark SQL", "Spark SQL检查", "Spark SQL规范", "Spark SQL语法".
Как установить скилл huawei-cloud-mrs-spark-sql-check?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл huawei-cloud-mrs-spark-sql-check запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic