validate() rejects documented aggregate example before global mappings and aliases are resolved
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- backend, testing-qa
調査の方向性
src/validate.rs から始め、そのレイヤーマッピングの準備処理を src/execute/mod.rs の実行パスと比較してください。特に resolve_aesthetic_aliases() に注目します。再現用として doc/syntax/layer/type/range.qmd に記載されたクエリを使用してください。完了の条件は、クエリがエラーなしで検証され、検証と実行が一致し、実際にマッピングされていない集約ターゲットが回帰テストによって引き続き失敗することです。
索引モデルが issue の本文から書いたものです。
説明
Summary
At v0.4.1, validate() rejects the documented aggregate range example even though the same query executes and renders successfully.
This creates a validation/execution parity problem for integrations that call validate() before execute(): a renderable chart is suppressed with:
Layer 1: aggregate target 'x' is not mapped on this layer
The example is currently documented in doc/syntax/layer/type/range.qmd.
Tested against tag v0.4.1, commit 6fcb07fd7ba40039c61b839c9979e0cad3bceea5.
Minimal reproduction
This uses the Python bindings pinned to core ggsql = "=0.4.1", but the failing behavior comes from the core ggsql::validate path.
import ggsql
import pyarrow as pa
query = """SELECT * FROM airquality
VISUALISE Date AS x, Temp AS ymin, Temp AS ymax, Temp AS color
DRAW range
REMAPPING aggregate AS linewidth
SETTING aggregate => (
'x:first',
'ymin:first', 'ymin:min',
'ymax:last', 'ymax:max',
'color:diff'
), hinge => null
PARTITION BY Week
SCALE linewidth TO (5, 1)
SCALE BINNED color TO ('steelblue', 'firebrick')
SETTING breaks => (-20, 0, 20)"""
reader = ggsql.DuckDBReader("duckdb://memory")
reader.register(
"airquality",
pa.table(
{
"Date": [
"1973-05-01",
"1973-05-02",
"1973-05-08",
"1973-05-09",
],
"Temp": [67, 72, 68, 75],
"Week": [18, 18, 19, 19],
}
),
)
validated = ggsql.validate(query)
print(validated.valid())
print(validated.errors())
spec = reader.execute(query)
rendered = ggsql.VegaLiteWriter().render(spec)
print(len(rendered))
Actual output:
False
[{'message': "Layer 1: aggregate target 'x' is not mapped on this layer", 'location': None}]
6758
Expected:
validated.valid()isTruevalidated.errors()is empty- execution continues to produce the Vega-Lite spec
Root cause
The static validation path and execution path prepare layer mappings differently.
In src/validate.rs:
- The explicit mappings from
VISUALISE ...live inplot.global_mappings. - Validation clones the layer and merges those global mappings into
merged. mergedis used only forvalidate_mapping().validate_aggregate_setting()is then called on the originallayer, whose mappings do not containx,ymin,ymax, orcolor.
Consequently, resolve_aggregate_targets() cannot resolve the first target, x, and emits the error.
There is a second parity requirement in this particular documented example: color:diff targets an aesthetic alias. The execution path first merges globals and then runs resolve_aesthetic_aliases(), turning color into the concrete aesthetic supported by range (here stroke). The standalone validation path does not mirror this alias-resolution step.
This explains both observations:
- static validation fails before execution;
- execution succeeds because it has already merged global mappings and resolved aliases before the aggregate stat runs.
Proposed fix
Make standalone validation use the same effective layer mappings that execution uses before validating aggregate targets:
- Clone the layer.
- Merge applicable
plot.global_mappings, preserving layer precedence and annotation behavior. - Resolve aesthetic aliases on that effective layer according to the geom's supported aesthetics.
- Use the effective layer for both:
validate_mapping()validate_aggregate_setting()
Ideally, factor the merge/alias preparation into a shared helper so validation and execution cannot drift again.
Simply replacing:
layer.validate_aggregate_setting(...)
with:
merged.validate_aggregate_setting(...)
would fix the first x failure, but is not sufficient for the full documented query unless the color alias is also resolved to stroke/ fill as appropriate for the geom.
For wildcard mappings, where standalone validation lacks schema information, aggregate syntax/vocabulary/recycling can still be checked, while target-resolution checks may need to be deferred until effective mappings are knowable.
Suggested regression coverage
- The complete documented range query above returns
valid() == true. - Global
x/ymin/ymaxaggregate targets validate. - Global
colorpluscolor:diffvalidates for a geom supporting the corresponding concrete alias target. - A genuinely unmapped aggregate target remains invalid.
- Validation and execution agree for this query.
- 主要言語
- Rust
- スター
- 562
- フォーク
- 31
- 平均マージ
- 2日 7時間
- マージ済み PR(30日)
- 22
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
posit-dev/ggsql のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
posit-dev/ggsql#565 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Update the positron dep for the extension to 0.2.9対応中かも @thomasp85 が 13 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
writer
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
plot building
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug plot building
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
posit-dev/ggsql の issue をすべて見る
似ている issue
-
C-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
rust-lang/rust-analyzer#23501 ·
メンテナーはふだん 1 日以内に返信
-
Streamable HTTP client: a 401 or 403 with a JSON-RPC error body and no WWW-Authenticate loses its HTTP status対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug P2 ready for work T-security T-transport
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/rust-sdk#1339 ·
メンテナーはふだん 3 日以内に返信
-
French BIP39 wordlist starts with a UTF-8 BOM, so generated French mnemonics carry U+FEFF and derive a non-canonical seed対応中かも @Kshot3000 が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
ergoplatform/sigma-rust#976 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Web chat input doesn't regain focus after a reply finishes対応中かも @GaijinSystems が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
zeroclaw-labs/zeroclaw#11658 ·
メンテナーはふだん 2 日以内に返信