Google bigquery BigQuery异步查询作业将查询字符串弄乱

Google bigquery BigQuery异步查询作业将查询字符串弄乱,google-bigquery,google-api-client,Google Bigquery,Google Api Client,我正在使用Ruby Google API客户端调用BigQuery。如果我通过bq.jobs.Query同步调用该查询,则查询工作正常 这里的工作是:job_sQUillv1JOSPg7XdJa7k8JTexPc 以下是实际查询: select uid,group_concat(event) as path from (select uid, event,t from (select properties.distinct_id as uid, event , pro

我正在使用Ruby Google API客户端调用BigQuery。如果我通过bq.jobs.Query同步调用该查询,则查询工作正常

这里的工作是:job_sQUillv1JOSPg7XdJa7k8JTexPc

以下是实际查询:

    select uid,group_concat(event) as path from
    (select uid, event,t from 
    (select properties.distinct_id  as uid, event , properties.time  as t, t1.ev as ev, t1.time as originalTime from 
    [ziptrips.ziptrips_events ] 
    join 
    ( select properties.distinct_id  as user, properties.time  as time, event  as ev from 
    [ziptrips.ziptrips_events ] where properties.time  > 1385856000  and properties.time  < 1388534399  and event  = 'Home Page Loaded'  
    group by user,time,ev) as t1 
    on t1.user = properties.distinct_id  
    where properties.time  < t1.time) 
    group by uid,event ,t 
    order by t desc) 
    group by uid
代码如下:

        client,bq = initialize()
         config = {
        'query' => {
            'query' => query
            }
        }

result = client.execute(:api_method =>  bq.jobs.insert,  
        :parameters => {'projectId' => 'onefold-1'},
        :body_object => {
                    "configuration" => config,
                    "kid" => "bigquery#queryRequest",
                    "query" => query,
                    "maxResults" => 1000,
                    "defaultDataset" => {
                        "datasetId" => "#{dataset_id}",
                        "projectId" => 'onefold-1'
                    },
                    "timeoMs" => 3000,
                    "dryRun" => false,
                    "preserveNulls" => false,
                    "useQueryCache" => true,
                    "miCompletionRatio" => 1.0
                }
        )
我相信它与编码等有关。我无法确定是否以及在何处指定编码。感谢您的指点或建议

谢谢,
Navneet

我发现这不是问题。同时发生了一个不同的错误,我将该错误与此关联。 它起作用了

        client,bq = initialize()
         config = {
        'query' => {
            'query' => query
            }
        }

result = client.execute(:api_method =>  bq.jobs.insert,  
        :parameters => {'projectId' => 'onefold-1'},
        :body_object => {
                    "configuration" => config,
                    "kid" => "bigquery#queryRequest",
                    "query" => query,
                    "maxResults" => 1000,
                    "defaultDataset" => {
                        "datasetId" => "#{dataset_id}",
                        "projectId" => 'onefold-1'
                    },
                    "timeoMs" => 3000,
                    "dryRun" => false,
                    "preserveNulls" => false,
                    "useQueryCache" => true,
                    "miCompletionRatio" => 1.0
                }
        )