vectrojs 0.0.0-stage → 0.1.0

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/LICENSE +21 -0
  3. package/README.md +822 -2
  4. package/bin/vectro.mjs +82 -0
  5. package/dist/vectro.wasm +0 -0
  6. package/mcp/server.mjs +288 -0
  7. package/package.json +91 -4
  8. package/src/arrow.mjs +905 -0
  9. package/src/bitpack.mjs +135 -0
  10. package/src/browser.mjs +129 -0
  11. package/src/bytes.mjs +60 -0
  12. package/src/csv-kernel.mjs +205 -0
  13. package/src/csv.mjs +270 -0
  14. package/src/dataset.mjs +1763 -0
  15. package/src/dates.mjs +139 -0
  16. package/src/emitter.mjs +109 -0
  17. package/src/engine.mjs +881 -0
  18. package/src/files-browser.mjs +104 -0
  19. package/src/files-node.mjs +59 -0
  20. package/src/frames.mjs +191 -0
  21. package/src/fuse.mjs +512 -0
  22. package/src/interp.mjs +305 -0
  23. package/src/join.mjs +534 -0
  24. package/src/kernels.mjs +312 -0
  25. package/src/ndjson.mjs +136 -0
  26. package/src/node.mjs +120 -0
  27. package/src/pack.mjs +114 -0
  28. package/src/parallel-sort.mjs +99 -0
  29. package/src/partition-kernels.mjs +388 -0
  30. package/src/partition.mjs +395 -0
  31. package/src/plan.mjs +551 -0
  32. package/src/portable.mjs +21 -0
  33. package/src/rank-kernels.mjs +81 -0
  34. package/src/rows.mjs +91 -0
  35. package/src/serve/catalog.mjs +148 -0
  36. package/src/serve/flight.mjs +270 -0
  37. package/src/serve/formats.mjs +87 -0
  38. package/src/serve/http.mjs +182 -0
  39. package/src/serve/index.mjs +9 -0
  40. package/src/serve/odata.mjs +291 -0
  41. package/src/serve/pg.mjs +588 -0
  42. package/src/serve/pgcatalog.mjs +220 -0
  43. package/src/serve/pgtypes.mjs +199 -0
  44. package/src/sketch.mjs +75 -0
  45. package/src/sort-kernels.mjs +117 -0
  46. package/src/sort.mjs +102 -0
  47. package/src/split-worker-core.mjs +252 -0
  48. package/src/split-worker-node.mjs +8 -0
  49. package/src/split-worker.mjs +7 -0
  50. package/src/split.mjs +741 -0
  51. package/src/sql.mjs +1558 -0
  52. package/src/sqltext.mjs +132 -0
  53. package/src/static-kernels.mjs +164 -0
  54. package/src/stream-worker.mjs +553 -0
  55. package/src/table-kernels.mjs +323 -0
  56. package/src/table.mjs +2206 -0
  57. package/src/textmap.mjs +159 -0
  58. package/src/vectors.mjs +138 -0
  59. package/src/wasm.mjs +254 -0
  60. package/src/window.mjs +160 -0
  61. package/src/worker-browser.mjs +21 -0
  62. package/src/worker-loop.mjs +106 -0
  63. package/src/worker.mjs +22 -0
  64. package/src/zones.mjs +75 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (first release)
4
+
5
+ The first public release. Everything below is new.
6
+
7
+ **Engine**
8
+ - Columnar tables in engine memory; expressions compiled into fused SIMD
9
+ WebAssembly loops and run on every CPU core (Node worker threads, Web
10
+ Workers on cross-origin-isolated pages), one thread elsewhere, and a
11
+ vectorized interpreter where code generation isn't allowed (Cloudflare Workers).
12
+ - Filters, computed columns, aggregates, group by any keys (millions of
13
+ groups: partitioned by key range on every thread, sorted by key), exact and
14
+ approximate distinct counts, joins (inner, left, right, full), sort and
15
+ top-k, zone maps, compressed columns. Top-k over a file reads only the
16
+ blocks that can still hold a winning row.
17
+ - A query planner: `table.lazy()` chains are optimized as a whole.
18
+ - CSV (parallel parser), JSON lines, Apache Arrow (read and write).
19
+ - Datasets bigger than memory (`.vectro` files): chunked, bit-packed, read in
20
+ parallel; group-by, joins and sorts spill to disk; in browsers too.
21
+ - Streams (CSV, JSON lines, WebSocket feeds) with running windows.
22
+ - Vector search (cosine / dot / L2, exact top-k).
23
+
24
+ **SQL**
25
+ - `sql(text, tables)`: joins, subqueries (IN, EXISTS, correlated), CTEs,
26
+ UNION / INTERSECT / EXCEPT, window functions, percentiles, text functions,
27
+ dates and intervals. 40 queries checked against DuckDB give the same answers.
28
+ - Shortcuts for common shapes: only the rows that can rank in the first k for
29
+ `ROW_NUMBER() / RANK() ... <= k`; distinct counts of IDs with a byte map;
30
+ medians from bucket counts; CASE with quoted labels as label codes.
31
+
32
+ **Serving** (beta)
33
+ - `vectro serve`: SQL over HTTP (JSON, CSV, Arrow) and an OData v4 feed;
34
+ the PostgreSQL wire protocol (Power BI, Tableau, Metabase, Grafana, psql);
35
+ Arrow Flight SQL (pandas, Polars, DuckDB through ADBC). Checked with
36
+ pgJDBC, Npgsql, Microsoft's OData libraries and the ADBC driver.
37
+ - An MCP server for AI assistants (`vectro-mcp`).
38
+
39
+ **Connectors** (experimental)
40
+ - `connectors/dist/Vectro.mez` for Power BI and `vectro.taco` for Tableau.
41
+ Not signed, not yet tried in the applications.
42
+
43
+ **Missing values**
44
+ - SQL uses three-valued logic for missing values: `NOT (x > 5)`, `x <> 5`,
45
+ `NOT IN`, `NOT BETWEEN`, `NOT LIKE` and `LIKE` drop rows where the value
46
+ is missing, as other databases do. Table expressions keep JavaScript's rules
47
+ (`x != 5` is true where x is missing).
48
+ - Blank text (`''`, the missing value of a text column) is not counted by
49
+ `count(x)`, `countDistinct(x)`, `approxDistinct(x)` or SQL's `COUNT`, on
50
+ tables, datasets and split tables.
51
+ - `null` in arrays and rows loads as missing (it used to load as 0); a `Date`
52
+ in `tableFromRows` makes a date column.
53
+ - Clear errors for a text param, for date columns in a `Float32Array` table
54
+ (times don't fit in float32) and for SQL on a split table.
55
+ - `readCSV(path, { compress: true })` packs the columns, as `parseCSV` does.
56
+
57
+ **Testing**
58
+ - `VECTRO_POISON=1` overwrites memory as it is freed, so code that reads an
59
+ array after freeing it gives wrong answers in tests (part of `test:all`).
60
+
61
+ **Known gaps**
62
+ - Slower than DuckDB on one shape measured: a join over a file on disk with
63
+ a GROUP BY on the joined table's columns (1.2-1.3x at 100M and 1B rows).
64
+ Faster on all 20 SQL queries measured, on every group-by, join and
65
+ distinct count measured in memory, and on 7 of 8 queries over a billion
66
+ rows on disk (see the README's numbers).
67
+ - Free-text columns (text that rarely repeats) can be shown but not grouped
68
+ or filtered, except when served (`vectro serve` loads them as categories).
69
+ - Window functions and percentiles keep the rows they read in memory.
70
+ - An engine holds at most 4 GB in memory; tables are freed with `dispose()`.
71
+ - Integers are exact up to 2^53; times are UTC.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hamza Masood
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.