Commit Graph

6 Commits

Author SHA1 Message Date
1b4cd24b36 [opt](Nereids) support where, group by, having, order by clause without from clause in query statement (#27006)
Support where, group by, having, order by clause without from clause in query statement.
For example as following:

SELECT 1 AS a, COUNT(), SUM(2), AVG(1), RANK() OVER() AS w_rank
WHERE 1 = 1
GROUP BY a, w_rank
HAVING COUNT() IN (1, 2) AND w_rank = 1
ORDER BY a;

this will return result:

| a  |count(*)|sum(2)|avg(1)|w_rank|
+----+--------+------+------+------+
| 1  |       1|     2|   1.0|     1|


For another example as following:

select 1 c1, 2 union (select "hell0", "") order by c1
the second column datatype will be varchar(65533), 65533 is the default varchar length.

this will return result:

|c1    | 2 |
+------+---+
|1     | 2 |
|hell0 |   |
2023-11-27 12:05:14 +08:00
e159bdc479 [fix](nereids) Set to use nereids planner in select aggregation expr without from scene when regression-test (#25665) 2023-10-20 17:32:58 +08:00
b45f501e51 [improvement](nereids) Support aggregate functions without from clause (#25500)
Support aggregate functions in select without from clause, here are some examples as following:

SELECT 1,  
  'a',
   COUNT(),  
   SUM(1) + 1,
   AVG(2) / COUNT(),
   MAX(3),
   MIN(4),
   RANK() OVER() AS w_rank,
   DENSE_RANK() OVER() AS w_dense_rank,
   ROW_NUMBER() OVER() AS w_row_number,
   SUM(5) OVER() AS w_sum,
   AVG(6) OVER() AS w_avg,
   COUNT() OVER() AS w_count,
   MAX(7) OVER() AS w_max,
   MIN(8) OVER() AS w_min;
2023-10-18 23:07:37 -05:00
Pxl
a0d4f11667 [Bug](function) catch error state in function cast to avoid core dump (#20751)
catch error state in function cast to avoid core dump
2023-06-14 17:34:34 +08:00
6609eb804d [fix](regression) result of withUnionAll in query_p0/select_no_from is unstable (#15958) 2023-01-17 11:34:41 +08:00
e9f105aa1e [enhancement](regression-test) add some p0 cases (#12243) 2022-09-18 17:36:08 +08:00