cube icon indicating copy to clipboard operation
cube copied to clipboard

Min measure for a Date field throws "Float cannot represent non numeric value"

Open iiq374 opened this issue 3 years ago • 1 comments

Describe the bug When using a min measure type on a DateTime field there is a casting error when querying via GraphQL

To Reproduce

  1. Have a Cube with a min measure type on a DateTime field (we are using PostGres):
minDate: {
      sql: `created_at`,
      type: `min`,
    },
  1. Query for the field using GraphQL:
query CubeQuery  { 
  cube {
    generalLedger_Income {
      minDate
     } 
  }
}
{"errors":[{"message":"**Float cannot represent non numeric value: \"2020-06-25T14:00:00.000\**"","locations":[{"line":6,"column":7}],"path":["cube",0,"generalLedger_Income","minDate"]}],"data":{"cube":[{"generalLedger_Income":{"minDate":null,"__typename":"GeneralLedger_IncomeMembers"},"__typename":"Result"}]}}

Expected behavior Min and Max should be able to be used on Date fields as well

Screenshots If applicable, add screenshots to help explain your problem.

Minimally reproducible Cube Schema In case your bug report is data modelling related please put your minimally reproducible Cube Schema here. You can use selects without tables in order to achieve that as follows.

cube(`generalLedger_Income`, {
  sql: `
  select now() as created_at
  UNION ALL
  select now() as created_at
  `,
  measures: {
minDate: {
      sql: `created_at`,
      type: `min`,
    },
  },
});

Version: 0.31.11

Additional context

iiq374 avatar Nov 17 '22 21:11 iiq374

This also seems to be a problem with SQL API exposing the underlying aggregation as numeric

pauldheinrichs avatar Apr 10 '24 16:04 pauldheinrichs