* fix(query): validate DistAnalyzeExec child count (#8510) * fix(query): validate DistAnalyzeExec child count Signed-off-by: discord9 <discord9@163.com> * test(query): avoid implicit clone lint Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> (cherry picked from commit623145e635) * fix: avoid panic when negating MIN-valued literals (#8484) Value::try_negative and the temporal negative() helpers negated with raw unary minus, which panics (debug) or wraps (release) on MIN values such as -i64::MIN. try_negative already returns None for the unsigned arms; make the signed and temporal arms honor that contract via checked_neg / checked_negative so a MIN literal produces a clean error instead. Signed-off-by: raphaelroshan <raphaelroshan@gmail.com> (cherry picked from commit1a476f76e2) * fix: preserve nulls in timestamp arrays (#8508) Signed-off-by: discord9 <discord9@163.com> (cherry picked from commitc7bcddacc5) * fix: timestamp display precision should respect column schema (#8227) (#8238) * fix: timestamp display precision should respect column schema (#8227) Previously, the MySQL writer converted timestamps to NaiveDateTime via to_chrono_datetime_with_timezone(), then passed the NaiveDateTime to write_col(). NaiveDateTime::Display uses a fixed 6-digit fractional- second format, causing: - TIMESTAMP(3) to show '.195000' instead of '.195' - TIMESTAMP(9) to show '.195123' instead of '.195123456' Fix: use Timestamp::to_timezone_aware_string() directly, which formats with chrono's '%.f' specifier — it strips trailing zeros and preserves full nanosecond fidelity based on the actual stored unit. Also add comprehensive unit tests in mysql_writer_test.rs covering: - All concrete data type → MySQL column type mappings - UNSIGNED_FLAG propagation for unsigned integer types - Timestamp precision for all four units (0/3/6/9 decimal places) - Edge cases: zero subseconds, trailing-zero stripping, Unix epoch, negative timestamps, and timezone offset shifts - Column-def ordering, empty schema, and decimal variants Signed-off-by: Divyansh <anshmcs@gmail.com> * perf: reuse format buffer for timestamp serialization to avoid per-row heap allocation Signed-off-by: Divyansh <anshmcs@gmail.com> * refactor: rename test variable and update visibility of create_mysql_column function Signed-off-by: Divyansh <anshmcs@gmail.com> * test: fix timestamp test constants and add sqlness case for display precision - Correct the base epoch constant: 1_748_836_200 is 2025-06-02, not 2026-06-02; use 1_780_372_200 to match the documented instant. - Fix subsecond expectations: chrono's %.f renders fractional digits in groups of 3 (.100 / .010), it does not strip to .1 / .01. - Add sqlness case timestamp_precision_display reproducing issue #8227 over the MySQL protocol (TIMESTAMP(0/3/6/9) rendering). - cargo fmt reflow of create_mysql_column signature. Signed-off-by: Divyansh <anshmcs@gmail.com> * fix: support binary protocol for timestamp column Signed-off-by: Divyansh <anshmcs@gmail.com> * test: update sqlness results for new timestamp display precision Signed-off-by: Divyansh <anshmcs@gmail.com> --------- Signed-off-by: Divyansh <anshmcs@gmail.com> (cherry picked from commit1acdec9334) * fix(mito): chunk manifest object writes (#8567) Signed-off-by: WenyXu <wenymedia@gmail.com> (cherry picked from commitd1e61a4ad2) * fix: display codes in metasrv client errors (#8558) * fix: display codes in metasrv client errors Signed-off-by: evenyag <realevenyag@gmail.com> * fix: normalize meta client errors in sqlness Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> (cherry picked from commitb1580c98f6) * fix(mito): notify bulk writes on WAL error (#8563) * fix(mito): notify bulk writes on WAL error Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * fix(mito): move write ctx tests after items Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * docs: mention PR template in agent guide Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> --------- Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> (cherry picked from commit25909bd1aa) * fix: ignore dropping marker during GC (#8588) Signed-off-by: Lei, HUANG <mrsatangel@gmail.com> (cherry picked from commit036db3d1ec) * fix(query): preserve bare plan names in analyze json (#8519) Signed-off-by: discord9 <discord9@163.com> (cherry picked from commit4a0dd8f9bc) * fix(flow): lower routine batching messages to debug (#8592) fix(flow): reduce expected batching log noise Signed-off-by: discord9 <discord9@163.com> (cherry picked from commit9f5a11e82a) * fix(flow): downgrade disabled incremental checkpoint log (#8572) Signed-off-by: discord9 <discord9@163.com> (cherry picked from commit4c5be47400) * fix: demote expected remote dynamic filter misses (#8574) Signed-off-by: discord9 <discord9@163.com> (cherry picked from commit45fc51ebd2) * fix: prevent credential leaks in sanitize_connection_string (#8539) Parse PostgreSQL DSNs (URL or libpq keyword) with tokio_postgres::Config — the backend's own parser — and log its Debug, which redacts the password. This matches the backend grammar exactly (multi-host URIs, backslash escapes, any Unicode whitespace, percent-encoded query keys, and '&'/';'/ '://' inside values) rather than approximating it by hand. Other URLs are redacted via the url crate; a best-effort keyword fallback covers inputs neither parser accepts. Signed-off-by: raphaelroshan <raphaelroshan@gmail.com> (cherry picked from commite19df8960e) * fix(mito2): remove stale compaction status when next compaction is throttled (#8618) When a compaction finishes with no pending request/DDL, on_compaction_finished leaves the region's CompactionStatus in the map with no active compaction. If the worker then skips schedule_next_compaction because min_compaction_interval has not passed, the stale status is never cleaned up: all subsequent compaction requests are swallowed by the "status exists" branch (regular waiters hang, manual StrictWindow requests pend forever) and the region never compacts again until restart. Add CompactionScheduler::remove_inactive_status() and call it from handle_compaction_finished when the interval gate skips scheduling the next compaction, restoring the invariant that a status in the map always has an active compaction. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> (cherry picked from commitd1ac9e2da7) * fix(meta): configure gRPC message limits (#8616) * fix(meta): configure gRPC message limits Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(meta): preserve follower range limits Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com> (cherry picked from commit82de463940) * fix(flow): convert streaming expiration to milliseconds (#8481) * fix(flow): convert streaming expiration to milliseconds Flow EXPIRE AFTER values are stored in seconds, while streaming flow timestamps and durations use milliseconds. Passing the value through unchanged expires state and limits refill scans 1000 times too early. Convert the value at streaming create and refill boundaries, reject overflow, and document the CreateFlowArgs unit. Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com> * fix(flow): reject negative streaming expiration Reject negative EXPIRE AFTER values at the streaming adapter boundary so refill ranges cannot move into the future. Keep zero valid and retain checked seconds-to-milliseconds conversion. Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com> --------- Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com> * fix: qualify scalar-subquery tables in persisted views (#8581) fix(query): traverse scalar subqueries in views Signed-off-by: discord9 <discord9@163.com> * chore: bump version Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: discord9 <discord9@163.com> Signed-off-by: raphaelroshan <raphaelroshan@gmail.com> Signed-off-by: Divyansh <anshmcs@gmail.com> Signed-off-by: WenyXu <wenymedia@gmail.com> Signed-off-by: evenyag <realevenyag@gmail.com> Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> Signed-off-by: Lei, HUANG <mrsatangel@gmail.com> Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com> Co-authored-by: discord9 <discord9@163.com> Co-authored-by: raphaelroshan <49832307+raphaelroshan@users.noreply.github.com> Co-authored-by: Div <anshmcs@gmail.com> Co-authored-by: Yingwen <realevenyag@gmail.com> Co-authored-by: Lei, HUANG <6406592+v0y4g3r@users.noreply.github.com> Co-authored-by: QuakeWang <45645138+QuakeWang@users.noreply.github.com>
Sqlness Test
Sqlness manual
Case file
Sqlness has two types of file:
.sql: test input, SQL only.result: expected test output, SQL and its results
.result is the output (execution result) file. If you see .result files is changed,
it means this test gets a different result and indicates it fails. You should
check change logs to solve the problem.
You only need to write test SQL in .sql file, and run the test.
Case organization
The root dir of input cases is tests/cases. It contains several subdirectories stand for different test
modes. E.g., standalone/ contains all the tests to run under greptimedb standalone start mode.
Under the first level of subdirectory (e.g. the cases/standalone), you can organize your cases as you like.
Sqlness walks through every file recursively and runs them.
Kafka WAL
Sqlness supports Kafka WAL. You can either provide a Kafka cluster or let sqlness to start one for you.
To run test with kafka, you need to pass the option -w kafka. If no other options are provided, sqlness will use conf/kafka-cluster.yml to start a Kafka cluster. This requires docker and docker-compose commands in your environment.
Otherwise, you can additionally pass the your existing kafka environment to sqlness with -k option. E.g.:
cargo sqlness bare -w kafka -k localhost:9092
In this case, sqlness will not start its own kafka cluster and the one you provided instead.
Run the test
Unlike other tests, this harness is in a binary target form. You can run it with:
cargo sqlness bare
It automatically finishes the following procedures: compile GreptimeDB, start it, grab tests and feed it to
the server, then collect and compare the results. You only need to check if the .result files are changed.
If not, congratulations, the test is passed 🥳!