Skip to content

SAMPLE BY returns unordered rows #6239

@puzpuzpuz

Description

@puzpuzpuz

To reproduce

CREATE TABLE x (ts TIMESTAMP) TIMESTAMP(ts) PARTITION BY DAY;

INSERT INTO x VALUES ('2010-01-01T01'),('2020-01-01T01'),('2030-01-01T01');

SELECT ts, count()::double / datediff('h', ts, dateadd('d', 1, ts, 'Europe/Copenhagen')) AS Coverage
FROM 'x'
SAMPLE BY 1d ALIGN TO CALENDAR TIME ZONE 'Europe/Copenhagen';

The SELECT produces the following result set:

ts Coverage
2019-12-31T23:00:00.000000Z 0.041666666666666664
2029-12-31T23:00:00.000000Z 0.041666666666666664
2009-12-31T23:00:00.000000Z 0.041666666666666664

Notice that the output is not ordered by the timestamp it must have been the case due to SAMPLE BY.

QuestDB version:

9.1

OS, in case of Docker specify Docker and the Host OS:

Ubuntu 24.04

File System, in case of Docker specify Host File System:

ext4

Full Name:

Andrei Pechkurov

Affiliation:

QuestDB

Have you followed Linux, MacOs kernel configuration steps to increase Maximum open files and Maximum virtual memory areas limit?

  • Yes, I have

Additional context

No response

Metadata

Metadata

Assignees

Labels

BugIncorrect or unexpected behaviorSQLIssues or changes relating to SQL execution

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions