SilverHoodCorp / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

BigQuerySample: Json Parsing Exception when querying column with DOUBLE datatype #298

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In BigQuerySample, execute a query including a double column from a GBQ 
table. (ex SELECT cust_id,order_period,order_amount FROM 
[df_data/monthlyorders_t]; / order_amount is a DOUBLE)

What is the expected output? What do you see instead?

java.lang.IllegalArgumentException: v: expected type Float or float but got 
class java.lang.String for field public java.lang.String 
com.google.api.client.sample.bigquery.model.QueryValue.value
    at com.google.api.client.json.Json.parseValue(Json.java:458)
    at com.google.api.client.json.Json.parse(Json.java:257)
    at com.google.api.client.json.Json.parseValue(Json.java:444)
    at com.google.api.client.json.Json.parseArray(Json.java:366)
    at com.google.api.client.json.Json.parseValue(Json.java:406)
    at com.google.api.client.json.Json.parse(Json.java:257)
    at com.google.api.client.json.Json.parseValue(Json.java:444)
    at com.google.api.client.json.Json.parseArray(Json.java:366)
    at com.google.api.client.json.Json.parseValue(Json.java:406)
    at com.google.api.client.json.Json.parse(Json.java:257)
    at com.google.api.client.json.Json.parseAndClose(Json.java:191)
    at com.google.api.client.json.Json.parseAndClose(Json.java:150)
    at com.google.api.client.googleapis.json.JsonCParser.parse(JsonCParser.java:49)
    at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:280)
    at com.google.api.client.sample.bigquery.BigQuerySample.executeQuery(BigQuerySample.java:88)
    at com.google.api.client.sample.bigquery.BigQuerySample.main(BigQuerySample.java:52)

What version of the product are you using? On what operating system?

gdata: Latest checkout
jackson-core-asl-1.5.2.jar

Please provide any additional information below.

No problem with STRING or INTEGER datatypes.

Original issue reported on code.google.com by dreamfac...@gmail.com on 30 Jul 2010 at 10:46

GoogleCodeExporter commented 9 years ago
Here is a example of JSON returned by GBQ which trigger exception when parsed:

{"data":
    {"kind":"bigquery#queryResults",
     "fields":
        [{"id":"cust_id","type":"int64"},
         {"id":"order_period","type":"string"},
         {"id":"order_amount","type":"double"}],

     "rows":
        [{"f":[{"v":"1"},{"v":"2009-01-0"},{"v":10000.0}]},
         {"f":[{"v":"1"},{"v":"2009-02-0"},{"v":15000.0}]},
         {"f":[{"v":"1"},{"v":"2009-03-0"},{"v":18000.0}]},
         {"f":[{"v":"1"},{"v":"2009-04-0"},{"v":12000.0}]},
         {"f":[{"v":"1"},{"v":"2009-05-0"},{"v":11000.0}]}]
     }
}

Original comment by dreamfac...@gmail.com on 31 Jul 2010 at 9:06

GoogleCodeExporter commented 9 years ago
Thanks for reporting your experience.  As the exception message says, please 
try using Float type instead of String for BQ type "double".  For further 
discussion of this issue, please refer to the new project site:

http://code.google.com/p/google-api-java-client/

I haven't ported the bigquery sample yet, but I do expect to do so sometime 
over the next two weeks.

Original comment by yan...@google.com on 1 Aug 2010 at 12:13