paul-rogers opened a new issue #11659:
URL: https://github.com/apache/druid/issues/11659
### Affected Version
Version: 0.21.1
### Description
The SQL functions `min()` and `max()` are typically defined to operate over
any type with an ordering. However, Druid fails when they are used with a
`VARCHAR` (Druid `string`) column. Example:
```sql
SELECT
min("start"), max("end")
FROM sys.segments
```
Results:
```text
Error: Unknown exception
java.lang.reflect.InvocationTargetException
java.lang.RuntimeException
```
But, the following does work:
```sql
SELECT
min("size"), max("size")
FROM sys.segments
```
When run against the sample Wikipedia data, we get a more detailed error
message:
```sql
SELECT min("user")
FROM "wikipedia"
```
```text
Error: Unknown exception
Error while applying rule DruidQueryRule(AGGREGATE), args
[rel#1235:LogicalAggregate.NONE.[]
(input=RelSubset#1230,group={},EXPR$0=MIN($19)),
rel#1244:DruidQueryRel.NONE.[](query=
{"queryType":"scan","dataSource":{"type":"table","name":"wikiticker-2015-09-12-sampled"},"intervals":
{"type":"intervals","intervals":["2021-09-03T23:04:08.000Z/146140482-04-24T15:36:27.903Z"]},"virtualColumns":
[],"resultFormat":"compactedList","batchSize":20480,"order":"none","filter":null,"columns":
["__time","added","channel","cityName","comment","countryIsoCode","countryName","deleted","delta","
isAnonymous","isMinor","isNew","isRobot","isUnpatrolled","metroCode","namespace","page","
regionIsoCode","regionName","user"],"legacy":false,"context":{"sqlOuterLimit":100,
"sqlQueryId":"531a8bef-ce4b-45a7-96f4-c153d98a0951"},"descending":false,"
granularity":{"type":"all"}},signature={__time:LONG, added:LONG,
channel:STRING,
cityName:STRING, comment:STRING, countryIsoCode:STRING, countryName:STRING,
deleted:LONG, delta:LONG, isAnonymous:STRING, isMinor:STRING, isNew:STRING,
isRobot:STRING, isUnpatrolled:STRING, metroCode:STRING, namespace:STRING,
page:STRING, regionIsoCode:STRING, regionName:STRING, user:STRING})]
java.lang.RuntimeException
```
--
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]