@rocicorp/zero 0.24.2025102200 → 0.25.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/{chunk-PIXC6O7W.js → chunk-55BOUNXO.js} +3 -3
- package/out/chunk-55BOUNXO.js.map +7 -0
- package/out/{chunk-JS2ABYXG.js → chunk-AIPM77UE.js} +2762 -674
- package/out/chunk-AIPM77UE.js.map +7 -0
- package/out/{chunk-VHLCXJ6Q.js → chunk-TJFNGO7E.js} +4 -2
- package/out/{chunk-VHLCXJ6Q.js.map → chunk-TJFNGO7E.js.map} +2 -2
- package/out/{lazy-inspector-NCBESZMS.js → lazy-inspector-OXIFYSSQ.js} +2 -2
- package/out/react.js +16 -4
- package/out/react.js.map +4 -4
- package/out/replicache/src/dag/lazy-store.d.ts +1 -1
- package/out/replicache/src/dag/lazy-store.d.ts.map +1 -1
- package/out/replicache/src/log-options.d.ts +1 -1
- package/out/replicache/src/log-options.d.ts.map +1 -1
- package/out/replicache/src/persist/collect-idb-databases.d.ts +3 -3
- package/out/replicache/src/persist/collect-idb-databases.d.ts.map +1 -1
- package/out/replicache/src/replicache-options.d.ts +1 -1
- package/out/replicache/src/replicache-options.d.ts.map +1 -1
- package/out/shared/src/options.d.ts +1 -1
- package/out/shared/src/options.d.ts.map +1 -1
- package/out/shared/src/promise-race.d.ts +17 -0
- package/out/shared/src/promise-race.d.ts.map +1 -0
- package/out/solid.js +19 -6
- package/out/solid.js.map +4 -4
- package/out/z2s/src/compiler.d.ts +1 -1
- package/out/z2s/src/compiler.d.ts.map +1 -1
- package/out/z2s/src/compiler.js +1 -1
- package/out/z2s/src/compiler.js.map +1 -1
- package/out/z2s/src/sql.d.ts.map +1 -1
- package/out/z2s/src/sql.js +1 -1
- package/out/z2s/src/sql.js.map +1 -1
- package/out/zero/package.json +5 -4
- package/out/zero-cache/src/config/zero-config.d.ts +12 -0
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +36 -0
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/custom/fetch.d.ts +3 -1
- package/out/zero-cache/src/custom/fetch.d.ts.map +1 -1
- package/out/zero-cache/src/custom/fetch.js +101 -24
- package/out/zero-cache/src/custom/fetch.js.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.d.ts +2 -6
- package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.js +42 -41
- package/out/zero-cache/src/custom-queries/transform-query.js.map +1 -1
- package/out/zero-cache/src/db/create.d.ts +4 -0
- package/out/zero-cache/src/db/create.d.ts.map +1 -1
- package/out/zero-cache/src/db/create.js +7 -9
- package/out/zero-cache/src/db/create.js.map +1 -1
- package/out/zero-cache/src/db/lite-tables.d.ts.map +1 -1
- package/out/zero-cache/src/db/lite-tables.js +38 -17
- package/out/zero-cache/src/db/lite-tables.js.map +1 -1
- package/out/zero-cache/src/db/pg-to-lite.d.ts.map +1 -1
- package/out/zero-cache/src/db/pg-to-lite.js +7 -6
- package/out/zero-cache/src/db/pg-to-lite.js.map +1 -1
- package/out/zero-cache/src/db/specs.d.ts +24 -19
- package/out/zero-cache/src/db/specs.d.ts.map +1 -1
- package/out/zero-cache/src/db/specs.js.map +1 -1
- package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
- package/out/zero-cache/src/server/change-streamer.js +1 -1
- package/out/zero-cache/src/server/change-streamer.js.map +1 -1
- package/out/zero-cache/src/server/inspector-delegate.d.ts.map +1 -1
- package/out/zero-cache/src/server/inspector-delegate.js +5 -1
- package/out/zero-cache/src/server/inspector-delegate.js.map +1 -1
- package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/server/syncer.js +1 -1
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/services/change-source/column-metadata.d.ts +65 -0
- package/out/zero-cache/src/services/change-source/column-metadata.d.ts.map +1 -0
- package/out/zero-cache/src/services/change-source/column-metadata.js +198 -0
- package/out/zero-cache/src/services/change-source/column-metadata.js.map +1 -0
- package/out/zero-cache/src/services/change-source/pg/change-source.js +1 -0
- package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.d.ts +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.js +1 -1
- package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.d.ts +25 -25
- package/out/zero-cache/src/services/change-source/pg/schema/published.d.ts +10 -10
- package/out/zero-cache/src/services/change-source/pg/schema/shard.d.ts +5 -5
- package/out/zero-cache/src/services/change-source/protocol/current/data.d.ts +16 -16
- package/out/zero-cache/src/services/change-source/protocol/current/downstream.d.ts +24 -24
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +2 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +18 -2
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts +8 -8
- package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js +9 -7
- package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.d.ts +4 -4
- package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js +74 -56
- package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.d.ts +3 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.js +10 -6
- package/out/zero-cache/src/services/view-syncer/client-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-schema.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-schema.js +7 -4
- package/out/zero-cache/src/services/view-syncer/client-schema.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +4 -4
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.js +15 -6
- package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +4 -2
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/key-columns.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/key-columns.js +4 -2
- package/out/zero-cache/src/services/view-syncer/key-columns.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +2 -2
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js +57 -27
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts +11 -6
- package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/snapshotter.js +34 -22
- package/out/zero-cache/src/services/view-syncer/snapshotter.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +4 -4
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +111 -51
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/types/error-with-level.d.ts +9 -0
- package/out/zero-cache/src/types/error-with-level.d.ts.map +1 -0
- package/out/zero-cache/src/types/error-with-level.js +24 -0
- package/out/zero-cache/src/types/error-with-level.js.map +1 -0
- package/out/zero-cache/src/types/lite.d.ts +15 -13
- package/out/zero-cache/src/types/lite.d.ts.map +1 -1
- package/out/zero-cache/src/types/lite.js +17 -5
- package/out/zero-cache/src/types/lite.js.map +1 -1
- package/out/zero-cache/src/types/pg-data-type.d.ts +73 -0
- package/out/zero-cache/src/types/pg-data-type.d.ts.map +1 -0
- package/out/zero-cache/src/types/pg-data-type.js +76 -0
- package/out/zero-cache/src/types/pg-data-type.js.map +1 -0
- package/out/zero-cache/src/types/pg.d.ts +1 -73
- package/out/zero-cache/src/types/pg.d.ts.map +1 -1
- package/out/zero-cache/src/types/pg.js +0 -77
- package/out/zero-cache/src/types/pg.js.map +1 -1
- package/out/zero-cache/src/types/processes.d.ts +1 -1
- package/out/zero-cache/src/types/processes.d.ts.map +1 -1
- package/out/zero-cache/src/types/processes.js.map +1 -1
- package/out/zero-cache/src/types/schema-versions.d.ts +7 -3
- package/out/zero-cache/src/types/schema-versions.d.ts.map +1 -1
- package/out/zero-cache/src/types/schema-versions.js +7 -5
- package/out/zero-cache/src/types/schema-versions.js.map +1 -1
- package/out/zero-cache/src/types/subscription.d.ts +1 -1
- package/out/zero-cache/src/types/subscription.js +1 -1
- package/out/zero-cache/src/types/websocket-handoff.d.ts +3 -3
- package/out/zero-cache/src/types/websocket-handoff.d.ts.map +1 -1
- package/out/zero-cache/src/types/websocket-handoff.js +6 -4
- package/out/zero-cache/src/types/websocket-handoff.js.map +1 -1
- package/out/zero-cache/src/workers/connection.d.ts +6 -1
- package/out/zero-cache/src/workers/connection.d.ts.map +1 -1
- package/out/zero-cache/src/workers/connection.js +26 -9
- package/out/zero-cache/src/workers/connection.js.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js +7 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
- package/out/zero-cache/src/workers/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/workers/syncer.js +21 -1
- package/out/zero-cache/src/workers/syncer.js.map +1 -1
- package/out/zero-client/src/client/client-error-kind-enum.d.ts +27 -0
- package/out/zero-client/src/client/client-error-kind-enum.d.ts.map +1 -0
- package/out/zero-client/src/client/client-error-kind.d.ts +5 -0
- package/out/zero-client/src/client/client-error-kind.d.ts.map +1 -0
- package/out/zero-client/src/client/connection-manager.d.ts +138 -0
- package/out/zero-client/src/client/connection-manager.d.ts.map +1 -0
- package/out/zero-client/src/client/connection-status-enum.d.ts +11 -0
- package/out/zero-client/src/client/connection-status-enum.d.ts.map +1 -0
- package/out/zero-client/src/client/connection-status.d.ts +5 -0
- package/out/zero-client/src/client/connection-status.d.ts.map +1 -0
- package/out/zero-client/src/client/connection.d.ts +45 -0
- package/out/zero-client/src/client/connection.d.ts.map +1 -0
- package/out/zero-client/src/client/crud.d.ts.map +1 -1
- package/out/zero-client/src/client/error.d.ts +192 -0
- package/out/zero-client/src/client/error.d.ts.map +1 -0
- package/out/zero-client/src/client/ivm-branch.d.ts +2 -2
- package/out/zero-client/src/client/ivm-branch.d.ts.map +1 -1
- package/out/zero-client/src/client/metric-name.d.ts +5 -0
- package/out/zero-client/src/client/metric-name.d.ts.map +1 -0
- package/out/zero-client/src/client/metrics.d.ts +12 -9
- package/out/zero-client/src/client/metrics.d.ts.map +1 -1
- package/out/zero-client/src/client/mutation-tracker.d.ts +5 -4
- package/out/zero-client/src/client/mutation-tracker.d.ts.map +1 -1
- package/out/zero-client/src/client/options.d.ts +6 -2
- package/out/zero-client/src/client/options.d.ts.map +1 -1
- package/out/zero-client/src/client/query-manager.d.ts +5 -4
- package/out/zero-client/src/client/query-manager.d.ts.map +1 -1
- package/out/zero-client/src/client/zero-rep.d.ts +1 -1
- package/out/zero-client/src/client/zero-rep.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.d.ts +55 -11
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/mod.d.ts +9 -1
- package/out/zero-client/src/mod.d.ts.map +1 -1
- package/out/zero-protocol/src/ast.d.ts +2 -0
- package/out/zero-protocol/src/ast.d.ts.map +1 -1
- package/out/zero-protocol/src/ast.js +1 -0
- package/out/zero-protocol/src/ast.js.map +1 -1
- package/out/zero-protocol/src/custom-queries.d.ts +75 -4
- package/out/zero-protocol/src/custom-queries.d.ts.map +1 -1
- package/out/zero-protocol/src/custom-queries.js +18 -1
- package/out/zero-protocol/src/custom-queries.js.map +1 -1
- package/out/zero-protocol/src/down.d.ts +1 -1
- package/out/zero-protocol/src/error-kind-enum.d.ts +65 -0
- package/out/zero-protocol/src/error-kind-enum.d.ts.map +1 -1
- package/out/zero-protocol/src/error-kind-enum.js +2 -0
- package/out/zero-protocol/src/error-kind-enum.js.map +1 -1
- package/out/zero-protocol/src/error-origin-enum.d.ts +7 -0
- package/out/zero-protocol/src/error-origin-enum.d.ts.map +1 -0
- package/out/zero-protocol/src/error-origin-enum.js +4 -0
- package/out/zero-protocol/src/error-origin-enum.js.map +1 -0
- package/out/zero-protocol/src/error-origin.d.ts +5 -0
- package/out/zero-protocol/src/error-origin.d.ts.map +1 -0
- package/out/zero-protocol/src/error-origin.js +3 -0
- package/out/zero-protocol/src/error-origin.js.map +1 -0
- package/out/zero-protocol/src/error-reason-enum.d.ts +15 -0
- package/out/zero-protocol/src/error-reason-enum.d.ts.map +1 -0
- package/out/zero-protocol/src/error-reason-enum.js +8 -0
- package/out/zero-protocol/src/error-reason-enum.js.map +1 -0
- package/out/zero-protocol/src/error-reason.d.ts +5 -0
- package/out/zero-protocol/src/error-reason.d.ts.map +1 -0
- package/out/zero-protocol/src/error-reason.js +3 -0
- package/out/zero-protocol/src/error-reason.js.map +1 -0
- package/out/zero-protocol/src/error.d.ts +139 -1
- package/out/zero-protocol/src/error.d.ts.map +1 -1
- package/out/zero-protocol/src/error.js +64 -2
- package/out/zero-protocol/src/error.js.map +1 -1
- package/out/zero-protocol/src/mutation-id.d.ts +7 -0
- package/out/zero-protocol/src/mutation-id.d.ts.map +1 -0
- package/out/zero-protocol/src/mutation-id.js +6 -0
- package/out/zero-protocol/src/mutation-id.js.map +1 -0
- package/out/zero-protocol/src/mutations-patch.d.ts +3 -3
- package/out/zero-protocol/src/mutations-patch.d.ts.map +1 -1
- package/out/zero-protocol/src/mutations-patch.js +2 -1
- package/out/zero-protocol/src/mutations-patch.js.map +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
- package/out/zero-protocol/src/protocol-version.js +2 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/push.d.ts +138 -13
- package/out/zero-protocol/src/push.d.ts.map +1 -1
- package/out/zero-protocol/src/push.js +34 -13
- package/out/zero-protocol/src/push.js.map +1 -1
- package/out/zero-react/src/mod.d.ts +2 -1
- package/out/zero-react/src/mod.d.ts.map +1 -1
- package/out/zero-react/src/use-zero-connection-state.d.ts +9 -0
- package/out/zero-react/src/use-zero-connection-state.d.ts.map +1 -0
- package/out/zero-react/src/use-zero-online.d.ts +2 -0
- package/out/zero-react/src/use-zero-online.d.ts.map +1 -1
- package/out/zero-schema/src/builder/relationship-builder.d.ts +20 -18
- package/out/zero-schema/src/builder/relationship-builder.d.ts.map +1 -1
- package/out/zero-schema/src/builder/relationship-builder.js.map +1 -1
- package/out/zero-server/src/adapters/drizzle.d.ts +2 -3
- package/out/zero-server/src/adapters/drizzle.d.ts.map +1 -1
- package/out/zero-server/src/adapters/drizzle.js.map +1 -1
- package/out/zero-server/src/adapters/pg.d.ts +1 -0
- package/out/zero-server/src/adapters/pg.d.ts.map +1 -1
- package/out/zero-server/src/adapters/pg.js.map +1 -1
- package/out/zero-server/src/adapters/postgresjs.d.ts +1 -0
- package/out/zero-server/src/adapters/postgresjs.d.ts.map +1 -1
- package/out/zero-server/src/adapters/postgresjs.js.map +1 -1
- package/out/zero-server/src/process-mutations.d.ts +3 -3
- package/out/zero-server/src/process-mutations.d.ts.map +1 -1
- package/out/zero-server/src/process-mutations.js.map +1 -1
- package/out/zero-server/src/schema.js +1 -1
- package/out/zero-server/src/schema.js.map +1 -1
- package/out/zero-server/src/zql-database.d.ts +1 -1
- package/out/zero-server/src/zql-database.d.ts.map +1 -1
- package/out/zero-server/src/zql-database.js.map +1 -1
- package/out/zero-solid/src/mod.d.ts +3 -2
- package/out/zero-solid/src/mod.d.ts.map +1 -1
- package/out/zero-solid/src/use-zero-connection-state.d.ts +10 -0
- package/out/zero-solid/src/use-zero-connection-state.d.ts.map +1 -0
- package/out/zero-solid/src/use-zero-online.d.ts +1 -7
- package/out/zero-solid/src/use-zero-online.d.ts.map +1 -1
- package/out/zero.js +13 -3
- package/out/zql/src/builder/builder.d.ts +14 -1
- package/out/zql/src/builder/builder.d.ts.map +1 -1
- package/out/zql/src/builder/builder.js +33 -2
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/ivm/data.d.ts +1 -1
- package/out/zql/src/ivm/data.d.ts.map +1 -1
- package/out/zql/src/ivm/data.js.map +1 -1
- package/out/zql/src/ivm/filter-push.d.ts +1 -1
- package/out/zql/src/ivm/filter-push.d.ts.map +1 -1
- package/out/zql/src/ivm/filter-push.js.map +1 -1
- package/out/zql/src/ivm/memory-source.d.ts +5 -5
- package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
- package/out/zql/src/ivm/memory-source.js +0 -16
- package/out/zql/src/ivm/memory-source.js.map +1 -1
- package/out/zql/src/ivm/source.d.ts +2 -6
- package/out/zql/src/ivm/source.d.ts.map +1 -1
- package/out/zql/src/ivm/take.d.ts +1 -1
- package/out/zql/src/ivm/take.d.ts.map +1 -1
- package/out/zql/src/ivm/take.js.map +1 -1
- package/out/zql/src/planner/planner-builder.d.ts +14 -0
- package/out/zql/src/planner/planner-builder.d.ts.map +1 -0
- package/out/zql/src/planner/planner-builder.js +180 -0
- package/out/zql/src/planner/planner-builder.js.map +1 -0
- package/out/zql/src/planner/planner-connection.d.ts +119 -0
- package/out/zql/src/planner/planner-connection.d.ts.map +1 -0
- package/out/zql/src/planner/planner-connection.js +301 -0
- package/out/zql/src/planner/planner-connection.js.map +1 -0
- package/out/zql/src/planner/planner-constraint.d.ts +14 -0
- package/out/zql/src/planner/planner-constraint.d.ts.map +1 -0
- package/out/zql/src/planner/planner-constraint.js +12 -0
- package/out/zql/src/planner/planner-constraint.js.map +1 -0
- package/out/zql/src/planner/planner-debug.d.ts +118 -0
- package/out/zql/src/planner/planner-debug.d.ts.map +1 -0
- package/out/zql/src/planner/planner-debug.js +125 -0
- package/out/zql/src/planner/planner-debug.js.map +1 -0
- package/out/zql/src/planner/planner-fan-in.d.ts +37 -0
- package/out/zql/src/planner/planner-fan-in.d.ts.map +1 -0
- package/out/zql/src/planner/planner-fan-in.js +149 -0
- package/out/zql/src/planner/planner-fan-in.js.map +1 -0
- package/out/zql/src/planner/planner-fan-out.d.ts +21 -0
- package/out/zql/src/planner/planner-fan-out.d.ts.map +1 -0
- package/out/zql/src/planner/planner-fan-out.js +45 -0
- package/out/zql/src/planner/planner-fan-out.js.map +1 -0
- package/out/zql/src/planner/planner-graph.d.ts +103 -0
- package/out/zql/src/planner/planner-graph.d.ts.map +1 -0
- package/out/zql/src/planner/planner-graph.js +411 -0
- package/out/zql/src/planner/planner-graph.js.map +1 -0
- package/out/zql/src/planner/planner-join.d.ts +81 -0
- package/out/zql/src/planner/planner-join.d.ts.map +1 -0
- package/out/zql/src/planner/planner-join.js +246 -0
- package/out/zql/src/planner/planner-join.js.map +1 -0
- package/out/zql/src/planner/planner-node.d.ts +21 -0
- package/out/zql/src/planner/planner-node.d.ts.map +1 -0
- package/out/zql/src/planner/planner-node.js +2 -0
- package/out/zql/src/planner/planner-node.js.map +1 -0
- package/out/zql/src/planner/planner-source.d.ts +11 -0
- package/out/zql/src/planner/planner-source.d.ts.map +1 -0
- package/out/zql/src/planner/planner-source.js +13 -0
- package/out/zql/src/planner/planner-source.js.map +1 -0
- package/out/zql/src/planner/planner-terminus.d.ts +16 -0
- package/out/zql/src/planner/planner-terminus.d.ts.map +1 -0
- package/out/zql/src/planner/planner-terminus.js +28 -0
- package/out/zql/src/planner/planner-terminus.js.map +1 -0
- package/out/zql/src/query/expression.d.ts +2 -2
- package/out/zql/src/query/expression.d.ts.map +1 -1
- package/out/zql/src/query/expression.js.map +1 -1
- package/out/zql/src/query/query-delegate.d.ts +3 -3
- package/out/zql/src/query/query-delegate.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.d.ts +8 -8
- package/out/zql/src/query/query-impl.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.js +0 -6
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/out/zql/src/query/query.d.ts +3 -3
- package/out/zql/src/query/query.d.ts.map +1 -1
- package/out/zql/src/query/static-query.d.ts +1 -1
- package/out/zql/src/query/static-query.d.ts.map +1 -1
- package/out/zql/src/query/static-query.js.map +1 -1
- package/out/zql/src/query/typed-view.d.ts +1 -1
- package/out/zql/src/query/typed-view.d.ts.map +1 -1
- package/out/zqlite/src/query-delegate.d.ts +1 -1
- package/out/zqlite/src/query-delegate.d.ts.map +1 -1
- package/out/zqlite/src/query-delegate.js.map +1 -1
- package/out/zqlite/src/sqlite-cost-model.d.ts +17 -0
- package/out/zqlite/src/sqlite-cost-model.d.ts.map +1 -0
- package/out/zqlite/src/sqlite-cost-model.js +134 -0
- package/out/zqlite/src/sqlite-cost-model.js.map +1 -0
- package/out/zqlite/src/table-source.d.ts +4 -4
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +0 -16
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +5 -4
- package/out/chunk-JS2ABYXG.js.map +0 -7
- package/out/chunk-PIXC6O7W.js.map +0 -7
- package/out/zero-cache/src/types/error-for-client.d.ts +0 -23
- package/out/zero-cache/src/types/error-for-client.d.ts.map +0 -1
- package/out/zero-cache/src/types/error-for-client.js +0 -28
- package/out/zero-cache/src/types/error-for-client.js.map +0 -1
- package/out/zero-client/src/client/connection-state-enum.d.ts +0 -7
- package/out/zero-client/src/client/connection-state-enum.d.ts.map +0 -1
- package/out/zero-client/src/client/ping-result-enum.d.ts +0 -5
- package/out/zero-client/src/client/ping-result-enum.d.ts.map +0 -1
- package/out/zero-client/src/client/server-error.d.ts +0 -15
- package/out/zero-client/src/client/server-error.d.ts.map +0 -1
- package/out/zql/src/query/assert-no-not-exists.d.ts +0 -17
- package/out/zql/src/query/assert-no-not-exists.d.ts.map +0 -1
- package/out/zql/src/query/assert-no-not-exists.js +0 -40
- package/out/zql/src/query/assert-no-not-exists.js.map +0 -1
- /package/out/{lazy-inspector-NCBESZMS.js.map → lazy-inspector-OXIFYSSQ.js.map} +0 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { assert } from "../../../shared/src/asserts.js";
|
|
2
|
+
import { PlannerSource } from "./planner-source.js";
|
|
3
|
+
import { must } from "../../../shared/src/must.js";
|
|
4
|
+
/**
|
|
5
|
+
* Maximum number of flippable joins to attempt exhaustive enumeration.
|
|
6
|
+
* With n flippable joins, we explore 2^n plans.
|
|
7
|
+
* 10 joins = 1024 plans (~100-200ms), 12 joins = 4096 plans (~400ms - 1 second)
|
|
8
|
+
*/
|
|
9
|
+
const MAX_FLIPPABLE_JOINS = 13;
|
|
10
|
+
export class PlannerGraph {
|
|
11
|
+
// Sources indexed by table name
|
|
12
|
+
#sources = new Map();
|
|
13
|
+
// The final output node where constraint propagation starts
|
|
14
|
+
#terminus = undefined;
|
|
15
|
+
// Collections of nodes with mutable planning state
|
|
16
|
+
joins = [];
|
|
17
|
+
fanOuts = [];
|
|
18
|
+
fanIns = [];
|
|
19
|
+
connections = [];
|
|
20
|
+
/**
|
|
21
|
+
* Reset all planning state back to initial values for another planning pass.
|
|
22
|
+
* Resets only mutable planning state - graph structure is unchanged.
|
|
23
|
+
*
|
|
24
|
+
* This allows replanning the same query graph with different strategies.
|
|
25
|
+
*/
|
|
26
|
+
resetPlanningState() {
|
|
27
|
+
for (const j of this.joins)
|
|
28
|
+
j.reset();
|
|
29
|
+
for (const fo of this.fanOuts)
|
|
30
|
+
fo.reset();
|
|
31
|
+
for (const fi of this.fanIns)
|
|
32
|
+
fi.reset();
|
|
33
|
+
for (const c of this.connections)
|
|
34
|
+
c.reset();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create and register a source (table) in the graph.
|
|
38
|
+
*/
|
|
39
|
+
addSource(name, model) {
|
|
40
|
+
assert(!this.#sources.has(name), `Source ${name} already exists in the graph`);
|
|
41
|
+
const source = new PlannerSource(name, model);
|
|
42
|
+
this.#sources.set(name, source);
|
|
43
|
+
return source;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get a source by table name.
|
|
47
|
+
*/
|
|
48
|
+
getSource(name) {
|
|
49
|
+
const source = this.#sources.get(name);
|
|
50
|
+
assert(source !== undefined, `Source ${name} not found in the graph`);
|
|
51
|
+
return source;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Check if a source exists by table name.
|
|
55
|
+
*/
|
|
56
|
+
hasSource(name) {
|
|
57
|
+
return this.#sources.has(name);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Set the terminus (final output) node of the graph.
|
|
61
|
+
* Constraint propagation starts from this node.
|
|
62
|
+
*/
|
|
63
|
+
setTerminus(terminus) {
|
|
64
|
+
this.#terminus = terminus;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Initiate constraint propagation from the terminus node.
|
|
68
|
+
* This sends constraints up through the graph to update
|
|
69
|
+
* connection cost estimates.
|
|
70
|
+
*/
|
|
71
|
+
propagateConstraints() {
|
|
72
|
+
assert(this.#terminus !== undefined, 'Cannot propagate constraints without a terminus node');
|
|
73
|
+
this.#terminus.propagateConstraints();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Calculate total cost of the current plan.
|
|
77
|
+
* Total cost includes both startup cost (one-time, e.g., sorting) and running cost.
|
|
78
|
+
*/
|
|
79
|
+
getTotalCost() {
|
|
80
|
+
const estimate = must(this.#terminus).estimateCost();
|
|
81
|
+
return estimate.startupCost + estimate.runningCost;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Capture a lightweight snapshot of the current planning state.
|
|
85
|
+
* Used for backtracking during multi-start greedy search.
|
|
86
|
+
*
|
|
87
|
+
* Captures mutable state including pinned flags, join types, and
|
|
88
|
+
* constraint maps to avoid needing repropagation on restore.
|
|
89
|
+
*
|
|
90
|
+
* @returns A snapshot that can be restored via restorePlanningSnapshot()
|
|
91
|
+
*/
|
|
92
|
+
capturePlanningSnapshot() {
|
|
93
|
+
return {
|
|
94
|
+
connections: this.connections.map(c => ({
|
|
95
|
+
limit: c.limit,
|
|
96
|
+
})),
|
|
97
|
+
joins: this.joins.map(j => ({ type: j.type })),
|
|
98
|
+
fanOuts: this.fanOuts.map(fo => ({ type: fo.type })),
|
|
99
|
+
fanIns: this.fanIns.map(fi => ({ type: fi.type })),
|
|
100
|
+
connectionConstraints: this.connections.map(c => c.captureConstraints()),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Restore planning state from a previously captured snapshot.
|
|
105
|
+
* Used for backtracking when a planning attempt fails.
|
|
106
|
+
*
|
|
107
|
+
* Restores pinned flags, join types, and constraint maps, eliminating
|
|
108
|
+
* the need for repropagation.
|
|
109
|
+
*
|
|
110
|
+
* @param state - Snapshot created by capturePlanningSnapshot()
|
|
111
|
+
*/
|
|
112
|
+
restorePlanningSnapshot(state) {
|
|
113
|
+
this.#validateSnapshotShape(state);
|
|
114
|
+
this.#restoreConnections(state);
|
|
115
|
+
this.#restoreJoins(state);
|
|
116
|
+
this.#restoreFanNodes(state);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Collect cost estimates from all nodes in the graph for debugging.
|
|
120
|
+
*/
|
|
121
|
+
#collectNodeCosts() {
|
|
122
|
+
const costs = [];
|
|
123
|
+
// Collect connection costs
|
|
124
|
+
for (const c of this.connections) {
|
|
125
|
+
costs.push({
|
|
126
|
+
node: c.name,
|
|
127
|
+
nodeType: 'connection',
|
|
128
|
+
costEstimate: c.estimateCost(undefined),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
// Collect join costs
|
|
132
|
+
for (const j of this.joins) {
|
|
133
|
+
costs.push({
|
|
134
|
+
node: j.getName(),
|
|
135
|
+
nodeType: 'join',
|
|
136
|
+
costEstimate: j.estimateCost(undefined),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// Collect fan-out costs
|
|
140
|
+
for (const fo of this.fanOuts) {
|
|
141
|
+
costs.push({
|
|
142
|
+
node: 'FO',
|
|
143
|
+
nodeType: 'fan-out',
|
|
144
|
+
costEstimate: fo.estimateCost(undefined),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Collect fan-in costs
|
|
148
|
+
for (const fi of this.fanIns) {
|
|
149
|
+
costs.push({
|
|
150
|
+
node: 'FI',
|
|
151
|
+
nodeType: 'fan-in',
|
|
152
|
+
costEstimate: fi.estimateCost(undefined),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return costs;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Validate that snapshot shape matches current graph structure.
|
|
159
|
+
*/
|
|
160
|
+
#validateSnapshotShape(state) {
|
|
161
|
+
assert(this.connections.length === state.connections.length, 'Plan state mismatch: connections');
|
|
162
|
+
assert(this.joins.length === state.joins.length, 'Plan state mismatch: joins');
|
|
163
|
+
assert(this.fanOuts.length === state.fanOuts.length, 'Plan state mismatch: fanOuts');
|
|
164
|
+
assert(this.fanIns.length === state.fanIns.length, 'Plan state mismatch: fanIns');
|
|
165
|
+
assert(this.connections.length === state.connectionConstraints.length, 'Plan state mismatch: connectionConstraints');
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Restore connection pinned flags, limits, and constraint maps.
|
|
169
|
+
*/
|
|
170
|
+
#restoreConnections(state) {
|
|
171
|
+
for (let i = 0; i < this.connections.length; i++) {
|
|
172
|
+
this.connections[i].limit = state.connections[i].limit;
|
|
173
|
+
this.connections[i].restoreConstraints(state.connectionConstraints[i]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Restore join types and pinned flags.
|
|
178
|
+
*/
|
|
179
|
+
#restoreJoins(state) {
|
|
180
|
+
for (let i = 0; i < this.joins.length; i++) {
|
|
181
|
+
const join = this.joins[i];
|
|
182
|
+
const targetState = state.joins[i];
|
|
183
|
+
// Reset to initial state first
|
|
184
|
+
join.reset();
|
|
185
|
+
// Apply target state
|
|
186
|
+
if (targetState.type === 'flipped') {
|
|
187
|
+
join.flip();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Restore FanOut and FanIn types.
|
|
193
|
+
*/
|
|
194
|
+
#restoreFanNodes(state) {
|
|
195
|
+
for (let i = 0; i < this.fanOuts.length; i++) {
|
|
196
|
+
const fo = this.fanOuts[i];
|
|
197
|
+
const targetType = state.fanOuts[i].type;
|
|
198
|
+
if (targetType === 'UFO' && fo.type === 'FO') {
|
|
199
|
+
fo.convertToUFO();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
for (let i = 0; i < this.fanIns.length; i++) {
|
|
203
|
+
const fi = this.fanIns[i];
|
|
204
|
+
const targetType = state.fanIns[i].type;
|
|
205
|
+
if (targetType === 'UFI' && fi.type === 'FI') {
|
|
206
|
+
fi.convertToUFI();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Main planning algorithm using exhaustive join flip enumeration.
|
|
212
|
+
*
|
|
213
|
+
* Enumerates all possible flip patterns for flippable joins (2^n for n flippable joins).
|
|
214
|
+
* Each pattern represents a different query execution plan. We evaluate the cost of each
|
|
215
|
+
* plan and select the one with the lowest cost.
|
|
216
|
+
*
|
|
217
|
+
* Connections are used only for cost estimation - the flip patterns determine the plan.
|
|
218
|
+
* FanOut/FanIn states (FO/UFO and FI/UFI) are automatically derived from join flip states.
|
|
219
|
+
*
|
|
220
|
+
* @param planDebugger - Optional debugger to receive structured events during planning
|
|
221
|
+
*/
|
|
222
|
+
plan(planDebugger) {
|
|
223
|
+
// Get all flippable joins
|
|
224
|
+
const flippableJoins = this.joins.filter(j => j.isFlippable());
|
|
225
|
+
// Safety check: throw if too many flippable joins
|
|
226
|
+
if (flippableJoins.length > MAX_FLIPPABLE_JOINS) {
|
|
227
|
+
throw new Error(`Query has ${flippableJoins.length} EXISTS checks in a single RELATED call (or in the top level query), which would require ` +
|
|
228
|
+
`${2 ** flippableJoins.length} plan evaluations. This may be very slow. ` +
|
|
229
|
+
`Consider simplifying the query or increasing MAX_FLIPPABLE_JOINS (currently set to ${MAX_FLIPPABLE_JOINS}).`);
|
|
230
|
+
}
|
|
231
|
+
// Build FO→FI cache once to avoid redundant BFS traversals in each iteration
|
|
232
|
+
const fofiCache = buildFOFICache(this);
|
|
233
|
+
const numPatterns = 2 ** flippableJoins.length;
|
|
234
|
+
let bestCost = Infinity;
|
|
235
|
+
let bestPlan = undefined;
|
|
236
|
+
let bestAttemptNumber = -1;
|
|
237
|
+
// Enumerate all flip patterns
|
|
238
|
+
for (let pattern = 0; pattern < numPatterns; pattern++) {
|
|
239
|
+
// Reset to initial state
|
|
240
|
+
this.resetPlanningState();
|
|
241
|
+
if (planDebugger) {
|
|
242
|
+
planDebugger.log({
|
|
243
|
+
type: 'attempt-start',
|
|
244
|
+
attemptNumber: pattern,
|
|
245
|
+
totalAttempts: numPatterns,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
// Apply flip pattern (treat pattern as bitmask)
|
|
250
|
+
// Bit i set to 1 means flip join i
|
|
251
|
+
for (let i = 0; i < flippableJoins.length; i++) {
|
|
252
|
+
if (pattern & (1 << i)) {
|
|
253
|
+
flippableJoins[i].flip();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Derive FO/UFO and FI/UFI states from join flip states
|
|
257
|
+
checkAndConvertFOFI(fofiCache);
|
|
258
|
+
// Propagate unlimiting for flipped joins
|
|
259
|
+
propagateUnlimitForFlippedJoins(this);
|
|
260
|
+
// Propagate constraints through the graph
|
|
261
|
+
this.propagateConstraints();
|
|
262
|
+
if (planDebugger) {
|
|
263
|
+
planDebugger.log({
|
|
264
|
+
type: 'constraints-propagated',
|
|
265
|
+
attemptNumber: pattern,
|
|
266
|
+
connectionConstraints: this.connections.map(c => ({
|
|
267
|
+
connection: c.name,
|
|
268
|
+
constraints: c.getConstraintsForDebug(),
|
|
269
|
+
constraintCosts: c.getConstraintCostsForDebug(),
|
|
270
|
+
})),
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
// Evaluate this plan
|
|
274
|
+
const totalCost = this.getTotalCost();
|
|
275
|
+
if (planDebugger) {
|
|
276
|
+
planDebugger.log({
|
|
277
|
+
type: 'plan-complete',
|
|
278
|
+
attemptNumber: pattern,
|
|
279
|
+
totalCost,
|
|
280
|
+
nodeCosts: this.#collectNodeCosts(),
|
|
281
|
+
joinStates: this.joins.map(j => {
|
|
282
|
+
const info = j.getDebugInfo();
|
|
283
|
+
return {
|
|
284
|
+
join: info.name,
|
|
285
|
+
type: info.type,
|
|
286
|
+
};
|
|
287
|
+
}),
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
// Track best plan
|
|
291
|
+
if (totalCost < bestCost) {
|
|
292
|
+
bestCost = totalCost;
|
|
293
|
+
bestPlan = this.capturePlanningSnapshot();
|
|
294
|
+
bestAttemptNumber = pattern;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
catch (e) {
|
|
298
|
+
// This flip pattern is invalid (shouldn't happen with proper isFlippable() checks)
|
|
299
|
+
if (planDebugger) {
|
|
300
|
+
planDebugger.log({
|
|
301
|
+
type: 'plan-failed',
|
|
302
|
+
attemptNumber: pattern,
|
|
303
|
+
reason: `Flip pattern ${pattern.toString(2)} failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// Restore best plan
|
|
310
|
+
if (bestPlan) {
|
|
311
|
+
this.restorePlanningSnapshot(bestPlan);
|
|
312
|
+
// Propagate constraints to ensure all derived state is consistent
|
|
313
|
+
this.propagateConstraints();
|
|
314
|
+
if (planDebugger) {
|
|
315
|
+
planDebugger.log({
|
|
316
|
+
type: 'best-plan-selected',
|
|
317
|
+
bestAttemptNumber,
|
|
318
|
+
totalCost: bestCost,
|
|
319
|
+
joinStates: this.joins.map(j => ({
|
|
320
|
+
join: j.getName(),
|
|
321
|
+
type: j.type,
|
|
322
|
+
})),
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
// No valid plan found (all patterns failed)
|
|
328
|
+
throw new Error('No valid query plan found. This should not happen - check query structure.');
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Build cache of FO→FI relationships and joins between them.
|
|
334
|
+
* Called once at the start of planning to avoid redundant BFS traversals.
|
|
335
|
+
*/
|
|
336
|
+
function buildFOFICache(graph) {
|
|
337
|
+
const cache = new Map();
|
|
338
|
+
for (const fo of graph.fanOuts) {
|
|
339
|
+
const info = findFIAndJoins(fo);
|
|
340
|
+
cache.set(fo, info);
|
|
341
|
+
}
|
|
342
|
+
return cache;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Check if any joins downstream of a FanOut (before reaching FanIn) are flipped.
|
|
346
|
+
* If so, convert the FO to UFO and the FI to UFI.
|
|
347
|
+
*
|
|
348
|
+
* This must be called after join flipping and before propagateConstraints.
|
|
349
|
+
*/
|
|
350
|
+
function checkAndConvertFOFI(fofiCache) {
|
|
351
|
+
for (const [fo, info] of fofiCache) {
|
|
352
|
+
const hasFlippedJoin = info.joinsBetween.some(j => j.type === 'flipped');
|
|
353
|
+
if (info.fi && hasFlippedJoin) {
|
|
354
|
+
fo.convertToUFO();
|
|
355
|
+
info.fi.convertToUFI();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Traverse from a FanOut through its outputs to find the corresponding FanIn
|
|
361
|
+
* and collect all joins along the way.
|
|
362
|
+
*/
|
|
363
|
+
function findFIAndJoins(fo) {
|
|
364
|
+
const joinsBetween = [];
|
|
365
|
+
let fi = undefined;
|
|
366
|
+
// BFS through FO outputs to find FI and collect joins
|
|
367
|
+
const queue = [...fo.outputs];
|
|
368
|
+
const visited = new Set();
|
|
369
|
+
while (queue.length > 0) {
|
|
370
|
+
const node = must(queue.shift());
|
|
371
|
+
if (visited.has(node))
|
|
372
|
+
continue;
|
|
373
|
+
visited.add(node);
|
|
374
|
+
switch (node.kind) {
|
|
375
|
+
case 'join':
|
|
376
|
+
joinsBetween.push(node);
|
|
377
|
+
queue.push(node.output);
|
|
378
|
+
break;
|
|
379
|
+
case 'fan-out':
|
|
380
|
+
// Nested FO - traverse its outputs
|
|
381
|
+
queue.push(...node.outputs);
|
|
382
|
+
break;
|
|
383
|
+
case 'fan-in':
|
|
384
|
+
// Found the FI - this is the boundary, don't traverse further
|
|
385
|
+
fi = node;
|
|
386
|
+
break;
|
|
387
|
+
case 'connection':
|
|
388
|
+
// Shouldn't happen in a well-formed graph
|
|
389
|
+
break;
|
|
390
|
+
case 'terminus':
|
|
391
|
+
// Reached the end without finding FI
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return { fi, joinsBetween };
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Propagate unlimiting to all flipped joins in the graph.
|
|
399
|
+
* When a join is flipped, its child becomes the outer loop and should no longer
|
|
400
|
+
* be limited by EXISTS semantics.
|
|
401
|
+
*
|
|
402
|
+
* This must be called after join flipping and before propagateConstraints.
|
|
403
|
+
*/
|
|
404
|
+
function propagateUnlimitForFlippedJoins(graph) {
|
|
405
|
+
for (const join of graph.joins) {
|
|
406
|
+
if (join.type === 'flipped') {
|
|
407
|
+
join.propagateUnlimit();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=planner-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-graph.js","sourceRoot":"","sources":["../../../../../zql/src/planner/planner-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gCAAgC,CAAC;AAOtD,OAAO,EAAC,aAAa,EAA2B,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAC,IAAI,EAAC,MAAM,6BAA6B,CAAC;AAcjD;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAW/B,MAAM,OAAO,YAAY;IACvB,gCAAgC;IACvB,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;IAErD,4DAA4D;IAC5D,SAAS,GAAgC,SAAS,CAAC;IAEnD,mDAAmD;IACnD,KAAK,GAAkB,EAAE,CAAC;IAC1B,OAAO,GAAoB,EAAE,CAAC;IAC9B,MAAM,GAAmB,EAAE,CAAC;IAC5B,WAAW,GAAwB,EAAE,CAAC;IAEtC;;;;;OAKG;IACH,kBAAkB;QAChB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK;YAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QACtC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,OAAO;YAAE,EAAE,CAAC,KAAK,EAAE,CAAC;QAC1C,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,MAAM;YAAE,EAAE,CAAC,KAAK,EAAE,CAAC;QACzC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,WAAW;YAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IA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CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type PlannerConstraint } from './planner-constraint.ts';
|
|
2
|
+
import type { CostEstimate, JoinOrConnection, PlannerNode } from './planner-node.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a join between two data streams (parent and child).
|
|
5
|
+
*
|
|
6
|
+
* # Dual-State Pattern
|
|
7
|
+
* Like all planner nodes, PlannerJoin separates:
|
|
8
|
+
* 1. IMMUTABLE STRUCTURE: Parent/child nodes, constraints, flippability
|
|
9
|
+
* 2. MUTABLE STATE: Join type (semi/flipped), pinned status
|
|
10
|
+
*
|
|
11
|
+
* # Join Flipping
|
|
12
|
+
* A join can be in two states:
|
|
13
|
+
* - 'semi': Parent is outer loop, child is inner (semi-join for EXISTS)
|
|
14
|
+
* - 'flipped': Child is outer loop, parent is inner
|
|
15
|
+
*
|
|
16
|
+
* Flipping is the key optimization: choosing which table scans first.
|
|
17
|
+
* NOT EXISTS joins cannot be flipped (#flippable = false).
|
|
18
|
+
*
|
|
19
|
+
* # Constraint Propagation
|
|
20
|
+
* - Semi-join: Sends childConstraint to child, forwards received constraints to parent
|
|
21
|
+
* - Flipped join: Sends undefined to child, merges parentConstraint with received to parent
|
|
22
|
+
* - Unpinned join: Only forwards constraints to parent (doesn't constrain child yet)
|
|
23
|
+
*
|
|
24
|
+
* # Lifecycle
|
|
25
|
+
* 1. Construct with immutable structure (parent, child, constraints, flippability)
|
|
26
|
+
* 2. Wire to output node during graph construction
|
|
27
|
+
* 3. Planning calls flipIfNeeded() based on connection selection order
|
|
28
|
+
* 4. pin() locks the join type once chosen
|
|
29
|
+
* 5. reset() clears mutable state (type → 'semi', pinned → false)
|
|
30
|
+
*/
|
|
31
|
+
export declare class PlannerJoin {
|
|
32
|
+
#private;
|
|
33
|
+
readonly kind: "join";
|
|
34
|
+
readonly planId: number;
|
|
35
|
+
constructor(parent: PlannerNode, child: PlannerNode, parentConstraint: PlannerConstraint, childConstraint: PlannerConstraint, flippable: boolean, planId: number);
|
|
36
|
+
setOutput(node: PlannerNode): void;
|
|
37
|
+
get output(): PlannerNode;
|
|
38
|
+
closestJoinOrSource(): JoinOrConnection;
|
|
39
|
+
flipIfNeeded(input: PlannerNode): void;
|
|
40
|
+
flip(): void;
|
|
41
|
+
get type(): 'semi' | 'flipped';
|
|
42
|
+
isFlippable(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Propagate unlimiting through the child subgraph when this join is flipped.
|
|
45
|
+
* When a join is flipped, the child becomes the outer loop and should produce
|
|
46
|
+
* all rows rather than stopping at an EXISTS limit.
|
|
47
|
+
*
|
|
48
|
+
* Propagation rules:
|
|
49
|
+
* - Connection: call unlimit()
|
|
50
|
+
* - Semi-join: continue to parent (outer loop)
|
|
51
|
+
* - Flipped join: stop (already unlimited when it was flipped)
|
|
52
|
+
* - Fan-out/Fan-in: propagate to all inputs
|
|
53
|
+
*/
|
|
54
|
+
propagateUnlimit(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Called when a parent join is flipped and this join is part of its child subgraph.
|
|
57
|
+
* - Semi-join: continue propagation to parent (the outer loop)
|
|
58
|
+
* - Flipped join: stop propagation (already unlimited when it was flipped)
|
|
59
|
+
*/
|
|
60
|
+
propagateUnlimitFromFlippedJoin(): void;
|
|
61
|
+
propagateConstraints(branchPattern: number[], constraint: PlannerConstraint | undefined): void;
|
|
62
|
+
reset(): void;
|
|
63
|
+
estimateCost(branchPattern?: number[]): CostEstimate;
|
|
64
|
+
/**
|
|
65
|
+
* Get a human-readable name for this join for debugging.
|
|
66
|
+
* Format: "parentName ⋈ childName"
|
|
67
|
+
*/
|
|
68
|
+
getName(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Get debug information about this join's state.
|
|
71
|
+
*/
|
|
72
|
+
getDebugInfo(): {
|
|
73
|
+
name: string;
|
|
74
|
+
type: 'semi' | 'flipped';
|
|
75
|
+
planId: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export declare class UnflippableJoinError extends Error {
|
|
79
|
+
constructor(message: string);
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=planner-join.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-join.d.ts","sourceRoot":"","sources":["../../../../../zql/src/planner/planner-join.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAoB3B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,WAAW;;IACtB,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAU;IAOhC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAOtB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,WAAW,EAClB,gBAAgB,EAAE,iBAAiB,EACnC,eAAe,EAAE,iBAAiB,EAClC,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,MAAM;IAWhB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAIlC,IAAI,MAAM,IAAI,WAAW,CAGxB;IAED,mBAAmB,IAAI,gBAAgB;IAIvC,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAWtC,IAAI,IAAI,IAAI;IAUZ,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IACD,WAAW,IAAI,OAAO;IAItB;;;;;;;;;;OAUG;IACH,gBAAgB,IAAI,IAAI;IAKxB;;;;OAIG;IACH,+BAA+B,IAAI,IAAI;IAOvC,oBAAoB,CAClB,aAAa,EAAE,MAAM,EAAE,EACvB,UAAU,EAAE,iBAAiB,GAAG,SAAS,GACxC,IAAI;IA2BP,KAAK,IAAI,IAAI;IAIb,YAAY,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,YAAY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