共用方式為


New-AzureHDInsightPigJobDefinition

定義 HDInsight 服務的新 Pig 作業。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

New-AzureHDInsightPigJobDefinition
   [-Arguments <String[]>]
   [-File <String>]
   [-Files <String[]>]
   [-Query <String>]
   [-StatusFolder <String>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

此版本的 Azure PowerShell HDInsight 已被取代。 這些 Cmdlet 將於 2017 年 1 月 1 日移除。 請使用較新版本的 Azure PowerShell HDInsight。

如需如何使用新的 HDInsight 建立叢集的資訊,請參閱 使用 Azure PowerShell 在 HDInsight 中建立以 Linux 為基礎的叢集(https://azure.microsoft.com/en-us/documentation/articles/hdinsight-hadoop-create-linux-clusters-azure-powershell/)。 如需如何使用 Azure PowerShell 和其他方法提交作業的資訊,請參閱 在 HDInsight 中提交 Hadoop 作業 (https://azure.microsoft.com/en-us/documentation/articles/hdinsight-submit-hadoop-jobs-programmatically/)。 如需 Azure PowerShell HDInsight 的參考資訊,請參閱 Azure HDInsight Cmdlet

New-AzureHDInsightPigJobDefinition 會定義 Azure HDInsight 服務的 Pig 作業。

範例

範例 1:定義新的 Pig 作業

PS C:\>$0 = '$0';
PS C:\> $QueryString =  "LOGS = LOAD 'wasb:///example/data/sample.log';" + "LEVELS = foreach LOGS generate REGEX_EXTRACT($0, '(TRACE|DEBUG|INFO|WARN|ERROR|FATAL)', 1) as LOGLEVEL;" + "FILTEREDLEVELS = FILTER LEVELS by LOGLEVEL is not null;" + "GROUPEDLEVELS = GROUP FILTEREDLEVELS by LOGLEVEL;" + "FREQUENCIES = foreach GROUPEDLEVELS generate group as LOGLEVEL, COUNT(FILTEREDLEVELS.LOGLEVEL) as COUNT;" + "RESULT = order FREQUENCIES by COUNT desc;" + "DUMP RESULT;"
PS C:\> $PigJobDefinition = New-AzureHDInsightPigJobDefinition -Query $QueryString

第一個命令會宣告字串值,然後儲存在 $0 變數中。

第二個命令會建立 Pig 作業查詢,然後將它儲存在 $QueryString 變數中。

最後一個命令會建立 Pig 作業定義,以在 $QueryString 中使用查詢,然後將作業定義儲存在 $PigJobDefinition 變數中。

參數

-Arguments

指定 Pig 作業的自變數陣列。 引數會以命令列引數的方式傳遞給每項工作。

類型:String[]
別名:Args
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-File

指定要執行之查詢的檔案路徑。 您可以使用此參數, 而不是 Query 參數。

類型:String
別名:QueryFile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Files

指定與 Pig 作業相關聯的檔案集合。

類型:String[]
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Query

指定 Pig 作業查詢。

類型:String
別名:QueryText
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-StatusFolder

指定資料夾的位置,其中包含作業的標準輸出和錯誤輸出,包括其結束代碼和工作記錄檔。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False