When I add a time-series widget based on a date column Windshaft returns an error:
{
"errors": [
"schema \"__ctx_query\" does not exist"
],
"errors_with_context": [
{
"type": "unknown",
"message": "schema \"__ctx_query\" does not exist"
}
]
}
After debugging Windhaft, it seems it tries to run a query which has the following:
WITH
__cdb_basics AS (
...
FROM
(
SELECT * FROM (SELECT * FROM (SELECT * FROM multi_location) _cdb_bbox_filter
WHERE ST_Intersects(the_geom_webmercator, ST_Transform(ST_MakeEnvelope(-124.08690690994264,12.740371611587053,-47.09471940994263,50.77352319541077, 4326), 3857))) __ctx_query, __cdb_basics
WHERE __ctx_query.date_part( 'epoch ', kickoff) >= 1577836800
AND __ctx_query.date_part( 'epoch ', kickoff) <= 1701388800
) __cdb_filtered_source_query, __cdb_basics
GROUP BY 10, __cdb_basics.__cdb_bins_number
ORDER BY 10;
Which is incorrect because it executes the function date_part as part of __ctx_query which is not an schema but an alias for a subquery.
This is because in the function _buildQuery of the class NumericHistogram cast the column if it is date type and then it uses it in _buildQueryTpl as part of the alias __ctx_query.
Context
When I add a time-series widget based on a date column Windshaft returns an error:
After debugging Windhaft, it seems it tries to run a query which has the following:
Which is incorrect because it executes the function
date_part
as part of__ctx_query
which is not an schema but an alias for a subquery.This is because in the function _buildQuery of the class NumericHistogram cast the column if it is date type and then it uses it in _buildQueryTpl as part of the alias
__ctx_query
.