wren-engine
wren-engine copied to clipboard
BigQuery DATETIME type mapping
Given select * from my_table where date_time_field = ? AND using prepared statement to query it
WHEN we try to describe the statement and get the metadata info (column metadata) FOUND the error messages from BigQuery
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
POST https://www.googleapis.com/bigquery/v2/projects/canner-cml/jobs?prettyPrint=false
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"location" : "q",
"locationType" : "parameter",
"message" : "No matching signature for operator = for argument types: DATETIME, TIMESTAMP. Supported signature: ANY = ANY at [43:8]",
"reason" : "invalidQuery"
} ],
"message" : "No matching signature for operator = for argument types: DATETIME, TIMESTAMP. Supported signature: ANY = ANY at [43:8]",
"status" : "INVALID_ARGUMENT"
}
I try to modify the pgTypeToBqTypeMap in pgTypeToBqTypeMap
.put(TimestampType.TIMESTAMP, TIMESTAMP) to .put(TimestampType.TIMESTAMP, DATETIME)
it works!
I think we should provide a proper mapping between BigqQuery DATETIME and TIMESTAMP