1

我想defines允许将参数传递给 Hive 查询,但我还没有找到任何文档或使用示例。如何在查询中使用这些参数?

4

1 回答 1

1

我正在使用 powershell 中的定义参数,但希望它会对您有所帮助。

因此,首先在 PowerShell 脚本中,我正在编写如下内容:

[HashTable] $defines
$defines = @{}
$defines.Add("someContainerUrl",${someContainerUrl})

然后我在调用 HDInsight 时使用这个新的定义变量:

$jobDef = New-AzureHDInsightHiveJobDefinition -Query $hiveQuery -JobName $jobName -Defines $defines -StatusFolder "/JobStatus/Hive"
$hiveJob = Start-AzureHDInsightJob –Cluster $clusterName –JobDefinition $jobDef

然后在我的配置单元代码中,我可以使用这个定义变量,例如如下:

ADD FILES
    ${hiveconf:someContainerUrl}/SomeFile.exe;

我认为这篇文章也可能对您有所帮助:http: //blogs.msdn.com/b/bigdatasupport/archive/2014/02/13/how-to-pass-hadoop-configuration-values-for-a -job-via-hdinsight-powershell-and-net-sdk.aspx

于 2015-03-24T11:28:55.330 回答