What happened?
The following test fails
def "use Job.getQueryResults with TO_JSON_STRING"() {
given:
QueryJobConfiguration queryJobConfiguration = QueryJobConfiguration
.newBuilder("SELECT TO_JSON_STRING(t,true) from (SELECT * FROM dataset.table) as t")
.build()
JobId jobId = JobId.newBuilder().setProject(project).setRandomJob().build()
Job job = bigQuery.create(JobInfo.newBuilder(queryJobConfiguration)
.setJobId(jobId)
.build())
when:
TableResult tableResult = job.getQueryResults()
List<Map> results = tableResult.streamAll().map(f ->
objectMapper.readValue(f[0].value.toString(), Map)
).toList()
then:
results.size() == 2
}
This is because DATE field value is missing quotes:
{"id":1,"name":"alice","dob":1990-01-01}
Note. Date field value is missing quotes. Works as expected in real BQ.
What did you expect to happen?
Date field in the JSON should be quoted.
How can we reproduce it (as minimally and precisely as possible)?
git clone -b feature/TO_JSON_STRING git@github.com:pavelfomin/spring-boot-bq-example.git
./gradlew clean build
Anything else we need to know?
Possibly related to #218, #265, #32
What happened?
The following test fails
This is because DATE field value is missing quotes:
{"id":1,"name":"alice","dob":1990-01-01}Note. Date field value is missing quotes. Works as expected in real BQ.
What did you expect to happen?
Date field in the JSON should be quoted.
How can we reproduce it (as minimally and precisely as possible)?
Anything else we need to know?
Possibly related to #218, #265, #32