hqlsigned

HQL: cast to SIGNED is not known symbol


I need to convert this query to HQL syntax:

SELECT * FROM my_table 
GROUP BY `name`
HAVING MIN(ABS(CAST(202000 AS SIGNED) -  CAST(step_id AS SIGNED))) = ABS(CAST(202000 AS 
SIGNED) -  CAST(step_id AS SIGNED));

I wrote this:

"SELECT DISTINCT t FROM myTable t GROUP BY t.name 
  HAVING MIN(ABS(CAST(202000 as signed) - CAST(t.step.id as signed))) = ABS(CAST(202000 as signed)- CAST(t.step.id as signed))"

But I get compilation error - the red line is under the keyword 'signed': "Cannot resolve symbol 'Signed'"

I don't find the way to correctly covert this query to HQL.


Solution

  • Can you try this? Just replace SIGNED with integer :

    SELECT DISTINCT t 
    FROM myTable t 
    GROUP BY t.name 
    HAVING MIN(ABS(CAST(202000 AS integer) - CAST(t.stepId AS integer))) = ABS(CAST(202000 AS integer) - CAST(t.stepId AS integer))