Skip to content

Commit

Permalink
numUrls query (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
rviscomi authored Aug 15, 2018
1 parent 2fda19d commit 57db33e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sql/get_bigquery_dates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
# May be combined with the generateReports.sh script
# to generate a histogram for each date. For example:
#
# sql/getBigQueryDates.sh runs pages | \
# xargs -I date sql/generateReports.sh -h date
# sql/get_bigquery_dates.sh runs pages | \
# xargs -I date sql/generate_reports.sh -h date
#
# sql/getBigQueryDates.sh runs pages | \
# xargs -I date sql/generateReport.sh -d date/cruxDcl.json
# sql/get_bigquery_dates.sh runs pages | \
# xargs -I date sql/generate_report.sh -d date/cruxDcl.json

set -eo pipefail

Expand Down
15 changes: 15 additions & 0 deletions sql/timeseries/numUrls.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#standardSQL
SELECT
SUBSTR(_TABLE_SUFFIX, 0, 10) AS date,
UNIX_DATE(CAST(REPLACE(SUBSTR(_TABLE_SUFFIX, 0, 10), '_', '-') AS DATE)) * 1000 * 60 * 60 * 24 AS timestamp,
IF(ENDS_WITH(_TABLE_SUFFIX, 'desktop'), 'desktop', 'mobile') AS client,
COUNT(0) AS urls
FROM
`httparchive.summary_pages.*`
GROUP BY
date,
timestamp,
client
ORDER BY
date DESC,
client

0 comments on commit 57db33e

Please sign in to comment.