Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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 -

enter image description here

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
218 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

Single Quotes

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

Backtick Escape

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

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

Update 1

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

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

Update 2

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...