Closed anismiles closed 1 month ago
Thanks for the detailed issue submission! I can see that you are using partitioning, which reminds me of when a very similar issue was fixed for the mssql driver. I suspect the presto driver will need a similar treatment: https://github.com/cube-js/cube.js/pull/920
Edit: Oh hold on that's not using partioning, nevermind. Looks like you found the issue though, nice!
Hey @jcw- I found a fix, but not sure this is the right way. Basically, Presto returns timestamp
data in this format - 2020-06-01 00:00:00.000
, and BaseDriver doesn't have a regex pattern to match it for timestamp
.
I updated the condition with an additional pattern -
timestamp: (v) => v instanceof Date || v.toString().match(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d/) || v.toString().match(/^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d.\d\d\d/),
And added readOnly
function in PrestoDriver.js
readOnly() {
return !!this.config.readOnly;
}
It seems to work for me! Please let me know if this is the right fix, I would be happy to do a PR.
@paveltiunov (apologies to tag you, but I think you should take a look)
I think you're on the right track, a PR seems like a good next step to me. BTW if you make that readOnly change in the base driver, you'll also fix https://github.com/cube-js/cube.js/issues/1028 :)
@jcw- Looks like implementation in BaseDriver
covers it. I have tested it, and it works okay. I only needed to add additional regex to detect date pattern. Am I missing something here? I probably should remove
readOnly() {
return !!this.config.readOnly;
}
from PrestoDriver
Right?
@anismiles right, move it to base driver :)
Hi @anismiles :wave:
Just wanted to follow up; we'd be delighted to review and merge a PR fixing this, if you can create one 😀
Closing as storing pre-aggregations in Cube Store the only supported flow here.
Problem
I am using Presto as my data-source, with Postgres as external pre-aggregate DB. Pre-aggregate tables are created with date columns as
text
instead oftimestamp
.Related Cube.js schema
JSON Query
Related Cube.js generated SQL
Pre-aggregate table definition
Error
Observation Please note that when I manually ALTER column
orders_orders_by_day_t2hw54vg_f1dq4lmu_1599053452689.orders__order_date_day
for typetimestamp
my query works.Below are ALTER commands -