Github user maropu commented on the issue:
https://github.com/apache/spark/pull/17191
Aha, I checked and I found all of them rejected the syntax;
```
postgres=# select gkey1 AS gkey2, count(value) AS k1 from t2 group by gkey2;
ERROR: column "t2.gkey1" must appear in the GROUP BY clause or be used in
an aggregate function
LINE 1: select gkey1 AS gkey2, count(value) AS k1 from t2 group by g...
mysql> select gkey1 AS gkey2, count(value) AS k1 from t2 group by gkey2;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause
and contains nonaggregated column 'testdb.t2.gkey1' which is not functionally
dependent on columns in GROUP BY clause; this is incompatible with
sql_mode=only_full_group_by
scala> Seq((1, 1, 1)).toDF("gkey1", "gkey2",
"value").createOrReplaceTempView("t")
scala> sql("SELECT gkey1 AS gkey2, COUNT(value) FROM t GROUP BY gkey2")
org.apache.spark.sql.AnalysisException: expression 't.`gkey1`' is neither
present in the group by, nor is it an aggregate function. Add to group by or
wrap in first() (or first_value) if you don't care which value you get.;;
Aggregate [gkey2#8], [gkey1#7 AS gkey2#21, count(value#9) AS
count(value)#23L]
+- SubqueryAlias t
+- Project [_1#3 AS gkey1#7, _2#4 AS gkey2#8, _3#5 AS value#9]
+- LocalRelation [_1#3, _2#4, _3#5]
```
---
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]