Created
September 23, 2012 22:57
-
-
Save criccomini/3773348 to your computer and use it in GitHub Desktop.
Hadoop, Pig, and SQL (SELECT)
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
SELECT * FROM mytable; | |
DUMP mytable; | |
SELECT col1, col2 FROM mytable; | |
mytable = FOREACH mytable GENERATE col1, col2; | |
DUMP mytable; | |
SELECT col1 AS new_col1, col2 AS new_col2 FROM mytable; | |
mytable = FOREACH mytable GENERATE col1 AS new_col1, col2 AS new_col2; | |
DUMP mytable; | |
SELECT col1::integer, col2::varchar FROM mytable; | |
mytable = FOREACH mytable GENERATE (int)col1, (chararray)col2; | |
DUMP mytable; | |
SELECT * FROM mytable LIMIT 10; | |
mytable = LIMIT mytable 10; | |
DUMP mytable; | |
SELECT * FROM mytable ORDER BY col1 ASC; | |
mytable = ORDER mytable BY col1 ASC; | |
DUMP mytable; | |
SELECT * FROM mytable WHERE col1 > 20; | |
mytable = FILTER mytable BY col1 > 20; | |
DUMP mytable; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment