waitingkuo commented on issue #3048:
URL: 
https://github.com/apache/arrow-datafusion/issues/3048#issuecomment-1210470885

   Current issue for 11 (12 and 13 have the similar issue)
   
   origin:
   ```
   SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE 
MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10;
   ```
   
   add double quote as column name imported as case-sensitive
   ```
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   ```
   
   Cast to TEXT  as we cannot group by binary for now #3035 
   ```
   SELECT "MobilePhoneModel"::TEXT, COUNT(DISTINCT "UserID") AS u FROM hits 
WHERE "MobilePhoneModel"::TEXT <> '' GROUP BY "MobilePhoneModel"::TEXT ORDER BY 
u DESC LIMIT 10;
   ```
   
   Unfortunately it crashes. i feel like `group by casted` doesn't work here
   i can reproduce similar issue by `select count(distinct a) from (select '1' 
as a) b group by a::TEXT;`. this query crashes in datafusion but works in 
postgresql
   


-- 
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]

Reply via email to