Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/16404
  
    Oracle allows it. It sounds like they treat ` (username || 
dbms_random.string('a', 10))` in aggregate and group-by as the same expression.
    
    ```SQL
    SQL> select (username || dbms_random.string('a', 10)) from all_users group 
by (username || dbms_random.string('a', 10));
    
    (USERNAME||DBMS_RANDOM.STRING('A',10))
    
--------------------------------------------------------------------------------
    APEX_040000cklbMYhekl
    FLOWS_FILESVmTbIIeiUs
    CTXSYSPmgqeRFPry
    SYSTEMxQLrzXxHth
    XDBRRTfatsLlU
    SYSoLDWRKMvlZ
    XS$NULLXAaOykZCDH
    APEX_PUBLIC_USERvcLswvpbcw
    ANONYMOUSgupWiktQKh
    OUTLNjLdKOTZoFI
    MDSYSxEOhwTwQqa
    
    (USERNAME||DBMS_RANDOM.STRING('A',10))
    
--------------------------------------------------------------------------------
    HRkovpxQztYU
    
    12 rows selected.
    ```
    If I change the order, I got the error:
    ```SQL
    SQL> select (dbms_random.string('a', 10) || username) from all_users group 
by (username || dbms_random.string('a', 10))
      2  ;
    select (dbms_random.string('a', 10) || username) from all_users group by 
(username || dbms_random.string('a', 10))
                                           *
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to