Hi All, I’ve put the minimal requirements and golden SQL tests in a tiny repo:
* Repo/branch: DotKBoy-web/acbp-calcite-tests, branch calcite-swap * How to run: mvn -DskipTests=false test (4 hand-printer tests + 4 Calcite-backed tests) * The Calcite path uses RelBuilder → RelToSqlConverter → SqlDialect; outputs match the goldens modulo harmless formatting (identifier quotes, col AS col, and optional WHEN (...) parens). Tests normalize only those diffs. I’d love guidance on a few specific knobs / best practices so I can drop most normalization and keep goldens stable: 1. Minimal quoting How do I configure RelToSqlConverter / SqlPrettyWriter / dialect to avoid quote-all and emit unquoted identifiers where legal, only quoting when required? 2. Suppress identity aliases Can I disable redundant aliases like SELECT code AS code (also inside subqueries) via a public flag/hook? If not, where’s the preferred extension point to add one? 3. WHEN parentheses policy What’s the recommended way to get WHEN a AND b THEN ... instead of WHEN (a AND b) THEN ... when precedence makes parens unnecessary? 4. Time-window idioms per dialect What’s the canonical Calcite construction to unparse exactly these forms? * PostgreSQL: now() - interval 'N days' * BigQuery: TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL N DAY) * ClickHouse: now() - INTERVAL N DAY 5. Dialect settings for BigQuery & ClickHouse Are BigQuerySqlDialect and ClickHouseSqlDialect the right choices for these idioms, and are there recommended writer/converter configs to match the styles above (esp. quoting & aliasing)? Any known limitations I should lock down with tests? 6. Golden stability Which writer/converter options are most stable across Calcite versions? If absolute stability isn’t guaranteed, what normalization policy aligns best with Calcite’s formatting choices? 7. If no public knobs exist Would a small PR adding opt-in flags (e.g., minimal-quoting, suppress-self-alias, minimal-parens) be welcome? If so, should they live on SqlWriterConfig, RelToSqlConverter.Config, or per-dialect overrides? Pointers to examples or tests in Calcite that demonstrate these behaviors would be perfect. I’m happy to turn any edge we hit into a focused failing test (one per dialect) or contribute the needed hooks. Thanks! —Muteb (DotK)