explain-lpts

Document the LPTS pipeline converting DuckDB logical plans to CTE-based SQL strings.

8|1|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/cwida/lpts --skill explain-lpts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: explain-lpts
Source: https://github.com/cwida/lpts/tree/main/.claude/skills/explain-lpts
Command: npx skills add https://github.com/cwida/lpts --skill explain-lpts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill fills the gap for developers, data engineers, and DBAs working with DuckDB's LPTS extension by providing a single, comprehensive reference for the entire pipeline that transforms optimized logical query plans into equivalent CTE-based SQL strings, eliminating the need to parse source code to understand conversion logic, AST structures, and operator handling.

Core Features & Use Cases

  • Full Pipeline Documentation: Covers all three phases of the LPTS pipeline: LogicalPlan to AST, AST to CTE List, and CTE List to SQL string, with function signatures and implementation details for each phase.
  • Complete Structural References: Includes full hierarchies for AST nodes and CTE nodes, column binding map rules, and expression resolution logic for all supported expression types.
  • Operator-Specific Conversion Guides: Details extraction and conversion logic for every supported logical operator (scans, filters, projections, aggregates, joins, unions, etc.) plus dialect-specific formatting differences for DuckDB, Postgres, and other supported SQL dialects.
  • Use Case: A developer extending LPTS to support a new SQL dialect can use this reference to identify all dialect-specific formatting rules, while a data engineer debugging a transpiled query can trace how a specific logical filter operator is converted to a CTE WHERE clause.

Quick Start

Consult the explain-lpts skill to look up the AST node structure and conversion logic for a LOGICAL_COMPARISON_JOIN operator when implementing custom join handling for a new SQL dialect.

Frequently Asked Questions about explain-lpts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does DuckDB logical plan to SQL transpilation work?

The LPTS pipeline converts DuckDB post-optimizer logical plans into equivalent CTE-based SQL strings by transforming logical plans to AST nodes, then to a CTE list, and finally to a formatted SQL string for transpilation and inspection.

How do I convert DuckDB logical operators to CTE clauses?

You convert DuckDB logical operators to CTE clauses by applying operator-specific extraction logic for scans, filters, projections, aggregates, and unions, mapping each operator to a CTE node structure with resolved column bindings.

Does DuckDB LPTS support SQL dialect formatting for Postgres?

Yes, DuckDB LPTS supports Postgres alongside DuckDB, applying dialect-specific SQL formatting rules during the CTE List to SQL string conversion phase to ensure correct transpilation output.

How do I trace column binding resolution in DuckDB query plans?

You trace column binding resolution in DuckDB query plans by consulting the LPTS reference for column binding map rules and expression resolution logic that map logical plan bindings to CTE output columns.

What is the AST node hierarchy for DuckDB logical plan conversion?

The AST node hierarchy for DuckDB logical plan conversion is a structural reference detailing how logical operators are parsed into abstract syntax tree nodes before CTE list generation and final SQL string formatting.

Can I extend LPTS to support a new SQL dialect for query transpilation?

Yes, you can extend LPTS to support a new SQL dialect by referencing its dialect-specific formatting rules and operator conversion logic to implement custom SQL string generation from the CTE list.