Skip to content

Instantly share code, notes, and snippets.

@dharkum
Last active Jan 3, 2016
Embed
What would you like to do?
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