Skip to content

Fix week and month Time grain in MySQL#295

Closed
prihoda wants to merge 2 commits into
apache:airbnb_prodfrom
prihoda:patch-1
Closed

Fix week and month Time grain in MySQL#295
prihoda wants to merge 2 commits into
apache:airbnb_prodfrom
prihoda:patch-1

Conversation

@prihoda
Copy link
Copy Markdown
Contributor

@prihoda prihoda commented Apr 8, 2016

With mysql datetime and timestamp columns, currently the Time grain "week" and "month" options don't remove the time part. This results in groupings like this:

timestamp count
2015-04-05 07:00:00 1
2015-04-05 10:00:00 1
2015-04-05 11:00:00 2
2015-04-05 11:50:00 1
2015-04-05 12:00:00 5
2015-04-05 14:20:00 1
2015-04-05 14:30:00 1

and so on.

This is solved by wrapping the DATE_SUB with DATE().

With mysql datetime and timestamp columns, currently the Time grain "week" and "month" options don't remove the time part. This results in groupings like this:

timestamp	count
2015-04-05 07:00:00	1
2015-04-05 10:00:00	1
2015-04-05 11:00:00	2
2015-04-05 11:50:00	1
2015-04-05 12:00:00	5
2015-04-05 14:20:00	1
2015-04-05 14:30:00	1

and so on. 

This is solved by wrapping the DATE_SUB with DATE().
@landscape-bot
Copy link
Copy Markdown

Code Health
Repository health decreased by 0.04% when pulling 41c7766 on prihoda:patch-1 into 481d821 on airbnb:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 71.177% when pulling 41c7766 on prihoda:patch-1 into 481d821 on airbnb:airbnb_prod.

Splitting the line with MySQL Time Grain
@landscape-bot
Copy link
Copy Markdown

Code Health
Code quality remained the same when pulling 37e72f3 on prihoda:patch-1 into 481d821 on airbnb:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 71.177% when pulling 37e72f3 on prihoda:patch-1 into 481d821 on airbnb:airbnb_prod.

@prihoda prihoda closed this Apr 8, 2016
@prihoda prihoda deleted the patch-1 branch April 8, 2016 14:46
@prihoda
Copy link
Copy Markdown
Contributor Author

prihoda commented Apr 8, 2016

Sorry, wrong branch, will try to be more careful next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants