Hi,
When I give date variables value, the sql doesn't work.
[Cloudera][JDBC](11500) Given type does not match given object: 2021-09-01T00:00.
the variables look like below.
I cannot find any reason why it says type mismatch. I'm applying the variables to date type as well.
where to_timestamp(week_dt, 'yyyyMMdd') between [[trunc({{start_date}}, 'D') -- ]] trunc(current_timestamp() - interval 7 day, 'D')
and [[{{end_date}} -- ]] to_date(current_timestamp() - interval 1 day)
here is the whole sql script and diagnostic info.
select to_timestamp(week_dt, 'yyyyMMdd') as week_dt
, sum(uv) as uv
from dev_temp.tmp_push_report_1
where to_timestamp(week_dt, 'yyyyMMdd') between [[trunc({{start_date}}, 'D') -- ]] trunc(current_timestamp() - interval 7 day, 'D')
and [[{{end_date}} -- ]] to_date(current_timestamp() - interval 1 day)
[[and traffic_source = {{traffic_source}}]]
[[and sid = {{sid}}]]
group by week_dt
order by week_dt
{
"browser-info": {
"language": "ko-KR",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "1.8.0_192-b12",
"java.vendor": "Oracle Corporation",
"java.vendor.url": "http://java.oracle.com/",
"java.version": "1.8.0_192",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "25.192-b12",
"os.name": "Linux",
"os.version": "2.6.32-696.10.1.el6.x86_64",
"user.language": "ko",
"user.timezone": "ROK"
},
"metabase-info": {
"databases": [
"impala",
"athena"
],
"hosting-env": "unknown",
"application-database": "mysql",
"application-database-details": {
"database": {
"name": "MySQL",
"version": "5.7.31-log"
},
"jdbc-driver": {
"name": "MariaDB Connector/J",
"version": "2.6.2"
}
},
"run-mode": "prod",
"version": {
"tag": "v0.38.2",
"date": "2021-03-17",
"branch": "release-x.38.x",
"hash": "91f0ed6"
},
"settings": {
"report-timezone": null
}
}
}