-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Unexpected result when using IN
with TIME
values
#13813
Comments
Hi, thanks for reporting this! Interestingly, it doesn't reproduce on macOS: v1.0.1-dev5313 64bacde85e
D DROP TABLE IF EXISTS t1;
D CREATE TABLE t1(c0 TIME WITH TIME ZONE);
D INSERT INTO t1(c0) VALUES ('12:34:56');
D
D SELECT t1.c0 FROM t1; -- 12:34:56+08
┌─────────────────────┐
│ c0 │
│ time with time zone │
├─────────────────────┤
│ 12:34:56+00 │
└─────────────────────┘
D
D SELECT (CAST(t1.c0 AS TIME) IN ('12:34:56')) FROM t1; -- false (unexpected)
┌───────────────────────────────────────┐
│ (CAST(t1.c0 AS TIME) IN ('12:34:56')) │
│ boolean │
├───────────────────────────────────────┤
│ true │
└───────────────────────────────────────┘
D SELECT NOT (CAST(t1.c0 AS TIME) IN ('12:34:56')) FROM t1; -- false
┌───────────────────────────────────────────┐
│ (CAST(t1.c0 AS TIME) NOT IN ('12:34:56')) │
│ boolean │
├───────────────────────────────────────────┤
│ false │
└───────────────────────────────────────────┘ I will test it on Ubuntu in a moment. |
Have just tested on my M2 Mac by install through this link. Looks like it's an old version (perhaps we should also update the mac install link), but I could also reproduce it. ./duckdb
v1.0.1-dev4917 45787e5f9f
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D DROP TABLE IF EXISTS t1;
D CREATE TABLE t1(c0 TIME WITH TIME ZONE);
D INSERT INTO t1(c0) VALUES ('12:34:56');
D
D SELECT t1.c0 FROM t1; -- 12:34:56+08
┌─────────────────────┐
│ c0 │
│ time with time zone │
├─────────────────────┤
│ 12:34:56+08 │
└─────────────────────┘
D
D SELECT (CAST(t1.c0 AS TIME) IN ('12:34:56')) FROM t1; -- false (unexpected)
┌───────────────────────────────────────┐
│ (CAST(t1.c0 AS TIME) IN ('12:34:56')) │
│ boolean │
├───────────────────────────────────────┤
│ false │
└───────────────────────────────────────┘
D SELECT NOT (CAST(t1.c0 AS TIME) IN ('12:34:56')) FROM t1; -- false
┌───────────────────────────────────────────┐
│ (CAST(t1.c0 AS TIME) NOT IN ('12:34:56')) │
│ boolean │
├───────────────────────────────────────────┤
│ false │
└───────────────────────────────────────────┘
D So I guess it's about SET TimeZone = 'UTC'; I guess you can try this: SET TimeZone='Asia/Singapore'; |
It's an CORE_EXTENSIONS='autocomplete;icu;parquet;json' GEN=ninja make Thanks for helping with the troubleshooting! |
Hi @suyZhong - Thanks for the report! The problem is really that |
FWIW, |
@hawkfish Thanks for your insights! I'm actually developing a testing tool that automatically integrates new features, and thus may cover some corner features. |
Issue #13813: TIMETZ Uninvertible Casts
Push down right side predicates that do not reference the inequality column. This appears to be what other systems do, but the optimiser doesn't know this, so we have to require it for testing. fixes: duckdb#13813 fixes: duckdblabs/duckdb-internal#3048
What happens?
Consider the following test cases. The second query should return
true
since the value after casting is12:34:56
and the IN expression should be evaluated to true. Besides, if thefalse
is expected, its negation query should not be evaluated asfalse
.To Reproduce
OS:
ubuntu 22.04
DuckDB Version:
v1.0.1-dev5313 64bacde
DuckDB Client:
CLI
Hardware:
No response
Full Name:
Suyang Zhong
Affiliation:
NUS
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a nightly build
Did you include all relevant data sets for reproducing the issue?
Yes
Did you include all code required to reproduce the issue?
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
The text was updated successfully, but these errors were encountered: