Files
marqdo-cli/tests/conformance/semantics/72-table-columnar.mq.md
cflmy 72f57beee0
ci/woodpecker/push/main Pipeline failed
ci/woodpecker/pr/main Pipeline failed
refactor: accept the ecosystem stdlib Bundle and remove the in-repo sources
Phase B of ADR-0070 (issue #11): the CLI no longer owns standard-library
sources. The pin names the accepted ecosystem Bundle (marqdo-stdlib@0.2.0,
root commit + tree/alias digests); tools/ci/fetch_ecosystem_bundle.py
materializes it from the pinned root commit and stdlib gitlinks and verifies
the digests. bundle.py and the test harness require an explicit verified Bundle
for the accepted identity, and runtime discovery has no compile-time source
fallback in any profile.

Delete stdlib/ (modules, self-tests, aliases manifest). Module and domain tests
stay with their component owners; the CLI product lane now verifies the
external Bundle's public surface, std: resolution and official print/打印 alias
routing (tests/product-stdlib). Composition assertions whose owner is the
ecosystem (Table split, print-format equivalence) moved to the root Bundle
acceptance; the generic TCP round-trip stays a CLI test. Spawned-CLI tests name
the verified Bundle explicitly.

CI (Woodpecker + GitHub) materializes the pinned Bundle before product tests,
packaging and performance lanes; packaging and release take --stdlib-dir from
that artifact. Docs, STATUS, ADR-0070 and a Phase B evidence record updated.

Refs cflmy/marqdo#9, cflmy/marqdo-cli#11
2026-11-27 01:04:01 +08:00

3.4 KiB

import
import
数据表
std:collections/table

@exec 转表

params(列存: Map)

列 = 列存["列"]

数据 = 列存["数据"]

行数 = 0

if 长度(数据) > 0

行数 = 长度(数据[0])

else

忽略 = 0

end

行列表 = []

行号 = 0

while 行号 < 行数

行 = []

列号 = 0

while 列号 < 长度(列)

行 = list.append(行, 数据[列号][行号])

列号 = 列号 + 1

end

行列表 = list.append(行列表, 行)

行号 = 行号 + 1

end

return 表(列, 行列表)

@exec 列存排序

params(列存: Map, 目标列: Int)

列 = 列存["列"]

数据 = 列存["数据"]

行数 = 长度(数据[目标列])

顺序 = []

行号 = 0

while 行号 < 行数

顺序 = list.append(顺序, 行号)

行号 = 行号 + 1

end

下标 = 1

while 下标 < 行数

当前 = 下标

新顺序 = []

已插入 = false

位 = 0

while 位 < 长度(顺序)

已有 = 顺序[位]

if not 已插入 and 数据[目标列][已有] > 数据[目标列][当前]

新顺序 = list.append(新顺序, 当前)

新顺序 = list.append(新顺序, 已有)

已插入 = true

else

新顺序 = list.append(新顺序, 已有)

end

位 = 位 + 1

end

if not 已插入

新顺序 = list.append(新顺序, 当前)

else

忽略 = 0

end

顺序 = 新顺序

下标 = 下标 + 1

end

新数据 = []

列号 = 0

while 列号 < 长度(列)

新列 = []

位 = 0

while 位 < 行数

新列 = list.append(新列, 数据[列号][顺序[位]])

位 = 位 + 1

end

新数据 = list.append(新数据, 新列)

列号 = 列号 + 1

end

return {列: 列, 数据: 新数据}

@exec 列存过滤

params(列存: Map, 目标列: Int, 阈值: Int)

列 = 列存["列"]

数据 = 列存["数据"]

行数 = 长度(数据[目标列])

保留 = []

行号 = 0

while 行号 < 行数

if 数据[目标列][行号] > 阈值

保留 = list.append(保留, 行号)

else

忽略 = 0

end

行号 = 行号 + 1

end

新数据 = []

列号 = 0

while 列号 < 长度(列)

新列 = []

位 = 0

while 位 < 长度(保留)

新列 = list.append(新列, 数据[列号][保留[位]])

位 = 位 + 1

end

新数据 = list.append(新数据, 新列)

列号 = 列号 + 1

end

return {列: 列, 数据: 新数据}

@exec 表相等

params(左: Table, 右: Table)

左列 = table.columns(左)

右列 = table.columns(右)

相等 = 长度(左列) == 长度(右列) and 长度(左) == 长度(右)

列号 = 0

while 列号 < 长度(左列) and 相等

if 左列[列号] != 右列[列号]

相等 = false

else

忽略 = 0

end

列号 = 列号 + 1

end

行号 = 0

while 行号 < 长度(左) and 相等

列号 = 0

while 列号 < 长度(左列) and 相等

if table.cell(左, 行号, 列号) != table.cell(右, 行号, 列号)

相等 = false

else

忽略 = 0

end

列号 = 列号 + 1

end

行号 = 行号 + 1

end

return 相等

@exec main

列存 = {列: ["名称", "分数"], 数据: [["甲", "乙", "丙"], [87, 92, 71]]}

行表 = 转表(列存)

排序行 = 数据表.排序(行表, 1)

排序列 = 转表(列存排序(列存, 1))

过滤行 = 数据表.过滤数值大于(行表, 1, 80)

过滤列 = 转表(列存过滤(列存, 1, 80))

return [表相等(转表(列存), 行表), 表相等(排序行, 排序列), 表相等(过滤行, 过滤列)]