cube icon indicating copy to clipboard operation
cube copied to clipboard

When a cube is connected in postgresql mode, the time interval is a problem when sql uses date filtering

Open sjq1271227116 opened this issue 1 year ago • 5 comments

Describe the bug When a cube is connected in postgresql mode, the time interval is a problem when sql uses date filtering

To Reproduce Steps to reproduce the behavior:

  1. If my sql looks like this:
select name FROM public.my_table
WHERE channel IN ('WX')
  AND order_date >= TO_TIMESTAMP('2023-12-04 00:00:00.000000', 'YYYY-MM-DD HH24:MI:SS.US')
  AND order_date < TO_TIMESTAMP('2024-01-04 00:00:00.000000', 'YYYY-MM-DD HH24:MI:SS.US')

I will get this json Query, and it does not include the time 2023-12-04T00:00:00.000Z

"filters": [
    {
      "member": "my_table.channel",
      "operator": "equals",
      "values": [
        "WX"
      ]
    },
    {
      "member": "my_table.order_date",
      "operator": "afterDate",
      "values": [
        "2023-12-04T00:00:00.000Z"
      ]
    },
    {
      "member": "my_table.order_date",
      "operator": "beforeDate",
      "values": [
        "2024-01-03T23:59:59.999Z"
      ]
    }
  ]
  1. If my sql looks like this: (I just adjusted the position of the channel IN ('WX') statement)
select name FROM public.my_table
WHERE
  order_date >= TO_TIMESTAMP('2023-12-04 00:00:00.000000', 'YYYY-MM-DD HH24:MI:SS.US')
  AND order_date < TO_TIMESTAMP('2024-01-04 00:00:00.000000', 'YYYY-MM-DD HH24:MI:SS.US')
and  channel IN ('WX')

I will get this json Query, and it does include the time 2023-12-04T00:00:00.000Z

 "timeDimensions": [
   {
     "dimension": "my_table.order_date",
     "dateRange": [
       "2023-12-04T00:00:00.000Z",
       "2024-01-03T23:59:59.999Z"
     ]
   }
 ],
 "filters": [
   {
     "member": "my_table.channel",
     "operator": "equals",
     "values": [
       "WX"
     ]
   }
 ]

Expected behavior A clear and concise description of what you expected to happen.

Screenshots Because I have a lot of data that happens at 0 am, this bug causes my data to be inconsistent frequently. I want a uniform treatment of this threshold

Minimally reproducible Cube Schema

Version: V0.34.41

sjq1271227116 avatar Jan 04 '24 03:01 sjq1271227116

Thanks for reporting this, @sjq1271227116! Let me tag @ovr and @paveltiunov so they might take a look as well.

A quick follow up question—are you a Cube Cloud user as well?

igorlukanin avatar Jan 04 '24 10:01 igorlukanin

A quick follow up question—are you a Cube Cloud user as well?

Yes, I used postgresql to connect to the cube cloud and had no problem

sjq1271227116 avatar Jan 05 '24 01:01 sjq1271227116

A quick follow up question—are you a Cube Cloud user as well?

Yes, I used postgresql to connect to the cube cloud and had no problem

This problem only occurs with the cube core

sjq1271227116 avatar Jan 05 '24 02:01 sjq1271227116

This problem only occurs with the cube core

@sjq1271227116 Oh, this is interesting! Which version of Cube do you have in Cube Cloud? You can look it up in the API instance logs under Resources on the Overview page.

igorlukanin avatar Jan 05 '24 10:01 igorlukanin

This problem only occurs with the cube core

@sjq1271227116 Oh, this is interesting! Which version of Cube do you have in Cube Cloud? You can look it up in the API instance logs under Resources on the Overview page.

0.34.34

sjq1271227116 avatar Jan 08 '24 08:01 sjq1271227116

Fixed in latest

paveltiunov avatar Mar 04 '24 05:03 paveltiunov