在Hadoop的蜂巢查询双引号 [英] Double Quotes in Hadoop Hive Query

查看:173
本文介绍了在Hadoop的蜂巢查询双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用下面的查询双引号 - >

I am able to use Double Quotes in following query ->

$subscriptionName = "***"
$clusterName = "***" 
$queryString = "SELECT city FROM logs WHERE city =""New York"";"
Use-AzureHDInsightCluster $clusterName
Invoke-Hive -Query $queryString

但我不能够在下面的PowerShell Comamnds使用行情 -

But I am not able to use Quotes in following PowerShell Comamnds -

$subscriptionName = "***"
$storageAccountName = "***"
$containerName = "***"
$clusterName = "***"

$queryString = "SELECT city FROM logs WHERE city =""New York"";"

$hiveJobDefinition = New-AzureHDInsightHiveJobDefinition -Query $queryString

Select-AzureSubscription $subscriptionName
$hiveJob = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $hiveJobDefinition

Wait-AzureHDInsightJob -Job $hiveJob -WaitTimeoutInSeconds 36000

Get-AzureHDInsightJobOutput -Cluster $clusterName -JobId $hiveJob.JobId -StandardOutput

这是给我下面的错误 -

It is giving me following error -

请给我一些信息,这是为什么零星的行为。两种实现创造就业机会,那么为什么一个实现接受双引号和其他没有。

Please give me some information why is this sporadic behavior. Both implementations creates jobs, then why one implementation accepting double quotes and other not.

推荐答案

尝试一些引用您的查询的替代方式,看看你得到任何进一步的:

Try a couple of alternate ways of quoting your query to see if you get any further:

单引号

$queryString = 'SELECT city FROM logs WHERE city ="New York";'

BACKTICK逃生

$queryString = "SELECT city FROM logs WHERE city =`"New York`";"

我的猜测是,它是启动AzureHDInsightJob 是间$ P $不同pting字符串的方式。

My guess is that it is the way that Start-AzureHDInsightJob is interpreting the string differently.

更新1

很遗憾听到上面没有工作,也许尝试(单引号字符串):

Sorry to hear the above didn't work, maybe try (single quote string):

$queryString = "SELECT city FROM logs WHERE city ='New York';"

更新2

新AzureHDInsightHiveJobDefinition展望你没有指定作业名,如果不指定作业名称,则适用:

Looking at New-AzureHDInsightHiveJobDefinition you haven't specified a job name, if you don't specify a job name then the following applies:

The name of the Hive job being defined. If the name is not specified, 
it is "Hive: <first 100 characters of Query>" by default.

所以,你的作业名称将包含您的查询,请尝试指定作业名,看是否有帮助。

So your job name will contain your query, try specifying a job name to see if that helps.

这篇关于在Hadoop的蜂巢查询双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆