alibabacloud-odps-sql-generation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MaxCompute SQL Engine Syntax Skill

MaxCompute SQL引擎语法技能

Provides MaxCompute SQL engine syntax guidance for text2sql scenarios. MaxCompute is based on Hive SQL extensions and has significant differences from ANSI standard SQL.
为text2sql场景提供MaxCompute SQL引擎语法指导。MaxCompute基于Hive SQL扩展,与ANSI标准SQL存在显著差异。

Usage

使用方法

Load corresponding reference files based on question type (can be combined). The
load
column indicates relative loading weight (heavy ≈ large, medium ≈ moderate), for budget estimation, not exact token counts. Each file's opening paragraph describes its own scope.
Trigger conditionFileload
NL→SELECT generation / text2sql (determine intent, granularity, table-column mapping, output format first)
references/text2sql_principles.md
light
Generate MaxCompute SELECT queries (dialect rules, DQL default must-read)
references/maxcompute_select_guide.md
heavy
Match query pattern keywords: Top N / top-N per group / year-over-year / month-over-month / consecutive N days / retention / row-to-column / column-to-row / PIVOT / UNPIVOT / array expansion / LATERAL VIEW / EXPLODE / JSON extraction / GET_JSON_OBJECT / cumulative / running total / Range Join / GROUPING SETS / CUBE / ROLLUP / pagination / paging
references/sql_query_patterns.md
medium
SQL execution failure requiring diagnosis and recovery (including
ODPS-0xxx
error codes)
references/sql_common_errors.md
medium
Relationship:
text2sql_principles.md
provides engine-independent NL→SELECT generation principles;
maxcompute_select_guide.md
is the single authoritative source for MaxCompute DQL dialect rules (unsupported syntax/functions/partitioning/types/SET parameters).
sql_query_patterns.md
provides query template snippets only, without duplicating rules.
根据问题类型加载对应的参考文件(可组合使用)。
load
列表示相对加载权重(heavy≈大,medium≈中等),用于预算估算,并非精确的token数量。每个文件的开篇段落描述了自身的适用范围。
触发条件文件加载权重
自然语言转SELECT语句生成 / text2sql(需先确定意图、粒度、表列映射、输出格式)
references/text2sql_principles.md
light
生成MaxCompute SELECT查询语句(方言规则,DQL默认必读)
references/maxcompute_select_guide.md
heavy
匹配查询模式关键词:Top N / 分组Top N / 同比 / 环比 / 连续N天 / 留存率 / 行转列 / 列转行 / PIVOT / UNPIVOT / 数组展开 / LATERAL VIEW / EXPLODE / JSON提取 / GET_JSON_OBJECT / 累计值 / 运行总计 / Range Join / GROUPING SETS / CUBE / ROLLUP / 分页
references/sql_query_patterns.md
medium
SQL执行失败需诊断与恢复(包含
ODPS-0xxx
错误码)
references/sql_common_errors.md
medium
关联说明:
text2sql_principles.md
提供独立于引擎的自然语言转SELECT语句生成原理;
maxcompute_select_guide.md
是MaxCompute DQL方言规则(不支持的语法/函数/分区/类型/SET参数)的唯一权威来源
sql_query_patterns.md
仅提供查询模板片段,不重复规则内容。

Out of Scope

超出范围场景

The following scenarios exceed this skill's scope:
  • MaxCompute non-SQL interfaces: Tunnel / MapReduce / Graph / PyODPS DataFrame API, SDK invocation methods
  • Console and permission management: Quota requests, IAM / RAM roles, project owner operations — use Aliyun console or support tickets
  • Execution plan-level deep tuning: Only lists common SET parameters and hints; does not analyze specific plan nodes / Fuxi DAG / data skew formation paths
  • Cluster-side / platform-side failures: Worker crashes, resource scheduling failures, MetaStore transaction conflicts, storage layer read/write errors — these are support ticket issues, not SQL issues
以下场景超出本技能的适用范围:
  • MaxCompute非SQL接口:Tunnel / MapReduce / Graph / PyODPS DataFrame API、SDK调用方法
  • 控制台与权限管理:配额申请、IAM / RAM角色、项目所有者操作 — 请使用阿里云控制台或提交支持工单
  • 执行计划级深度调优:仅列出常见SET参数和提示;不分析具体计划节点 / Fuxi DAG / 数据倾斜形成路径
  • 集群端/平台端故障:Worker崩溃、资源调度失败、MetaStore事务冲突、存储层读写错误 — 这些属于支持工单处理范畴,不属于SQL问题