599166320 commented on PR #13168:
URL: https://github.com/apache/druid/pull/13168#issuecomment-1274708403
@paul-rogers
Maybe we don't need to consider the data type. You can use CAST function to
convert to a uniform type, as shown in the following example:
```
SELECT
a,b
FROM table
WHERE __time >= CURRENT_TIMESTAMP - INTERVAL '1' DAY
ORDER BY CAST(a AS DOUBLE) DESC,CAST(b AS DOUBLE) ASC
LIMIT 10
```
The above query will report the following error:
```
Error: Unknown exception
java.lang.Long cannot be cast to java.lang.Integer
java.lang.ClassCastException
```
The CAST function can be used to solve the problem of type conversion, such
as the following query:
```
SELECT
a,b
FROM table
WHERE __time >= CURRENT_TIMESTAMP - INTERVAL '1' DAY
ORDER BY CAST(a AS DOUBLE) DESC,CAST(b AS DOUBLE) ASC
LIMIT 10
```
When type conversion exceptions occur, we can prompt users to use CAST to
solve their sorting problems. What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]