Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OHLC results in incorrect and sometimes random values #611

Closed
jerryxwu opened this issue Nov 10, 2022 · 0 comments · Fixed by #644
Closed

OHLC results in incorrect and sometimes random values #611

jerryxwu opened this issue Nov 10, 2022 · 0 comments · Fixed by #644
Assignees
Labels
bug Something isn't working

Comments

@jerryxwu
Copy link
Contributor

Relevant system information:

  • OS: Ubuntu 22.04
  • PostgreSQL version (output of SELECT version();): 14.5
  • TimescaleDB Toolkit version (output of \dx timescaledb_toolkit in psql): 1.11.0
  • Installation method: "Timescale Cloud"

Describe the bug
Running the same query involving OHLC returns different results from run to run.

To Reproduce

Query involving more than one company:

SELECT time_bucket('1 hour'::interval, "time") AS ts,
symbol,
toolkit_experimental.open(toolkit_experimental.ohlc("time", price))
FROM stocks_real_time
GROUP BY ts, symbol;

Screenshot 2022-11-10 at 12 51 08 PM

There are at least two issues here:
  1. The same opening price is returned for different companies, which is just wrong.
  2. Different opening prices are returned from the same company from run to run.

Query involving only one company:

SELECT time_bucket('1 hour'::interval, "time") AS ts,
symbol,
toolkit_experimental.open(toolkit_experimental.ohlc("time", price))
FROM stocks_real_time
WHERE symbol IN ('AAPL')
GROUP BY ts, symbol;

Screenshot 2022-11-10 at 12 51 37 PM

Even restricting the query to just one company, from run to run, different opening prices are returned for the same time.

Additional context
Reported initially by @zseta , If no accessor (toolkit_experimental.open()) is specified, this query

SELECT time_bucket('1 minute'::interval, "time") AS ts,
  symbol,
  toolkit_experimental.ohlc("time", price)
FROM stocks_real_time
GROUP BY ts, symbol;

returns error:

ERROR:  timestamp out of range
CONTEXT:  extension/src/serialization.rs:39:13
@jerryxwu jerryxwu added the bug Something isn't working label Nov 10, 2022
bors bot added a commit that referenced this issue Nov 17, 2022
624: Remove partial aggregation for Candlestick aggregates r=rtwalker a=rtwalker

Putting this here as an option for putting out a patch release until we have a proper fix for #611.

We've determined that the cause for the bad results lives somewhere in the functions that are used to support partial aggregation. We can at least prevent folks from running the candlestick aggregates in parallel mode and hitting this bug by dropping support for partial aggregation until we've resolved the issue.

Co-authored-by: Ryan Walker <rwalker@timescale.com>
@bors bors bot closed this as completed in 3157098 Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants