附录C-术语表
附录 C · 术语表(问数领域)
Section titled “附录 C · 术语表(问数领域)”本页只收问数/成本领域专有术语(cube、measure、收口门、五差等)。 全 cookbook 的通用术语(Harness、Skill、CLI、TBox/ABox、AUI、评测…)统一收在 参考/术语表。
A-Z 术语
Section titled “A-Z 术语”Agent / 代理
Section titled “Agent / 代理”Claude Code 中的子代理。本指南语境下指 cost-manager 这种”路由壳”——把用户问题路由到对应 skill。
batch / 批量执行
Section titled “batch / 批量执行”cost-query batch --params '{"queries": [...]}',把多个查询打到一次进程。子查询字段:二级指令用 {cmd, params},DSL 直查用 {cmd, dsl},不能同传。
CLI 一致性(路径分)
Section titled “CLI 一致性(路径分)”测评的第一个评分维度(占 60 分)。看 LLM 选对二级指令吗、模式选对吗、参数填对吗、是否多余调用、是否发生重试。
cube / 数据立方
Section titled “cube / 数据立方”OLAP 概念,本指南用作 schema.yaml 中事实表或维度表的抽象。cost-query 有 19 个 cube(7 事实 + 12 维度)。
cube_map
Section titled “cube_map”find-dimension 自定义 builder 中的字典,从 dimensionName 路由到对应维度 cube。各项目 fork 后必须改这里。
defaultFilters
Section titled “defaultFilters”schema 中声明的静态兜底 filter。未传该字段时自动加 filter;unless 列表中字段被引用时跳过。例:cost-query 的 ProjectIndicator.isEndCost=1。
dimensions / 维度
Section titled “dimensions / 维度”DSL 中的 GROUP BY 字段(aggregate verb 下)或 SELECT 列(find verb 下)。
dim_* 表
Section titled “dim_* 表”维度宽表前缀。如 dim_cost_city、dim_cost_project。
drillThrough
Section titled “drillThrough”事实 cube 之间的穿透关系。schema 速查版 yaml 中含 drillThrough 节,列出可穿透目标 + 字段映射。
Domain-Specific Language,本指南指 cost-query 的一级指令 JSON 格式。三个 verb:find / aggregate / rank。
dwd_* / dws_* 表
Section titled “dwd_* / dws_* 表”事实宽表前缀。dwd = DataWarehouse Detail(明细级),dws = DataWarehouse Summary(汇总级)。
--explain
Section titled “--explain”二级指令的调试模式:显示编译后的 DSL + SQL + 编译期 hint。
fetch_schema.py
Section titled “fetch_schema.py”从 schema.yaml(编译源)派生 references/schema/(AI 速查版)的脚本。改了 schema.yaml 必须跑这个。
filters
Section titled “filters”DSL 中的 WHERE 条件。结构:{"member": "<Cube>.<field>", "operator": "<op>", "values": [...]}。
filterIf
Section titled “filterIf”DSL aggregate 的扩展能力:measure 上的条件聚合,编译为 SQL CASE WHEN。
find-dimension
Section titled “find-dimension”通用维度探测二级指令。按 dimensionName + keyword 在指定维度 cube 中模糊搜索。跨领域可直接抄,只改 cube_map。
friendlyAlias
Section titled “friendlyAlias”schema 中声明的业务化短名映射。如 cityName → City.areaName(自动 JOIN)或 cityName → {self}.city_name(物理化后)。
granularity
Section titled “granularity”DSL aggregate 的时间分桶能力:{"member": "<Cube>.<timeField>", "granularity": "day|week|month|quarter|year"}。
having
Section titled “having”DSL aggregate 的聚合后过滤:having: [{"member": "<已声明的 alias>", "operator": "...", "values": [...]}]。
Headless 跑批
Section titled “Headless 跑批”无人值守的自动化测评:每题起一个 claude -p 进程,stream-json 解析记录工具调用与结论。
--info
Section titled “--info”二级指令的调试模式:打印参数清单与 schema。
inferredFilters
Section titled “inferredFilters”schema 中声明的推断 filter。按规则自动推断 value 并加 filter。例:cost-query 的 _infer_isJianAn。
L1-L4 意图分层
Section titled “L1-L4 意图分层”用户提问的四层意图:L1 查事实 / L2 做判断 / L3 找原因 / L4 给动作。每层对应不同查询深度与输出深度。
Markdown 速查表
Section titled “Markdown 速查表”模式手册 query-guide.md 中 M1-Mn 的表格形式。命中关键词 + 命令模板,LLM 命中即抄。
M1-Mn 模式
Section titled “M1-Mn 模式”模式手册的条目编号。cost-query 当前 M1-M6 共 39 个模式。
measureGroups
Section titled “measureGroups”agg-project-indicator 的业务化封装:跨 (bzItemName, isEndCost, indicatorType) 组合的批量指标查询。一次出多列。
measures
Section titled “measures”DSL aggregate 中的聚合度量。支持 sum / avg / min / max / count / distinctCount。
member
Section titled “member”DSL filter / order / measures 中的字段引用,格式 <Cube>.<field> 或 friendlyAlias 短名。
Receipt 机制
Section titled “Receipt 机制”cost-query 防数据幻觉的机制:所有数字必须可回指到本会话查询结果([receipt: cost-query-v2 ...] 前的结果表格)。
DSL 的第三个 verb(Top-N)。cost-query 已下线 rank-* 二级指令,统一改用 agg + orderBy + limit。
--registry / _registry.py
Section titled “--registry / _registry.py”二级指令的自动注册脚本。扫描 commands/*.yaml 加载到 query.py。
Routed Measure / 路由度量
Section titled “Routed Measure / 路由度量”按参数路由到不同物理列的逻辑度量。例:ProjectIndicator.indicator 按 routedKey 1/2/3/4 路由到 4 个物理列。
routedKey
Section titled “routedKey”routed measure 的路由参数。接受数字(1/2/3/4)或语义别名(“建面单方”/“含量”等)。
Schema 双层
Section titled “Schema 双层”scripts/schema.yaml(编译唯一源)+ references/schema/(AI 速查版)。后者自动生成,严禁直接编辑。
Skill / 技能
Section titled “Skill / 技能”Claude Code 的能力组织单元。一个 skill 包含 SKILL.md + references/ + scripts/。
SOP / 标准作业流程
Section titled “SOP / 标准作业流程”Standard Operating Procedure。问数技能不用 SOP 流程图(LLM 执行差),用模式手册(命中即抄)。
stream-json
Section titled “stream-json”Claude Code -p 模式的输出格式:实时流出 JSON 事件(工具调用、文本回复、错误等)。跑批工具靠它还原 LLM 跑了什么。
<verb>-<entity> 命名的命令封装层。比 DSL 高一层抽象,让 LLM “模板填槽”而不是”自由发挥”。
反模式黑名单
Section titled “反模式黑名单”模式手册的反面:什么写法绝对不要用。cost-query query-guide §4.3 共 7 条。
数据底线的最高优先级:禁止补数 / 禁止手写 SQL / 禁止混业态强判断。
L3 找原因场景下的拆解维度。cost-query 用”五差框架”(量差/价差/配置差/条件差/口径差);售楼可能是”量价位时”;工程可能是”进度成本质量安全”。
结论一致性(结论分)
Section titled “结论一致性(结论分)”测评的第二个评分维度(占 40 分)。看数值是否正确、是否标注口径、是否按样本降级表降级表达、是否守住数据底线。
query-guide.md 的 §1(M1-Mn)。把”什么业务问题对应哪条命令”列成表,LLM 命中即抄。
LLM 拿到问题后对照模板填参数。与”自由发挥写 DSL”对比,错误率低得多。
主查询后的决策点:用户意图是否已被满足?三条核心规则:可收口 / 不可收口 / 0 行兜底。
业务规则的兜底策略:编译器层(自动行为)+ 文档层(反模式黑名单)。
速查版 schema
Section titled “速查版 schema”references/schema/*.yaml,由 fetch_schema.py 从 schema.yaml 派生。AI 按需加载。
撤宽(机械撤宽)
Section titled “撤宽(机械撤宽)”0 行机械撤宽:保留 1 个核心 filter,其余移到 groupBy 让分布显形。是问数技能最重要的 0 行兜底机制。
cost-query 的归因框架:量差 / 价差 / 配置差 / 条件差 / 口径差。领域专属,不直接抄到其它领域。
三层架构的第一层。SKILL.md + references/ 共同构成。不直接生成 SQL,只用业务语言决策。
三层架构的第二层。query.py + DSL + schema.yaml 共同构成。把 DSL / 二级指令翻译成 SQL。
维度风险分级
Section titled “维度风险分级”模式手册的前置概念:维度词分低/中/高三档,高风险词必须先 find-dimension 标准化。
把跨 cube 字段冗余到事实表,避免每次查询都 JOIN。例:cost-query 2026-05 把 cityName/provinceName 物化进事实表。
编译器层声明式的业务规则:inferredFilters / defaultFilters / friendlyAlias。让 DSL 直查与二级指令体验对齐。
自救刚性约束
Section titled “自救刚性约束”DSL 报错时 LLM 必须遵守的自救纪律:一次性读完所有报错行 + 一次性修对再重试。自救只允许 1 次重试。
字段所有权差异
Section titled “字段所有权差异”不同事实 cube 的本地字段集差异。例:cost-query 的 BqUnitPrice 自身无 projectName / cityName 字段,必须走 JOIN 或物理化。