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

from_unixtime + union all returns truncated result #20223

Closed
wjhuang2016 opened this issue Sep 25, 2020 · 2 comments · Fixed by #20225
Closed

from_unixtime + union all returns truncated result #20223

wjhuang2016 opened this issue Sep 25, 2020 · 2 comments · Fixed by #20225
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Refer to https://asktug.com/t/topic/37509

CREATE TABLE t_a (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
type tinyint(4) NOT NULL,
create_time int(11) NOT NULL,
PRIMARY KEY (id)
)

select * from t_a

id    type  create_time  
 1       1     1601004020
 2       1     1598412094
 3       1     1598498511
 4       2     1598584933
 5       3     1599794551
 6       3     1599880969
select from_unixtime(create_time,'%Y-%m-%d') as t_day,count(*) as cnt
from t_a
where `type` = 1
group by t_day
union all
select from_unixtime(create_time,'%Y-%m-%d') as t_day,count(*) as cnt
from t_a
where `type` = 3
group by t_day

2. What did you expect to see? (Required)

3. What did you see instead (Required)

t_day cnt
2020-09- 1
2020-09- 1
2020-09- 1
2020-08- 1
2020-08- 1

4. What is your TiDB version? (Required)

4.0.5 master

@sre-bot
Copy link
Contributor

sre-bot commented Oct 9, 2020

Integrity check:
RCA symptom trigger_condition affect_version fix_version fields are empty

Please comment /info to get template

@ti-srebot
Copy link
Contributor

ti-srebot commented Oct 9, 2020

Please edit this comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA)

For from_unixtime, Flen is set to the length of the second argument, which is wrong.

2. Symptom

Wrong result.

3. All Trigger Conditions

from_unixtime(), union all.

4. Workaround (optional)

5. Affected versions

[:v4.0.7]

6. Fixed versions

v4.0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants