Skip to content

Instantly share code, notes, and snippets.

#############################################################################
### Please edit the values of the parameters below for your configuration ###
#############################################################################
$subscriptionName = "<Your Azure Subscription Name>"
$clusterName = "MyHDICluster" # HDInsight Cluster Name
############################################################################
### End Edits ###
############################################################################
param
(
#############################################################################
### Please edit the values of the parameters below for your configuration ###
#############################################################################
[string]$PrimarySubscriptionName="<Your Subscription Name>", # Replace <Your Subscription Name> with your Azure subscription name
[string]$HDInsightClusterLocation="West US", # This is the data center where you are going to provision this HDInsight cluster
[string]$HDInsightClusterName="MyHDICluster", # This is the name that you want for the HDInsight cluster
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';
package HiveUDF;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.hadoop.hive.ql.exec.UDF;
public final class FindPattern extends UDF
{
public static String evaluate(String targetString, String strPattern)
{
// Pattern matching on the input pattern
Pattern p = Pattern.compile(strPattern);