PROJECT x, y TO map is documented but rejected with "Unknown coord type: map"

Aperta
#589 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start with parse_coord_system in src/parser/builder.rs, where the accepted coord names are matched, and with the example in doc/syntax/coord/crs.qmd. Reproduce by running validate() on the PROJECT x, y TO map query from the issue. Done means either map parses to the generic map coord or the doc example uses TO crs or TO geographic and still validates. The issue lists two options and does not say which is preferred, so confirm with a maintainer before choosing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

documentation
Problem

The map coordinate system documentation (doc/syntax/coord/crs.qmd, titled "Map") shows position-aesthetic renaming like this:

PROJECT x, y TO map

but the parser doesn't recognize map as a coordinate system:

Parse error: Unknown coord type: map
Reproduce (Rust only, no database needed)
use ggsql::validate::validate;

fn main() {
    let v = validate(
        "SELECT x, y FROM pts VISUALISE DRAW point MAPPING x, y PROJECT x, y TO map"
    ).unwrap();
    for e in v.errors() {
        println!("{}", e.message);
    }
    // Parse error: Unknown coord type: map
}

(Any entry point hits this — it's a parse error, so execute() fails identically.)

Details

parse_coord_system in src/parser/builder.rs accepts cartesian, polar, crs, and the named projections — but not map, even though the map coord is constructed internally via Coord::map(...):

match name {
    Some("cartesian") | None => Ok(Coord::cartesian()),
    Some("polar") => Ok(Coord::polar()),
    Some("crs") => Ok(Coord::map("crs", properties)),
    Some(n) if NAMED_PROJECTIONS.contains(&n) => Ok(Coord::map(n, properties)),
    Some(n) => Err(GgsqlError::ParseError(format!("Unknown coord type: {}", n))),
}

Verified working alternatives today: PROJECT x, y TO crs and PROJECT x, y TO geographic.

Resolution options
  1. Accept map as an alias for the generic map coordinate system — e.g. Some("map") => Ok(Coord::map("crs", properties)) — matching the docs; or
  2. Fix doc/syntax/coord/crs.qmd to use TO crs (or TO geographic) in the aesthetic-renaming example.

Found while probing validate() coverage of map query patterns in the context of #587.

Lingua principale
Rust
Stelle
573
Fork
32
Merge medio
8g 23h
PR unite (30g)
5

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di posit-dev/ggsql

Tutte le issue di posit-dev/ggsql

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.