-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ecf3fa8
commit 5c2f281
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#V2 | ||
CREATE EXTERNAL TABLE hits\nSTORED AS PARQUET\nLOCATION '/Users/mingying/Documents/hits.parquet'; | ||
select count(*) from hits; | ||
SELECT DATE_TRUNC('minute', "EventTime") AS M, COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate" >= '2013-07-14' AND "EventDate" <= '2013-07-15' AND "IsRefresh" = 0 AND "DontCountHits" = 0 GROUP BY DATE_TRUNC('minute', "EventTime") ORDER BY DATE_TRUNC('minute', "EventTime") LIMIT 10 OFFSET 1000; | ||
SELECT DATE_TRUNC('minute', to_timestamp_seconds("EventTime")) AS M, COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate"::INT::DATE >= '2013-07-14' AND "EventDate"::INT::DATE <= '2013-07-15' AND "IsRefresh" = 0 AND "DontCountHits" = 0 GROUP BY DATE_TRUNC('minute', to_timestamp_seconds("EventTime")) ORDER BY DATE_TRUNC('minute', M) LIMIT 10 OFFSET 1000; | ||
select * from hits where "EventDate" >= '2013-07-14' limit 1; | ||
select "EventTime" from hits limit 1; | ||
select to_timestamp_seconds("EventTime") from hits limit 1; | ||
select "EventDate" from hits limit 1; | ||
select '1970-01-01'::date\n; | ||
select '1970-01-01'::date + 15901; | ||
select 15901 / 365; | ||
\\q | ||
select to_timestamp_millis(1238123); | ||
select to_timestamp_millis('2023-01-31T09:26:56.123456789-05:00'); | ||
\\q | ||
SELECT AVG("UserID") FROM hits; | ||
CREATE EXTERNAL TABLE hits\nSTORED AS PARQUET\nLOCATION '/Users/mingying/Documents/hits.parquet'; | ||
SELECT SUM("AdvEngineID"), COUNT(*), AVG("ResolutionWidth") FROM hits; | ||
SELECT AVG("UserID") FROM hits; | ||
SELECT COUNT(DISTINCT "UserID") FROM hits; | ||
SELECT COUNT(DISTINCT "SearchPhrase") FROM hits; | ||
SELECT MIN("EventDate"), MAX("EventDate") FROM hits; | ||
SELECT "AdvEngineID", COUNT(*) FROM hits WHERE "AdvEngineID" <> 0 GROUP BY "AdvEngineID" ORDER BY COUNT(*) DESC; | ||
SELECT "RegionID", COUNT(DISTINCT "UserID") AS u FROM hits GROUP BY "RegionID" ORDER BY u DESC LIMIT 10; | ||
SELECT "RegionID", SUM("AdvEngineID"), COUNT(*) AS c, AVG("ResolutionWidth"), COUNT(DISTINCT "UserID") FROM hits GROUP BY "RegionID" ORDER BY c DESC LIMIT 10; | ||
SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE "MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10; | ||
SELECT "UserID", extract(minute FROM to_timestamp("EventTime")) AS m, "SearchPhrase", COUNT(*) FROM hits GROUP BY "UserID", m, "SearchPhrase" ORDER BY COUNT(*) DESC LIMIT 10; | ||
SELECT DATE_TRUNC('minute', to_timestamp("EventTime")) AS M, COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND to_date("EventDate"::INT) >= '2013-07-14' AND to_date("EventDate"::INT) <= '2013-07-15' AND "IsRefresh" = 0 AND "DontCountHits" = 0 GROUP BY DATE_TRUNC('minute', to_timestamp("EventTime")) ORDER BY DATE_TRUNC('minute', to_timestamp("EventTime")) LIMIT 10 OFFSET 1000; | ||
CREATE EXTERNAL TABLE hits\nSTORED AS PARQUET\nLOCATION '/Users/mingying/Documents/partitioned/hits.parquet'; | ||
drop table hits; | ||
CREATE EXTERNAL TABLE hits\nSTORED AS PARQUET\nLOCATION '/Users/mingying/Documents/partitioned/hits.parquet'; | ||
CREATE EXTERNAL TABLE hits\nSTORED AS PARQUET\nLOCATION '/Users/mingying/Documents/partitioned/'; | ||
select count(*) from hits; | ||
\\q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters