timescaledb icon indicating copy to clipboard operation
timescaledb copied to clipboard

Error when joining chunk

Open jayadevanm opened this issue 2 years ago • 4 comments

What type of bug is this?

Unexpected error

What subsystems and features are affected?

Query executor

What happened?

ERROR: attribute 1 of type _timescaledb_internal.compress_hyper_11_145_chunk has wrong type

TimescaleDB version affected

2.7.0

PostgreSQL version used

13.6

What operating system did you use?

Ubuntu 18.04

What installation method did you use?

Docker, Other

What platform did you run on?

Microsoft Azure Cloud

Relevant log output and stack trace

This query works - 
SELECT c.*  FROM  _timescaledb_internal._hyper_1_98_chunk c 
where (ts,uid,key_id ) in (select ts,uid,key_id from 
score_archive_lookup sal 
) limit 1 ;

Moving the limit to the inner query makes the it crash

SELECT c.*  FROM  _timescaledb_internal._hyper_1_98_chunk c 
where (ts,uid,key_id ) in (select ts,uid,key_id from 
score_archive_lookup sal limit 1
)  ;

ERROR:  attribute 1 of type _timescaledb_internal.compress_hyper_11_145_chunk has wrong type
DETAIL:  Table has type _timescaledb_internal.compressed_data, but query expects timestamp with time zone.


The function with limit in the inner query did work for a lot of data. I suspect it is in cases where there are duplicate records for ts,uid,key_id that the query crashes. Additional info - the chunk is compressed.

How can we reproduce the bug?

No response

jayadevanm avatar Jun 22 '22 08:06 jayadevanm

Hi @jayadevanm thanks for reaching out! Would it be possible to provide a reproduction example for the issue above? Thanks!

konskov avatar Jun 23 '22 06:06 konskov

This issue has been automatically marked as stale due to lack of activity. You can remove the stale label or comment. Otherwise, this issue will be closed in 30 days. Thank you!

github-actions[bot] avatar Aug 23 '22 02:08 github-actions[bot]

This error message seems to be related to #3079. That issue contains steps to reproduce the behavior.

jnidzwetzki avatar Sep 13 '22 06:09 jnidzwetzki

The issue is in the below subplan when executing Bitmap Heap Scan Node.

               ->  Custom Scan (DecompressChunk) on _hyper_71_12586_chunk  (cost=4.44..4.44 rows=1000 width=12)
                     Filter: ((metrics_temp."time" = "time") AND (metrics_temp.device_id = device_id) AND ((device_id < 100) OR (device_id > 500)))
                     ->  Bitmap Heap Scan on compress_hyper_72_12589_chunk  (cost=0.25..4.44 rows=1 width=56)
                           Recheck Cond: (device_id = metrics_temp.device_id)
                           Filter: (metrics_temp."time" = "time")
                           ->  Bitmap Index Scan on compress_hyper_72_12589_chunk__compressed_hypertable_72_device_  (cost=0.00..0.25 rows=13 width=0)
                                 Index Cond: (device_id = metrics_temp.device_id)

sb230132 avatar Sep 19 '22 05:09 sb230132