Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Questions spanning thousands of tables force the model to hand-write 20k-character UNION ALL statements (19% of cost in one batch of sessions)

オープン
#1,489 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
18/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
sql, typescript
領域
database, devtools

調査の方向性

Start with the write classifier in packages/opencode/src/altimate/tools/sql-classify.ts (around lines 27 and 226-235) and the denial path in sql-execute.ts (lines 113-121) to see which session-local statements are blocked. The issue offers three alternative designs, so the scope needs a maintainer decision before any code. Done would be a question over 1,000+ tables finishing with no single model output above 2k tokens.

索引モデルが issue の本文から書いたものです。

説明

Problem

A warehouse with one table per entity (2,753 tables) has no tool-supported way to query across a set of tables. Every route that would let the engine iterate over a table list is rejected or classified as a write, so the model generates the full UNION ALL text itself and re-types it into sql_execute.

Mechanism

  • DuckDB query_table([...]) rejects subqueries and lateral arguments ("Table function cannot contain subqueries" 36 times, "does not support lateral join column" 34, "Invalid named parameter" 12). An engine limit.
  • The statements that work around it (SET max_expression_depth which DuckDB's own error recommends, SET VARIABLE + query_table(getvariable(...)), EXECUTE IMMEDIATE, CREATE TEMP MACRO ... AS TABLE) are denied as writes (packages/opencode/src/altimate/tools/sql-classify.ts:27, :226-235; sql-execute.ts:113-121).
  • The model builds the text with string_agg; the single huge result cell is clipped in the preview (sql-result-format.ts:40, :178, :342), so it reads the spill file via bash/read and re-types the SQL (output tokens).

Evidence

  • 33 of 44 preview truncations are generated SQL.
  • Median output tokens per session on the affected question: 42,355 (Claude Opus) and 23,545 (gpt-5.6-sol), against 362-3,404 on other questions on the same warehouse.
  • 246-675 s and $5.98-$10.87 per Opus session, the 8 costliest of a 270-session batch; $58.2 of $307.9 (19%) for the two affected questions; context up to 144k tokens; one session used 675 of an 840 s budget; gpt-5.6-sol sessions ran 621-851 s and contributed to budget misses.
  • Generations of 15-25k tokens took 100-160 s each.

Impact

Time and cost, with budget risk. No incorrect answers caused directly in Opus sessions.

Proposed fix

Pick one or more:

  • A table-set primitive on sql_materialize / sql_execute (for example tables: "A*" or a list obtained from a scratch query) that expands UNION ALL BY NAME server-side.
  • Allow session-local non-writing settings (SET max_expression_depth, threads, memory_limit) on read-only connections, and CREATE [TEMP] MACRO in scratch.
  • A query_from: {warehouse, sql} option that classifies the generated text before running it.

Acceptance check

A question over 1,000+ tables completes without any single model output above 2k tokens; median output tokens and cost drop by at least 5x on the affected workload.

主要言語
TypeScript
スター
810
フォーク
121
平均マージ
1日 12時間
マージ済み PR(30日)
94

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AltimateAI/altimate-code のほかの issue

AltimateAI/altimate-code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。