prepareFlightSQLDataSQL applies node query rewrites (tiered volumes + memory union) after Grafana/sqlrewrite.
(q string)
| 1044 | |
| 1045 | // prepareFlightSQLDataSQL applies node query rewrites (tiered volumes + memory union) after Grafana/sqlrewrite. |
| 1046 | func (n *Node) prepareFlightSQLDataSQL(q string) string { |
| 1047 | q = n.rewriteQueryForVolumes(q) |
| 1048 | mq := n.buildMemoryUnionQueries(q) |
| 1049 | if !mq.ok { |
| 1050 | return q |
| 1051 | } |
| 1052 | orderByClause, limitClause, baseSQL := extractOrderLimit(q) |
| 1053 | if shouldSplitLakeAndMem(q, baseSQL, orderByClause, limitClause) { |
| 1054 | // FlightSQL prepares a single SQL statement; for wide ranges avoid |
| 1055 | // the huge lake+mem UNION and keep a lake-only query. |
| 1056 | return q |
| 1057 | } |
| 1058 | return mq.combinedSQL |
| 1059 | } |
| 1060 | |
| 1061 | // duckLakeCatalogForQuery returns the DuckLake catalog name used in rewritten SQL FROM clauses. |
| 1062 | // When the node shares the writer's DuckDB (SetSharedDB in main.go), queries run on the writer |