Skip to content

Instantly share code, notes, and snippets.

@dharkum
Last active January 3, 2016 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dharkum/8455163 to your computer and use it in GitHub Desktop.
Save dharkum/8455163 to your computer and use it in GitHub Desktop.
CREATE EXTERNAL TABLE IF NOT EXISTS WebFeeds
(
UserID int,
Message String
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION 'wasb://install@myprimarystorage.blob.core.windows.net/webfeeds';
CREATE EXTERNAL TABLE IF NOT EXISTS ProcessedWebFeeds
(
UserID int,
PhoneNumber String
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION 'wasb://install@myprimarystorage.blob.core.windows.net/processedwebfeeds';
CREATE TEMPORARY FUNCTION FindPat AS 'HiveUDF.FindPattern';
INSERT INTO TABLE ProcessedWebFeeds
SELECT UserID, FindPat(Message, '\\d{3}-\\d{7}') AS PhoneNumber
FROM WebFeeds;
SELECT * FROM ProcessedWebFeeds;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment