Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • core/picodata
1 result
Show changes
Commits on Source (10)
Showing
with 3175 additions and 3620 deletions
[flake8]
max-line-length = 99
# guide: https://gist.github.com/kateinoigakukun/b0bc920e587851bfffa98b9e279175f2
096258aa4fda34ee575799de4cb4134a796af604 # code reformatting after switch to ruff
......@@ -3,6 +3,7 @@ target/
venv/
node_modules/
__pycache__/
.ruff_cache/
.rocks
......
......@@ -8,7 +8,6 @@ set quiet
default:
{{ JUST_EXEC }} --list --unsorted --no-aliases
#***************#
# settings: ENV #
#***************#
......@@ -77,9 +76,13 @@ test-rust *ARGS:
alias tp := test-python
[group("test")]
[doc("`tp`: python tests")]
[doc("`tp`: python tests, use PYTEST_PATTERN env to pass parameters to `-k` flag")]
test-python:
poetry run pytest {{ PYTEST_JOBS }}
if [ -z "${PYTEST_PATTERN:-}" ]; then \
poetry run pytest {{PYTEST_JOBS}}; \
else \
poetry run pytest -k "${PYTEST_PATTERN}" {{PYTEST_JOBS}}; \
fi
#*************#
# group: LINT #
......@@ -110,9 +113,9 @@ alias lp := lint-python
[group("lint")]
[doc("`lp`: python lints")]
lint-python:
poetry run flake8 ./test
poetry run black ./test --check --diff
poetry run mypy ./test
poetry run ruff check ./test
poetry run ruff format ./test --check --diff
poetry run mypy ./test
#************#
# group: FMT #
......@@ -135,7 +138,7 @@ alias fp := fmt-python
[group("fmt")]
[doc("`fp`: python format")]
fmt-python:
poetry run black ./test
poetry run ruff format ./test
#**************#
# group: STATS #
......
......@@ -52,6 +52,9 @@ with the `YY.MINOR.MICRO` scheme.
- `listen`, `advertise` parameters are renamed to `iproto_listen`, `iproto_advertise`
- New field `_pico_property.system_catalog_version` representing version of a system catalog.
It may not be changed at every release, so this is not autoincrementing value.
### CLI
- `picodata expel` takes instance uuid instead of instance name.
......
......@@ -339,3 +339,27 @@ Tarantool protocol support is used.
make k6
```
Performance summary can then be found in the `test/manual/sql/` directory.
## Testing with cargo-insta (Rust snapshot tests)
We use `cargo insta` for snapshot testing in the Rust codebase, particularly within the `sbroad` module. Follow these steps to run and review tests:
- Install `cargo-insta` if you haven't already:
```bash
cargo install cargo-insta
```
- Navigate to the sbroad directory:
```bash
cd sbroad/
```
- Run the tests with the mock feature to generate or update snapshots:
```bash
cargo insta test --features mock
```
- Review the snapshots and accept or reject changes interactively:
```bash
cargo insta review
```
\ No newline at end of file
......@@ -2086,6 +2086,19 @@ version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
[[package]]
name = "insta"
version = "1.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71c1b125e30d93896b365e156c33dadfffab45ee8400afcbba4752f59de08a86"
dependencies = [
"console",
"linked-hash-map",
"once_cell",
"pin-project",
"similar",
]
[[package]]
name = "instant"
version = "0.1.13"
......@@ -2223,6 +2236,12 @@ dependencies = [
"redox_syscall",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linkme"
version = "0.2.10"
......@@ -3452,6 +3471,7 @@ dependencies = [
"blake3",
"chrono",
"hash32 0.2.1",
"insta",
"itertools",
"lazy_static",
"pest",
......@@ -3675,6 +3695,12 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
[[package]]
name = "similar"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
[[package]]
name = "simple_logger"
version = "4.3.3"
......
......@@ -122,14 +122,14 @@ lint:
--workspace --no-deps --document-private-items \
--exclude=tlua --exclude=sbroad-core --exclude=tarantool
poetry run flake8 ./test
poetry run black ./test --check --diff
poetry run ruff check ./test
poetry run ruff format ./test --check --diff
poetry run mypy ./test
.PHONY: fmt
fmt:
cargo fmt
poetry run black ./test
poetry run ruff format ./test
.PHONY: clean
clean:
......
# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
[[package]]
name = "asn1crypto"
......@@ -26,52 +26,6 @@ files = [
astroid = ["astroid (>=2,<4)"]
test = ["astroid (>=2,<4)", "pytest", "pytest-cov", "pytest-xdist"]
[[package]]
name = "black"
version = "24.10.0"
description = "The uncompromising code formatter."
optional = false
python-versions = ">=3.9"
files = [
{file = "black-24.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e6668650ea4b685440857138e5fe40cde4d652633b1bdffc62933d0db4ed9812"},
{file = "black-24.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1c536fcf674217e87b8cc3657b81809d3c085d7bf3ef262ead700da345bfa6ea"},
{file = "black-24.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:649fff99a20bd06c6f727d2a27f401331dc0cc861fb69cde910fe95b01b5928f"},
{file = "black-24.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:fe4d6476887de70546212c99ac9bd803d90b42fc4767f058a0baa895013fbb3e"},
{file = "black-24.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5a2221696a8224e335c28816a9d331a6c2ae15a2ee34ec857dcf3e45dbfa99ad"},
{file = "black-24.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f9da3333530dbcecc1be13e69c250ed8dfa67f43c4005fb537bb426e19200d50"},
{file = "black-24.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4007b1393d902b48b36958a216c20c4482f601569d19ed1df294a496eb366392"},
{file = "black-24.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:394d4ddc64782e51153eadcaaca95144ac4c35e27ef9b0a42e121ae7e57a9175"},
{file = "black-24.10.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b5e39e0fae001df40f95bd8cc36b9165c5e2ea88900167bddf258bacef9bbdc3"},
{file = "black-24.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d37d422772111794b26757c5b55a3eade028aa3fde43121ab7b673d050949d65"},
{file = "black-24.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:14b3502784f09ce2443830e3133dacf2c0110d45191ed470ecb04d0f5f6fcb0f"},
{file = "black-24.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:30d2c30dc5139211dda799758559d1b049f7f14c580c409d6ad925b74a4208a8"},
{file = "black-24.10.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1cbacacb19e922a1d75ef2b6ccaefcd6e93a2c05ede32f06a21386a04cedb981"},
{file = "black-24.10.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1f93102e0c5bb3907451063e08b9876dbeac810e7da5a8bfb7aeb5a9ef89066b"},
{file = "black-24.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ddacb691cdcdf77b96f549cf9591701d8db36b2f19519373d60d31746068dbf2"},
{file = "black-24.10.0-cp313-cp313-win_amd64.whl", hash = "sha256:680359d932801c76d2e9c9068d05c6b107f2584b2a5b88831c83962eb9984c1b"},
{file = "black-24.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:17374989640fbca88b6a448129cd1745c5eb8d9547b464f281b251dd00155ccd"},
{file = "black-24.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:63f626344343083322233f175aaf372d326de8436f5928c042639a4afbbf1d3f"},
{file = "black-24.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ccfa1d0cb6200857f1923b602f978386a3a2758a65b52e0950299ea014be6800"},
{file = "black-24.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:2cd9c95431d94adc56600710f8813ee27eea544dd118d45896bb734e9d7a0dc7"},
{file = "black-24.10.0-py3-none-any.whl", hash = "sha256:3bb2b7a1f7b685f85b11fed1ef10f8a9148bceb49853e47a294a3dd963c1dd7d"},
{file = "black-24.10.0.tar.gz", hash = "sha256:846ea64c97afe3bc677b761787993be4991810ecc7a4a937816dd6bddedc4875"},
]
[package.dependencies]
click = ">=8.0.0"
mypy-extensions = ">=0.4.3"
packaging = ">=22.0"
pathspec = ">=0.9.0"
platformdirs = ">=2"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""}
[package.extras]
colorama = ["colorama (>=0.4.3)"]
d = ["aiohttp (>=3.10)"]
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
uvloop = ["uvloop (>=0.15.2)"]
[[package]]
name = "certifi"
version = "2024.8.30"
......@@ -197,20 +151,6 @@ files = [
{file = "charset_normalizer-3.4.0.tar.gz", hash = "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e"},
]
[[package]]
name = "click"
version = "8.1.7"
description = "Composable command line interface toolkit"
optional = false
python-versions = ">=3.7"
files = [
{file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"},
{file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"},
]
[package.dependencies]
colorama = {version = "*", markers = "platform_system == \"Windows\""}
[[package]]
name = "colorama"
version = "0.4.6"
......@@ -289,22 +229,6 @@ files = [
[package.extras]
tests = ["asttokens (>=2.1.0)", "coverage", "coverage-enable-subprocess", "ipython", "littleutils", "pytest", "rich"]
[[package]]
name = "flake8"
version = "7.1.1"
description = "the modular source code checker: pep8 pyflakes and co"
optional = false
python-versions = ">=3.8.1"
files = [
{file = "flake8-7.1.1-py2.py3-none-any.whl", hash = "sha256:597477df7860daa5aa0fdd84bf5208a043ab96b8e96ab708770ae0364dd03213"},
{file = "flake8-7.1.1.tar.gz", hash = "sha256:049d058491e228e03e67b390f311bbf88fce2dbaa8fa673e7aea87b7198b8d38"},
]
[package.dependencies]
mccabe = ">=0.7.0,<0.8.0"
pycodestyle = ">=2.12.0,<2.13.0"
pyflakes = ">=3.2.0,<3.3.0"
[[package]]
name = "funcy"
version = "2.0"
......@@ -495,17 +419,6 @@ files = [
[package.dependencies]
traitlets = "*"
[[package]]
name = "mccabe"
version = "0.7.0"
description = "McCabe checker, plugin for flake8"
optional = false
python-versions = ">=3.6"
files = [
{file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"},
{file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
]
[[package]]
name = "mdurl"
version = "0.1.2"
......@@ -680,17 +593,6 @@ files = [
qa = ["flake8 (==5.0.4)", "mypy (==0.971)", "types-setuptools (==67.2.0.1)"]
testing = ["docopt", "pytest"]
[[package]]
name = "pathspec"
version = "0.12.1"
description = "Utility library for gitignore style pattern matching of file paths."
optional = false
python-versions = ">=3.8"
files = [
{file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"},
{file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"},
]
[[package]]
name = "pexpect"
version = "4.9.0"
......@@ -720,22 +622,6 @@ files = [
python-dateutil = ">=2.8.2"
scramp = ">=1.4.5"
[[package]]
name = "platformdirs"
version = "4.3.6"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
optional = false
python-versions = ">=3.8"
files = [
{file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"},
{file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"},
]
[package.extras]
docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"]
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"]
type = ["mypy (>=1.11.2)"]
[[package]]
name = "pluggy"
version = "1.5.0"
......@@ -915,28 +801,6 @@ files = [
[package.extras]
tests = ["pytest"]
[[package]]
name = "pycodestyle"
version = "2.12.1"
description = "Python style guide checker"
optional = false
python-versions = ">=3.8"
files = [
{file = "pycodestyle-2.12.1-py2.py3-none-any.whl", hash = "sha256:46f0fb92069a7c28ab7bb558f05bfc0110dac69a0cd23c61ea0040283a9d78b3"},
{file = "pycodestyle-2.12.1.tar.gz", hash = "sha256:6838eae08bbce4f6accd5d5572075c63626a15ee3e6f842df996bf62f6d73521"},
]
[[package]]
name = "pyflakes"
version = "3.2.0"
description = "passive checker of Python programs"
optional = false
python-versions = ">=3.8"
files = [
{file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"},
{file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"},
]
[[package]]
name = "pygments"
version = "2.18.0"
......@@ -1166,6 +1030,33 @@ typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.1
[package.extras]
jupyter = ["ipywidgets (>=7.5.1,<9)"]
[[package]]
name = "ruff"
version = "0.9.4"
description = "An extremely fast Python linter and code formatter, written in Rust."
optional = false
python-versions = ">=3.7"
files = [
{file = "ruff-0.9.4-py3-none-linux_armv6l.whl", hash = "sha256:64e73d25b954f71ff100bb70f39f1ee09e880728efb4250c632ceed4e4cdf706"},
{file = "ruff-0.9.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:6ce6743ed64d9afab4fafeaea70d3631b4d4b28b592db21a5c2d1f0ef52934bf"},
{file = "ruff-0.9.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:54499fb08408e32b57360f6f9de7157a5fec24ad79cb3f42ef2c3f3f728dfe2b"},
{file = "ruff-0.9.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:37c892540108314a6f01f105040b5106aeb829fa5fb0561d2dcaf71485021137"},
{file = "ruff-0.9.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:de9edf2ce4b9ddf43fd93e20ef635a900e25f622f87ed6e3047a664d0e8f810e"},
{file = "ruff-0.9.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87c90c32357c74f11deb7fbb065126d91771b207bf9bfaaee01277ca59b574ec"},
{file = "ruff-0.9.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:56acd6c694da3695a7461cc55775f3a409c3815ac467279dfa126061d84b314b"},
{file = "ruff-0.9.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e0c93e7d47ed951b9394cf352d6695b31498e68fd5782d6cbc282425655f687a"},
{file = "ruff-0.9.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1d4c8772670aecf037d1bf7a07c39106574d143b26cfe5ed1787d2f31e800214"},
{file = "ruff-0.9.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfc5f1d7afeda8d5d37660eeca6d389b142d7f2b5a1ab659d9214ebd0e025231"},
{file = "ruff-0.9.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:faa935fc00ae854d8b638c16a5f1ce881bc3f67446957dd6f2af440a5fc8526b"},
{file = "ruff-0.9.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a6c634fc6f5a0ceae1ab3e13c58183978185d131a29c425e4eaa9f40afe1e6d6"},
{file = "ruff-0.9.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:433dedf6ddfdec7f1ac7575ec1eb9844fa60c4c8c2f8887a070672b8d353d34c"},
{file = "ruff-0.9.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:d612dbd0f3a919a8cc1d12037168bfa536862066808960e0cc901404b77968f0"},
{file = "ruff-0.9.4-py3-none-win32.whl", hash = "sha256:db1192ddda2200671f9ef61d9597fcef89d934f5d1705e571a93a67fb13a4402"},
{file = "ruff-0.9.4-py3-none-win_amd64.whl", hash = "sha256:05bebf4cdbe3ef75430d26c375773978950bbf4ee3c95ccb5448940dc092408e"},
{file = "ruff-0.9.4-py3-none-win_arm64.whl", hash = "sha256:585792f1e81509e38ac5123492f8875fbc36f3ede8185af0a26df348e5154f41"},
{file = "ruff-0.9.4.tar.gz", hash = "sha256:6907ee3529244bb0ed066683e075f09285b38dd5b4039370df6ff06041ca19e7"},
]
[[package]]
name = "scramp"
version = "1.4.5"
......@@ -1361,4 +1252,4 @@ files = [
[metadata]
lock-version = "2.0"
python-versions = ">=3.10"
content-hash = "dbb35700649661c20b9887f09e78681d754667f24187db76b4d75242da516946"
content-hash = "871edba1c80b957edaf2ca553a85bb18c76e243658576aa56eb66fcd3f1fc339"
......@@ -8,8 +8,6 @@ package-mode = false
[tool.poetry.dependencies]
python = ">=3.10"
black = "^24.10.0"
flake8 = "^7.1.1"
funcy = "^2.0"
msgpack = "^1.1.0"
mypy = "^1.13.0"
......@@ -31,6 +29,10 @@ types-requests = "^2.32.0.20241016"
gitpython = "^3.1.43"
tqdm = "^4.67.0"
ipdb = "^0.13.13"
ruff = "^0.9.4"
[tool.ruff]
line-length = 120
[build-system]
requires = ["poetry-core"]
......
......@@ -293,6 +293,18 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "console"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b"
dependencies = [
"encode_unicode",
"libc",
"once_cell",
"windows-sys",
]
[[package]]
name = "constant_time_eq"
version = "0.3.1"
......@@ -511,6 +523,12 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "encode_unicode"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
[[package]]
name = "equivalent"
version = "1.0.1"
......@@ -703,6 +721,19 @@ dependencies = [
"hashbrown",
]
[[package]]
name = "insta"
version = "1.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71c1b125e30d93896b365e156c33dadfffab45ee8400afcbba4752f59de08a86"
dependencies = [
"console",
"linked-hash-map",
"once_cell",
"pin-project",
"similar",
]
[[package]]
name = "is-terminal"
version = "0.4.15"
......@@ -883,6 +914,26 @@ dependencies = [
"sha2",
]
[[package]]
name = "pin-project"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb"
dependencies = [
"proc-macro2 1.0.93",
"quote 1.0.38",
"syn 2.0.96",
]
[[package]]
name = "pin-project-lite"
version = "0.2.16"
......@@ -1198,6 +1249,7 @@ dependencies = [
"blake3",
"chrono",
"hash32",
"insta",
"itertools",
"lazy_static",
"pest",
......@@ -1300,6 +1352,12 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "similar"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
[[package]]
name = "slab"
version = "0.4.9"
......
......@@ -38,6 +38,7 @@ features = ["picodata"]
[dev-dependencies]
pretty_assertions = "1.3"
serde_yaml = "0.9.34"
insta = "1.42"
[dev-dependencies.tarantool]
git = "https://git.picodata.io/picodata/picodata/tarantool-module.git"
......
......@@ -70,18 +70,15 @@ fn front_explain_select_sql1() {
let metadata = &RouterRuntimeMock::new();
let mut query = Query::new(metadata, sql, vec![]).unwrap();
let expected_explain = SmolStr::from(
r#"projection ("t"."identification_number"::integer -> "c1", "t"."product_code"::string -> "product_code")
scan "hash_testing" -> "t"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
buckets = [1-10000]
"#,
);
if let Ok(actual_explain) = query.dispatch().unwrap().downcast::<SmolStr>() {
assert_eq!(expected_explain, *actual_explain);
insta::assert_snapshot!(*actual_explain, @r#"
projection ("t"."identification_number"::integer -> "c1", "t"."product_code"::string -> "product_code")
scan "hash_testing" -> "t"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
buckets = [1-10000]
"#);
} else {
panic!("Explain must be string")
}
......@@ -96,21 +93,18 @@ fn front_explain_select_sql2() {
let metadata = &RouterRuntimeMock::new();
let mut query = Query::new(metadata, sql, vec![]).unwrap();
let expected_explain: SmolStr = format_smolstr!(
"{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n",
r#"union all"#,
r#" projection ("t"."identification_number"::integer -> "c1", "t"."product_code"::string -> "product_code")"#,
r#" scan "hash_testing" -> "t""#,
r#" projection ("t2"."identification_number"::integer -> "identification_number", "t2"."product_code"::string -> "product_code")"#,
r#" scan "hash_testing_hist" -> "t2""#,
r#"execution options:"#,
r#" sql_vdbe_opcode_max = 45000"#,
r#" sql_motion_row_max = 5000"#,
r#"buckets = [1-10000]"#,
);
if let Ok(actual_explain) = query.dispatch().unwrap().downcast::<SmolStr>() {
assert_eq!(expected_explain, *actual_explain);
insta::assert_snapshot!(*actual_explain, @r#"
union all
projection ("t"."identification_number"::integer -> "c1", "t"."product_code"::string -> "product_code")
scan "hash_testing" -> "t"
projection ("t2"."identification_number"::integer -> "identification_number", "t2"."product_code"::string -> "product_code")
scan "hash_testing_hist" -> "t2"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
buckets = [1-10000]
"#);
} else {
panic!("Explain must be string")
}
......@@ -125,24 +119,21 @@ fn front_explain_select_sql3() {
let metadata = &RouterRuntimeMock::new();
let mut query = Query::new(metadata, sql, vec![]).unwrap();
let expected_explain: SmolStr = format_smolstr!(
"{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n",
r#"projection ("q1"."a"::string -> "a")"#,
r#" join on ROW("q1"."a"::string) = ROW("q2"."a2"::string)"#,
r#" scan "q1""#,
r#" projection ("q1"."a"::string -> "a", "q1"."b"::integer -> "b")"#,
r#" scan "t3" -> "q1""#,
r#" scan "q2""#,
r#" projection ("t3"."a"::string -> "a2", "t3"."b"::integer -> "b2")"#,
r#" scan "t3""#,
r#"execution options:"#,
r#" sql_vdbe_opcode_max = 45000"#,
r#" sql_motion_row_max = 5000"#,
r#"buckets = [1-10000]"#,
);
if let Ok(actual_explain) = query.dispatch().unwrap().downcast::<SmolStr>() {
assert_eq!(expected_explain, *actual_explain);
insta::assert_snapshot!(*actual_explain, @r#"
projection ("q1"."a"::string -> "a")
join on ROW("q1"."a"::string) = ROW("q2"."a2"::string)
scan "q1"
projection ("q1"."a"::string -> "a", "q1"."b"::integer -> "b")
scan "t3" -> "q1"
scan "q2"
projection ("t3"."a"::string -> "a2", "t3"."b"::integer -> "b2")
scan "t3"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
buckets = [1-10000]
"#);
} else {
panic!("explain must be string")
}
......@@ -157,24 +148,21 @@ fn front_explain_select_sql4() {
let metadata = &RouterRuntimeMock::new();
let mut query = Query::new(metadata, sql, vec![]).unwrap();
let expected_explain: SmolStr = format_smolstr!(
"{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n",
r#"projection ("q2"."a"::string -> "a")"#,
r#" join on ROW("q1"."a"::string) = ROW("q2"."a"::string)"#,
r#" scan "q1""#,
r#" projection ("q1"."a"::string -> "a", "q1"."b"::integer -> "b")"#,
r#" scan "t3" -> "q1""#,
r#" scan "q2""#,
r#" projection ("q2"."a"::string -> "a", "q2"."b"::integer -> "b")"#,
r#" scan "t3" -> "q2""#,
r#"execution options:"#,
r#" sql_vdbe_opcode_max = 45000"#,
r#" sql_motion_row_max = 5000"#,
r#"buckets = [1-10000]"#,
);
if let Ok(actual_explain) = query.dispatch().unwrap().downcast::<SmolStr>() {
assert_eq!(expected_explain, *actual_explain);
insta::assert_snapshot!(*actual_explain, @r#"
projection ("q2"."a"::string -> "a")
join on ROW("q1"."a"::string) = ROW("q2"."a"::string)
scan "q1"
projection ("q1"."a"::string -> "a", "q1"."b"::integer -> "b")
scan "t3" -> "q1"
scan "q2"
projection ("q2"."a"::string -> "a", "q2"."b"::integer -> "b")
scan "t3" -> "q2"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
buckets = [1-10000]
"#);
} else {
panic!("explain must be string")
}
......
......@@ -6,16 +6,13 @@ fn coalesce_in_projection() {
let sql = r#"SELECT COALESCE(NULL, "FIRST_NAME") FROM "test_space""#;
let plan = sql_to_optimized_ir(sql, vec![]);
let expected_explain = String::from(
r#"projection (coalesce((NULL::unknown, "test_space"."FIRST_NAME"::string))::any -> "col_1")
scan "test_space"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
projection (coalesce((NULL::unknown, "test_space"."FIRST_NAME"::string))::any -> "col_1")
scan "test_space"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
#[test]
......@@ -23,15 +20,12 @@ fn coalesce_in_selection() {
let sql = r#"SELECT "FIRST_NAME" FROM "test_space" WHERE COALESCE("FIRST_NAME", '(none)') = '(none)'"#;
let plan = sql_to_optimized_ir(sql, vec![]);
let expected_explain = String::from(
r#"projection ("test_space"."FIRST_NAME"::string -> "FIRST_NAME")
selection ROW(coalesce(("test_space"."FIRST_NAME"::string, '(none)'::string))::any) = ROW('(none)'::string)
scan "test_space"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
projection ("test_space"."FIRST_NAME"::string -> "FIRST_NAME")
selection ROW(coalesce(("test_space"."FIRST_NAME"::string, '(none)'::string))::any) = ROW('(none)'::string)
scan "test_space"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
......@@ -7,14 +7,11 @@ fn lower_upper() {
let plan = sql_to_optimized_ir(input, vec![]);
let expected_explain = String::from(
r#"projection (upper((lower((ROW('a'::string) || ROW('B'::string)))::string))::string -> "col_1", upper(("t1"."a"::string))::string -> "col_2")
scan "t1"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
projection (upper((lower((ROW('a'::string) || ROW('B'::string)))::string))::string -> "col_1", upper(("t1"."a"::string))::string -> "col_2")
scan "t1"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
......@@ -7,18 +7,15 @@ fn insert1() {
let pattern = r#"INSERT INTO "test_space"("id", "FIRST_NAME") VALUES(?, ?)"#;
let plan = sql_to_optimized_ir(pattern, vec![Value::from(1_i64), Value::from("test")]);
let expected_explain = String::from(
r#"insert "test_space" on conflict: fail
motion [policy: segment([ref("COLUMN_1")])]
values
value row (data=ROW(1::integer, 'test'::string))
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
insert "test_space" on conflict: fail
motion [policy: segment([ref("COLUMN_1")])]
values
value row (data=ROW(1::integer, 'test'::string))
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
#[test]
......@@ -26,18 +23,15 @@ fn insert2() {
let pattern = r#"INSERT INTO "test_space"("id", "FIRST_NAME") VALUES(1, 'test')"#;
let plan = sql_to_optimized_ir(pattern, vec![]);
let expected_explain = String::from(
r#"insert "test_space" on conflict: fail
motion [policy: segment([ref("COLUMN_1")])]
values
value row (data=ROW(1::unsigned, 'test'::string))
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
insert "test_space" on conflict: fail
motion [policy: segment([ref("COLUMN_1")])]
values
value row (data=ROW(1::unsigned, 'test'::string))
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
#[test]
......@@ -46,16 +40,13 @@ fn insert3() {
SELECT "id", "id" FROM "test_space""#;
let plan = sql_to_optimized_ir(pattern, vec![]);
let expected_explain = String::from(
r#"insert "test_space" on conflict: fail
motion [policy: local segment([ref("id")])]
projection ("test_space"."id"::unsigned -> "id", "test_space"."id"::unsigned -> "id")
scan "test_space"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
insert "test_space" on conflict: fail
motion [policy: local segment([ref("id")])]
projection ("test_space"."id"::unsigned -> "id", "test_space"."id"::unsigned -> "id")
scan "test_space"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
......@@ -13,29 +13,26 @@ fn milti_join1() {
WHERE t1."identification_number" = 5 and t1."product_code" = '123'"#;
let plan = sql_to_optimized_ir(input, vec![]);
let expected_explain = String::from(
r#"projection ("t1"."identification_number"::integer -> "identification_number", "t1"."product_code"::string -> "product_code", "t2"."id"::unsigned -> "id", "t3"."id"::unsigned -> "id")
selection ROW("t1"."identification_number"::integer) = ROW(5::unsigned) and ROW("t1"."product_code"::string) = ROW('123'::string)
left join on ROW("t1"."identification_number"::integer) = ROW("t3"."id"::unsigned)
join on ROW("t1"."identification_number"::integer) = ROW("t2"."id"::unsigned)
scan "t1"
projection ("hash_testing"."identification_number"::integer -> "identification_number", "hash_testing"."product_code"::string -> "product_code")
scan "hash_testing"
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
projection ("t1"."identification_number"::integer -> "identification_number", "t1"."product_code"::string -> "product_code", "t2"."id"::unsigned -> "id", "t3"."id"::unsigned -> "id")
selection ROW("t1"."identification_number"::integer) = ROW(5::unsigned) and ROW("t1"."product_code"::string) = ROW('123'::string)
left join on ROW("t1"."identification_number"::integer) = ROW("t3"."id"::unsigned)
join on ROW("t1"."identification_number"::integer) = ROW("t2"."id"::unsigned)
scan "t1"
projection ("hash_testing"."identification_number"::integer -> "identification_number", "hash_testing"."product_code"::string -> "product_code")
scan "hash_testing"
motion [policy: full]
scan "t2"
projection ("test_space"."id"::unsigned -> "id")
scan "test_space"
motion [policy: full]
scan "t2"
scan "t3"
projection ("test_space"."id"::unsigned -> "id")
scan "test_space"
motion [policy: full]
scan "t3"
projection ("test_space"."id"::unsigned -> "id")
scan "test_space"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
#[test]
......@@ -45,28 +42,25 @@ fn milti_join2() {
"#;
let plan = sql_to_optimized_ir(input, vec![]);
let expected_explain = String::from(
r#"projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b", "t2"."e"::unsigned -> "e", "t2"."f"::unsigned -> "f", "t2"."g"::unsigned -> "g", "t2"."h"::unsigned -> "h", "t4"."c"::string -> "c", "t4"."d"::integer -> "d")
left join on true::boolean
left join on ROW("t1"."a"::string) = ROW("t2"."e"::unsigned)
scan "t1"
projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b")
scan "t1"
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b", "t2"."e"::unsigned -> "e", "t2"."f"::unsigned -> "f", "t2"."g"::unsigned -> "g", "t2"."h"::unsigned -> "h", "t4"."c"::string -> "c", "t4"."d"::integer -> "d")
left join on true::boolean
left join on ROW("t1"."a"::string) = ROW("t2"."e"::unsigned)
scan "t1"
projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b")
scan "t1"
motion [policy: full]
scan "t2"
projection ("t2"."e"::unsigned -> "e", "t2"."f"::unsigned -> "f", "t2"."g"::unsigned -> "g", "t2"."h"::unsigned -> "h")
scan "t2"
motion [policy: full]
scan "t2"
projection ("t2"."e"::unsigned -> "e", "t2"."f"::unsigned -> "f", "t2"."g"::unsigned -> "g", "t2"."h"::unsigned -> "h")
scan "t2"
motion [policy: full]
scan "t4"
projection ("t4"."c"::string -> "c", "t4"."d"::integer -> "d")
scan "t4"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
scan "t4"
projection ("t4"."c"::string -> "c", "t4"."d"::integer -> "d")
scan "t4"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
#[test]
......@@ -76,33 +70,30 @@ fn milti_join3() {
"#;
let plan = sql_to_optimized_ir(input, vec![]);
let expected_explain = String::from(
r#"projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b", "t2"."e"::unsigned -> "e", "t2"."f"::unsigned -> "f", "t2"."g"::unsigned -> "g", "t2"."h"::unsigned -> "h", "t3"."a"::string -> "a", "t3"."b"::integer -> "b", "t4"."c"::string -> "c", "t4"."d"::integer -> "d")
join on ROW("t2"."f"::unsigned) = ROW("t4"."c"::string)
join on ROW("t1"."a"::string) = ROW("t3"."a"::string)
left join on ROW("t1"."a"::string) = ROW("t2"."e"::unsigned)
scan "t1"
projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b")
scan "t1"
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b", "t2"."e"::unsigned -> "e", "t2"."f"::unsigned -> "f", "t2"."g"::unsigned -> "g", "t2"."h"::unsigned -> "h", "t3"."a"::string -> "a", "t3"."b"::integer -> "b", "t4"."c"::string -> "c", "t4"."d"::integer -> "d")
join on ROW("t2"."f"::unsigned) = ROW("t4"."c"::string)
join on ROW("t1"."a"::string) = ROW("t3"."a"::string)
left join on ROW("t1"."a"::string) = ROW("t2"."e"::unsigned)
scan "t1"
projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b")
scan "t1"
motion [policy: full]
scan "t2"
projection ("t2"."e"::unsigned -> "e", "t2"."f"::unsigned -> "f", "t2"."g"::unsigned -> "g", "t2"."h"::unsigned -> "h")
scan "t2"
motion [policy: full]
scan "t2"
projection ("t2"."e"::unsigned -> "e", "t2"."f"::unsigned -> "f", "t2"."g"::unsigned -> "g", "t2"."h"::unsigned -> "h")
scan "t2"
scan "t3"
projection ("t3"."a"::string -> "a", "t3"."b"::integer -> "b")
scan "t3"
motion [policy: full]
scan "t3"
projection ("t3"."a"::string -> "a", "t3"."b"::integer -> "b")
scan "t3"
motion [policy: full]
scan "t4"
projection ("t4"."c"::string -> "c", "t4"."d"::integer -> "d")
scan "t4"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
scan "t4"
projection ("t4"."c"::string -> "c", "t4"."d"::integer -> "d")
scan "t4"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}
#[test]
......@@ -112,26 +103,23 @@ fn milti_join4() {
"#;
let plan = sql_to_optimized_ir(input, vec![]);
let expected_explain = String::from(
r#"projection ("t1"."a"::string -> "a")
join on ROW("t1"."a"::string) = ROW("t3"."a"::string)
join on ROW("t1"."a"::string) = ROW("t2"."a"::string)
scan "t1"
projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b")
scan "t1"
insta::assert_snapshot!(plan.as_explain().unwrap(), @r#"
projection ("t1"."a"::string -> "a")
join on ROW("t1"."a"::string) = ROW("t3"."a"::string)
join on ROW("t1"."a"::string) = ROW("t2"."a"::string)
scan "t1"
projection ("t1"."a"::string -> "a", "t1"."b"::integer -> "b")
scan "t1"
motion [policy: full]
scan "t2"
projection ("t2"."a"::string -> "a", "t2"."b"::integer -> "b")
scan "t1" -> "t2"
motion [policy: full]
scan "t2"
projection ("t2"."a"::string -> "a", "t2"."b"::integer -> "b")
scan "t1" -> "t2"
motion [policy: full]
scan "t3"
projection ("t3"."a"::string -> "a", "t3"."b"::integer -> "b")
scan "t3"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
scan "t3"
projection ("t3"."a"::string -> "a", "t3"."b"::integer -> "b")
scan "t3"
execution options:
sql_vdbe_opcode_max = 45000
sql_motion_row_max = 5000
"#);
}