// gen_real_queries — pull N rows from fill_events.parquet and translate // each into a coordinator-style natural-language query. // // Output: one query per line, written to stdout (intended for redirect // into tests/reality/real_coord_queries.txt and then fed to // scripts/playbook_lift.sh as --queries=). // // Why: the lift harness's standard query corpus is hand-crafted to // stress multi-constraint matching. Real coordinator demand has a // different distribution — single-role, single-geo, count + time — // and we want to probe whether the substrate handles that shape too. // The fill_events parquet on the Rust side is the closest thing to // "real demand" we have on disk (123 rows, sourced from staffing // fixture generation but shaped like genuine fills). package main import ( "context" "flag" "fmt" "log" "github.com/apache/arrow-go/v18/arrow/memory" "github.com/apache/arrow-go/v18/parquet/file" "github.com/apache/arrow-go/v18/parquet/pqarrow" ) func main() { src := flag.String("src", "/home/profit/lakehouse/data/datasets/fill_events.parquet", "fill_events parquet path") limit := flag.Int("limit", 10, "number of queries to generate") flag.Parse() r, err := file.OpenParquetFile(*src, false) if err != nil { log.Fatalf("open %s: %v", *src, err) } defer r.Close() pr, err := pqarrow.NewFileReader(r, pqarrow.ArrowReadProperties{}, memory.DefaultAllocator) if err != nil { log.Fatalf("pqarrow reader: %v", err) } tbl, err := pr.ReadTable(context.Background()) if err != nil { log.Fatalf("read table: %v", err) } defer tbl.Release() // Field order must match parquet schema (see scripts/cutover dev probe): // 3=client, 5=city, 6=state, 7=role, 8=count, 10=at, 12=deadline. client := tbl.Column(3).Data().Chunk(0) city := tbl.Column(5).Data().Chunk(0) state := tbl.Column(6).Data().Chunk(0) role := tbl.Column(7).Data().Chunk(0) count := tbl.Column(8).Data().Chunk(0) at := tbl.Column(10).Data().Chunk(0) deadline := tbl.Column(12).Data().Chunk(0) n := int(tbl.NumRows()) if *limit < n { n = *limit } fmt.Println("# Real-shape coordinator queries — generated from fill_events.parquet") fmt.Println("# (real-shape demand data; queries built mechanically from event rows).") fmt.Printf("# Source: %s (%d rows total, %d emitted)\n", *src, tbl.NumRows(), n) fmt.Println("#") fmt.Println("# Format: client + count + role + city/state + start time +") fmt.Println("# (optional deadline). Mimics the natural language a coordinator would") fmt.Println("# type into a dispatch tool when triaging the next-up demand.") fmt.Println() for i := 0; i < n; i++ { c := client.ValueStr(i) cy := city.ValueStr(i) st := state.ValueStr(i) ro := role.ValueStr(i) ct := count.ValueStr(i) t := at.ValueStr(i) dl := deadline.ValueStr(i) // Phrase one is the urgent ask; phrase two is the natural rephrase // a coordinator might use when typing fast. Different syntax, // same intent — exercises the embedder's paraphrase tolerance. q := fmt.Sprintf("Need %s %s in %s %s starting at %s for %s", ct, pluralize(ro, ct), cy, st, t, c) if dl != "" && dl != "(null)" { q += fmt.Sprintf(", deadline %s", dl) } fmt.Println(q) } } func pluralize(role, count string) string { if count == "1" { return role } // "Warehouse Associate" → "Warehouse Associates"; "Loader" → "Loaders". // Naive but fits the staffing-domain vocabulary in fill_events. return role + "s" }