add support for duckdb's lambda syntax

未關閉
#1,171 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
rust, sql
領域
backend, databases

研究方向

Start by locating SQLPage's SQL parsing and preparation entry points, then inspect the parser tests for database-specific syntax. Reproduce the failure with the supplied DuckDB list_filter(lambda ...) query and verify any change against the existing parser tests. Done means SQLPage accepts this valid DuckDB lambda syntax without breaking other SQL parsing.

由索引模型根據 Issue 內容生成。

描述

enhancement
Introduction

When using the list_filter function, SQLPage throws an error, stating it's unable to parse the SQL statement (while valid in the underlying database).

To Reproduce

List of steps to reproduce the behavior. Include the sql file you are using and the eventual relevant parts of your database schema

-- DDL statement to create the table:
CREATE SCHEMA loipro;

CREATE TABLE loipro."data"(
    row_num BIGINT
    , filepath VARCHAR[]
    , filename VARCHAR
    , msg_dt DATE
    , ChangeTimestamp TIMESTAMP
    , Components STRUCT(ComponentNumber VARCHAR, Quantity VARCHAR, UnitOfMeasure VARCHAR, Scrap VARCHAR, BomPosition VARCHAR, IssueingStorageLoc VARCHAR, OperationNumberMat VARCHAR, ItemCategory VARCHAR, Backflush VARCHAR)[]
    , ChangeDate VARCHAR
    , Operations STRUCT(OperationNumber VARCHAR, MachineCode VARCHAR, SetupGroupCategory VARCHAR, ProcStartDate VARCHAR, ProcStartTime VARCHAR, EndDatOperation VARCHAR, EndTimeOperation VARCHAR, SetupTime VARCHAR, SetupTimeUOM VARCHAR)[]
    , PlantID VARCHAR
    , Unit VARCHAR
    , QuantityPlanned VARCHAR
    , ChangeTime VARCHAR
    , ArticleNumber VARCHAR
    , OrderNumber VARCHAR
    , OrderType VARCHAR
    , ReceivingStorageLoc VARCHAR
    , ProductionVersion VARCHAR
);

Query in SQLPlan causing the issue:

SET orders_wo_material = 
    select count(1)
    from loipro.data
    where ArticleNumber IS NULL
        or Components.list_filter(lambda x: x.ComponentNumber is NULL).length() = Components.length()
;
Actual behavior
[2026-01-04T11:37:10.849Z ERROR sqlpage::webserver::database::execute_queries] Parsing failed: SQLPage couldn't understand the SQL file. Please check for syntax errors on line 28:
        where ArticleNumber IS NULL
            or Components.list_filter(lambda x: x.ComponentNumber is NULL).length() = Components.length()
                                            ⬆️
    ;
    Caused by:
        0: sql parser error: Expected: ), found: x at Line: 28, Column: 42
        1: loipro/index.sql contains a syntax error preventing SQLPage from parsing and preparing its SQL statements.
[2026-01-04T11:37:10.849Z ERROR sqlpage::render] SQL error: Parsing failed: SQLPage couldn't understand the SQL file. Please check for syntax errors on line 28:
        where ArticleNumber IS NULL
            or Components.list_filter(lambda x: x.ComponentNumber is NULL).length() = Components.length()
                                            ⬆️
    ;
    Caused by:
        0: sql parser error: Expected: ), found: x at Line: 28, Column: 42
        1: loipro/index.sql contains a syntax error preventing SQLPage from parsing and preparing its SQL statements.
Screenshots
Image
Expected behavior

Expected a single (numeric) value to be returned and stored in the variable.

Version information
  • OS: macOS 26.2
  • Database: DuckDB v1.4.3 (Andium) d1dc88f950
  • ODBC: unixODBC 2.3.14
  • DuckDB ODBC driver version: 1.4.3.0
  • SQLPage Version : sqlpage 0.41.0
主要語言
Rust
星號
2.6k
分支
175
平均合併
14 小時 16 分鐘
30 天內合併 PR
43

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

sqlpage/SQLPage 的其他 Issue

查看 sqlpage/SQLPage 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。