Logo von Huawei Cloud Mrs Spark Sql Check

Huawei Cloud Mrs Spark Sql Check

Organisation
huaweicloud
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语法".

Übersicht

Herausgeberhuaweicloud
Repositoryhuaweicloud-skills
Skill-Namehuawei-cloud-mrs-spark-sql-check
Sterne
59
Forks
24
Mitgelieferte Dateien
11
LizenzMIT
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 11

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von huaweicloud auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Huawei Cloud Mrs Spark Sql Check in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/bigdata/mrs/huawei-cloud-mrs-spark-sql-check
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/huaweicloud/huaweicloud-skills.git /tmp/huaweicloud-skills
mkdir -p .claude/skills
cp -r /tmp/huaweicloud-skills/skills/bigdata/mrs/huawei-cloud-mrs-spark-sql-check .claude/skills/huawei-cloud-mrs-spark-sql-check
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Huawei Cloud Mrs Spark Sql Check in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Huawei Cloud Mrs Spark Sql Check automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Huawei Cloud Mrs Spark Sql Check nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

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

ModeDependencyDescription
syntaxNoneSyntax check: keyword validity, statement structure, clause completeness, Spark SQL syntax compatibility
specNoneSpecification check: object design standards, data operation standards, naming conventions, Spark SQL development rules
allNoneExecute 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.

bash
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.

bash
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] VIEW
  • REFRESH TABLE table_name / REFRESH FUNCTION func_name
  • ADD JAR /path/to/file.jar
  • /*+ BROADCAST(table) */ and /*+ COALESCE(N) */ hints
  • LATERAL 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 IDNameLevelDescription
SYN-ERRLexical ErrorERRORUnrecognized characters in SQL text
SYN001Invalid KeywordERRORKeyword not supported by Spark SQL
SYN002Reserved Keyword as IdentifierERRORReserved keyword used as identifier without quoting
SYN003Syntax Structure ErrorERRORMissing required clause or keyword
SYN004Clause Ordering ErrorERRORSQL clause order does not conform to grammar
SYN005PARTITIONED BY Syntax ErrorERRORInvalid partition definition syntax
SYN006CLUSTERED BY Syntax ErrorERRORInvalid bucket definition syntax (Hive compat)
SYN007STORED AS / USING Syntax ErrorERRORInvalid storage format or data source
SYN008ROW FORMAT Syntax ErrorERRORInvalid ROW FORMAT definition (Hive compat)
SYN009INSERT OVERWRITE Syntax ErrorERRORInvalid INSERT OVERWRITE structure
SYN010LATERAL VIEW Syntax ErrorERRORInvalid LATERAL VIEW structure
SYN011Subquery Syntax ErrorERRORInvalid subquery structure
SYN012CREATE TABLE Structure ErrorERRORMissing required elements in CREATE TABLE
SYN013ALTER TABLE Syntax ErrorERRORInvalid ALTER TABLE action
SYN014MERGE Syntax ErrorERRORInvalid MERGE statement structure
SYN016USING Clause ErrorERRORInvalid USING data source specification
SYN017OPTIONS Clause ErrorERRORInvalid OPTIONS clause format
SYN018CACHE TABLE Syntax ErrorERRORInvalid CACHE TABLE structure
SYN019REFRESH Syntax ErrorERRORInvalid REFRESH statement structure
SYN020ADD/LIST JAR Syntax ErrorERRORInvalid ADD JAR / LIST JAR structure

Step 5: Specification Check

Based on AST and Token stream, execute specification check rules. Rules are derived from Spark SQL development specification and MRS Spark best practices.

Specification Check Rules (29 rules):

Rule IDNameLevelCategoryDescription
SPEC001SELECT * ProhibitedWARNINGData OperationQuery must specify explicit column list
SPEC002DELETE/UPDATE without WHEREERRORData OperationDML must include WHERE condition
SPEC003Cartesian ProductERRORData OperationMulti-table missing JOIN condition
SPEC004Implicit Type ConversionWARNINGData OperationMay cause unexpected results
SPEC005LIKE Leading WildcardWARNINGData OperationCannot use partition pruning
SPEC006Partition Field FunctionWARNINGData OperationFunction on partition field prevents pruning
SPEC007INSERT Missing Column ListWARNINGData OperationRelies on default column order
SPEC008Missing Table CommentINFOObject DesignTable without comment
SPEC009Reserved Keyword as IdentifierERRORNamingMay cause syntax ambiguity
SPEC010Column Name Too LongWARNINGNamingColumn name exceeds 30 characters
SPEC012FLOAT/DOUBLE for MoneyERRORObject DesignUse DECIMAL for monetary fields
SPEC013Too Many ColumnsWARNINGObject DesignTable should not exceed 100 columns
SPEC014Too Many Partition FieldsWARNINGObject DesignPartition fields should not exceed 3
SPEC015Missing Column CommentINFOObject DesignColumn without comment
SPEC016CASE WHEN Missing ELSEWARNINGData OperationCASE WHEN should include ELSE clause
SPEC017NULL Value HandlingWARNINGData OperationNULL handling in conditions
SPEC018String 'null' ProhibitedERRORData OperationDo not use string 'NULL'
SPEC019JOIN Field Type MismatchWARNINGData OperationJoin fields should have same type
SPEC020INSERT INTO VALUESWARNINGSQL DevUse INSERT SELECT instead
SPEC021Subquery Nesting DepthWARNINGSQL DevSubquery should not exceed 3 levels
SPEC022Partition Pruning MissingERRORData OperationPartitioned table query without partition filter
SPEC023Non-Standard Join ConditionWARNINGData OperationJOIN ON should not contain IF/CASE WHEN
SPEC024CASCADE Usage WarningWARNINGSQL DevUse CASCADE carefully in ALTER TABLE
SPEC025Prefer USING over STORED ASWARNINGSQL DevUse Spark native USING syntax
SPEC026CACHE TABLE RecommendationINFOSQL DevCache repeatedly accessed tables
SPEC027BROADCAST Hint RecommendationINFOSQL DevUse broadcast join for small tables
SPEC028DROP Missing IF EXISTSWARNINGSQL DevUse IF EXISTS with DROP
SPEC029ADD JAR WarningINFOSQL DevPrefer --jars over ADD JAR

Step 6: Generate Report

Use the check engine to generate a Markdown format report:

bash
python ~/.cac/skills/huawei-cloud-mrs-spark-sql-check/scripts/spark_sql_checker.py "<sql_text>" all

Report format:

markdown
# MRS Spark SQL Check Report

**Check Time**: yyyy-mm-ddThh:mm:ss
**Statement Type**: SELECT
**Check Mode**: all

## Summary

| Metric | Value |
|--------|-------|
| Total Rules | 56 |
| Passed | 51 |
| Violations | 5 |
| Errors (ERROR) | 2 |
| Warnings (WARNING) | 2 |
| Infos (INFO) | 1 |

## Syntax Check

### [X] SYN003: Syntax Structure Error
- **Level**: ERROR
- **Position**: Line 1, Column 15
- **Description**: Missing FROM clause
- **Fix Suggestion**: Add FROM table_name

## Specification Check

### [!] SPEC001: SELECT * Prohibited
- **Level**: WARNING
- **Position**: Line 1, Column 8
- **Description**: Query uses SELECT *, should specify explicit column list
- **Fix Suggestion**: Replace SELECT * with specific column list

Parameters

ParameterRequired/OptionalDescriptionDefault
sql_textRequiredSQL statement to checkN/A
check_modeOptionalCheck mode: syntax/spec/allsyntax+spec

Output Format

The check report is output in Markdown format, containing:

  • Summary table: Total rules, passed, violations by level
  • Syntax check section: Violations from syntax rules (SYN-ERR, SYN001-SYN020)
  • Specification check section: Violations from specification rules (SPEC001-SPEC029)
  • Large SQL interception section: Violations from interception rules (INTERCEPT001-INTERCEPT007)
  • Original SQL: The checked SQL statement

Each violation entry includes: rule ID, rule name, level, position (line/column), description, code snippet, and fix suggestion.

Core Commands

spark_sql_checker.py spark_sql_parser.py spark_sql_tokenizer.py

Best Practices

  1. Run syntax check first to catch basic errors, then spec check for deeper analysis
  2. For CREATE TABLE statements, prefer USING parquet over STORED AS PARQUET
  3. Use ORC or Parquet storage format for better compression and query performance
  4. Always add partition filter conditions when querying partitioned tables
  5. Use all mode for comprehensive checking
  6. Use /*+ BROADCAST(small_table) */ hint for small-large table joins

References

DocumentDescription
AST SchemaAST node type definitions for Spark SQL
Syntax Rules20 syntax check rule definitions
Specification Rules29 specification check rule definitions
KeywordsSpark SQL keyword definitions
Grammar RulesStatement type grammar definitions

Notes

  1. Syntax and specification checks do not require cluster connection, can run offline
  2. Spark-specific syntax checking (USING, OPTIONS, CACHE TABLE, etc.) is based on Spark SQL grammar definitions
  3. The check engine includes a custom tokenizer and recursive descent parser, no external SQL parsing libraries required
  4. Spark SQL is derived from HiveQL; Hive-compatible syntax (STORED AS, CLUSTERED BY, ROW FORMAT) is also supported

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill 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语法".

Warum Huawei Cloud Mrs Spark Sql Check in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Huawei Cloud Mrs Spark Sql Check besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Huawei Cloud Mrs Spark Sql Check in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/bigdata/mrs/huawei-cloud-mrs-spark-sql-check ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Huawei Cloud Mrs Spark Sql Check nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Huawei Cloud Mrs Spark Sql Check verwenden?

So viele Sie möchten. In TypingMind können Sie Huawei Cloud Mrs Spark Sql Check mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Huawei Cloud Mrs Spark Sql Check kostenlos?

Ja. Der Skill wird von huaweicloud auf GitHub unter der Lizenz MIT veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇