ankane/rollup

RuntimeError (Dimensions not supported)

mhbcse opened this issue · 3 comments

Executing below command gives an error:
Ahoy::Event.where(name: "Viewed product").group_prop(:product_id).rollup("Product views")

Error:

Traceback (most recent call last):
        1: from (irb):1
RuntimeError (Dimensions not supported)

Generated Mysql query:

  (0.3ms)  SELECT MAX(CAST(rollups.time AS date)) FROM `rollups` WHERE `rollups`.`name` = 'Product views' AND `rollups`.`interval` = 'day'
   (0.5ms)  SELECT COUNT(*) AS count_all, JSON_UNQUOTE(JSON_EXTRACT(properties, '$.product_id')) AS json_unquote_json_extract_properties_product_id, CONVERT_TZ(DATE_FORMAT(CONVERT_TZ(`ahoy_events`.`time`, '+00:00', 'Etc/UTC'), '%Y-%m-%d 00:00:00'), 'Etc/UTC', '+00:00') AS convert_tz_date_format_convert_tz_ahoy_events_time_00_00_etc_utc_y_m_d_00_00_00_etc_utc_00_00 FROM `ahoy_events` WHERE `ahoy_events`.`name` = 'Viewed product' AND (`ahoy_events`.`time` IS NOT NULL) GROUP BY JSON_UNQUOTE(JSON_EXTRACT(properties, '$.product_id')), CONVERT_TZ(DATE_FORMAT(CONVERT_TZ(`ahoy_events`.`time`, '+00:00', 'Etc/UTC'), '%Y-%m-%d 00:00:00'), 'Etc/UTC', '+00:00')

Mysql query runs without any problem in mysql console.

Hey @mhbcse, unfortunately, dimensions are only supported with Postgres: https://github.com/ankane/rollup#dimensions

Is there a technical reason why it's only supported on Postgress? or it's just not implemented yet for other database?

Dimensions require the ability to upsert on a multicolumn key that includes a JSON column.