diff --git a/embed/README.md b/embed/README.md index 46b3498..f653340 100644 --- a/embed/README.md +++ b/embed/README.md @@ -12,6 +12,7 @@ The following optional features are compiled in: - [soundex](https://sqlite.org/lang_corefunc.html#soundex) - [base64](https://github.com/sqlite/sqlite/blob/master/ext/misc/base64.c) - [decimal](https://github.com/sqlite/sqlite/blob/master/ext/misc/decimal.c) +- [ieee754](https://github.com/sqlite/sqlite/blob/master/ext/misc/ieee754.c) - [regexp](https://github.com/sqlite/sqlite/blob/master/ext/misc/regexp.c) - [series](https://github.com/sqlite/sqlite/blob/master/ext/misc/series.c) - [uint](https://github.com/sqlite/sqlite/blob/master/ext/misc/uint.c) diff --git a/embed/sqlite3.wasm b/embed/sqlite3.wasm index 8af604b..c5a61d9 100755 Binary files a/embed/sqlite3.wasm and b/embed/sqlite3.wasm differ diff --git a/ext/hash/hash.go b/ext/hash/hash.go index f814fbc..8f0656d 100644 --- a/ext/hash/hash.go +++ b/ext/hash/hash.go @@ -1,6 +1,6 @@ // Package hash provides cryptographic hash functions. // -// Functions: +// Provided functions: // - md4(data) // - md5(data) // - sha1(data) diff --git a/ext/stats/stats.go b/ext/stats/stats.go index bd10ff6..b819259 100644 --- a/ext/stats/stats.go +++ b/ext/stats/stats.go @@ -1,6 +1,6 @@ // Package stats provides aggregate functions for statistics. // -// Functions: +// Provided functions: // - stddev_pop: population standard deviation // - stddev_samp: sample standard deviation // - var_pop: population variance @@ -9,8 +9,16 @@ // - covar_samp: sample covariance // - corr: correlation coefficient // +// These join the [Built-in Aggregate Functions]: +// - count: count rows/values +// - sum: sum values +// - avg: average value +// - min: minimum value +// - max: maximum value +// // See: [ANSI SQL Aggregate Functions] // +// [Built-in Aggregate Functions]: https://sqlite.org/lang_aggfunc.html // [ANSI SQL Aggregate Functions]: https://www.oreilly.com/library/view/sql-in-a/9780596155322/ch04s02.html package stats diff --git a/ext/stats/todo.md b/ext/stats/todo.md new file mode 100644 index 0000000..f13249c --- /dev/null +++ b/ext/stats/todo.md @@ -0,0 +1,45 @@ +# ANSI SQL Aggregate Functions + +https://www.oreilly.com/library/view/sql-in-a/9780596155322/ch04s02.html + +## Built in + +- [x] `COUNT(*)` +- [x] `COUNT(expression)` +- [x] `SUM(expression)` +- [x] `AVG(expression)` +- [x] `MIN(expression)` +- [x] `MAX(expression)` + +https://sqlite.org/lang_aggfunc.html + +## Implemented + +- [x] `STDDEV_POP(expression)` +- [x] `STDDEV_SAMP(expression)` +- [x] `VAR_POP(expression)` +- [x] `VAR_SAMP(expression)` +- [x] `COVAR_POP(dependent, independent)` +- [x] `COVAR_SAMP(dependent, independent)` +- [x] `CORR(dependent, independent)` + +## Linear regression + +- [ ] `REGR_AVGX(dependent, independent)` +- [ ] `REGR_AVGY(dependent, independent)` +- [ ] `REGR_COUNT(dependent, independent)` +- [ ] `REGR_INTERCEPT(dependent, independent)` +- [ ] `REGR_R2(dependent, independent)` +- [ ] `REGR_SLOPE(dependent, independent)` +- [ ] `REGR_SXX(dependent, independent)` +- [ ] `REGR_SXY(dependent, independent)` +- [ ] `REGR_SYY(dependent, independent)` + +## Other + +- [ ] `CUME_DIST(value_list) WITHIN GROUP (ORDER BY sort_list)` +- [ ] `RANK(value_list) WITHIN GROUP (ORDER BY sort_list)` +- [ ] `DENSE_RANK(value_list) WITHIN GROUP (ORDER BY sort_list)` +- [ ] `PERCENT_RANK(value_list) WITHIN GROUP (ORDER BY sort_list)` +- [ ] `PERCENTILE_CONT(percentile) WITHIN GROUP (ORDER BY sort_list)` +- [ ] `PERCENTILE_DISC(percentile) WITHIN GROUP (ORDER BY sort_list)` \ No newline at end of file diff --git a/ext/todo.txt b/ext/todo.txt index a50d89e..8b951bc 100644 --- a/ext/todo.txt +++ b/ext/todo.txt @@ -1,13 +1,4 @@ -ieee754 -ieee754_exponent -ieee754_from_blob -ieee754_inc -ieee754_mantissa -ieee754_to_blob - zipfile zipfile_cds sqlar_compress -sqlar_uncompress - -remember \ No newline at end of file +sqlar_uncompress \ No newline at end of file diff --git a/sqlite3/download.sh b/sqlite3/download.sh index f507358..c15ab85 100755 --- a/sqlite3/download.sh +++ b/sqlite3/download.sh @@ -12,13 +12,14 @@ cat *.patch | patch --no-backup-if-mismatch mkdir -p ext/ cd ext/ -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/decimal.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/uint.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/uuid.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/anycollseq.c" curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/base64.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/decimal.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/ieee754.c" curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/regexp.c" curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/series.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/anycollseq.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/uint.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.44.2/ext/misc/uuid.c" cd ~- cd ../vfs/tests/mptest/testdata/ diff --git a/sqlite3/main.c b/sqlite3/main.c index 65eae9f..da2d37f 100644 --- a/sqlite3/main.c +++ b/sqlite3/main.c @@ -4,6 +4,7 @@ #include "ext/anycollseq.c" #include "ext/base64.c" #include "ext/decimal.c" +#include "ext/ieee754.c" #include "ext/regexp.c" #include "ext/series.c" #include "ext/uint.c" @@ -23,6 +24,7 @@ __attribute__((constructor)) void init() { sqlite3_initialize(); sqlite3_auto_extension((void (*)(void))sqlite3_base_init); sqlite3_auto_extension((void (*)(void))sqlite3_decimal_init); + sqlite3_auto_extension((void (*)(void))sqlite3_ieee_init); sqlite3_auto_extension((void (*)(void))sqlite3_regexp_init); sqlite3_auto_extension((void (*)(void))sqlite3_series_init); sqlite3_auto_extension((void (*)(void))sqlite3_uint_init); diff --git a/vfs/tests/mptest/testdata/mptest.wasm.bz2 b/vfs/tests/mptest/testdata/mptest.wasm.bz2 index 091f202..1c228b4 100644 --- a/vfs/tests/mptest/testdata/mptest.wasm.bz2 +++ b/vfs/tests/mptest/testdata/mptest.wasm.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91dade19dcd4509f47cb09f16af0cdf7eb2b09cef0e43a0e1ee380629a8c9778 -size 512403 +oid sha256:26d3b9d9bd6b3baf8d5e0064a4927c088c44001d1d69fe8c521430d355f8f67e +size 512655 diff --git a/vfs/tests/speedtest1/testdata/speedtest1.wasm.bz2 b/vfs/tests/speedtest1/testdata/speedtest1.wasm.bz2 index 3f99287..775df0a 100644 --- a/vfs/tests/speedtest1/testdata/speedtest1.wasm.bz2 +++ b/vfs/tests/speedtest1/testdata/speedtest1.wasm.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ff3c4ed5a8579206a2e48c4f8e72f483288f8b113b4664e92cb308a977556a42 -size 526453 +oid sha256:63160e8453cf69a27457cbb77a9ce1994a6617717278483448d8bceab5c5bf5d +size 526662