mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
use camelCase
This commit is contained in:
parent
02eee100a0
commit
8ea697b7df
@ -25,7 +25,7 @@ ClickHouse supports the standard grammar for defining windows and window functio
|
|||||||
| `rank()`, `dense_rank()`, `row_number()` | supported |
|
| `rank()`, `dense_rank()`, `row_number()` | supported |
|
||||||
| `lag/lead(value, offset)` | Not supported. Workarounds: |
|
| `lag/lead(value, offset)` | Not supported. Workarounds: |
|
||||||
| | 1) replace with `any(value) over (.... rows between <offset> preceding and <offset> preceding)`, or `following` for `lead`|
|
| | 1) replace with `any(value) over (.... rows between <offset> preceding and <offset> preceding)`, or `following` for `lead`|
|
||||||
| | 2) use `lag_in_frame/lead_in_frame`, which are analogous, but respect the window frame. To get behavior identical to `lag/lead`, use `rows between unbounded preceding and unbounded following` |
|
| | 2) use `lagInFrame/leadInFrame`, which are analogous, but respect the window frame. To get behavior identical to `lag/lead`, use `rows between unbounded preceding and unbounded following` |
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
|
@ -1525,7 +1525,7 @@ void registerWindowFunctions(AggregateFunctionFactory & factory)
|
|||||||
// be able to process at least the lag/lead in streaming fashion.
|
// be able to process at least the lag/lead in streaming fashion.
|
||||||
// A partial solution for constant offsets is rewriting, say `lag(value, offset)
|
// A partial solution for constant offsets is rewriting, say `lag(value, offset)
|
||||||
// to `any(value) over (rows between offset preceding and offset preceding)`.
|
// to `any(value) over (rows between offset preceding and offset preceding)`.
|
||||||
// We also implement non-standard functions `lag/lead_in_frame`, that are
|
// We also implement non-standard functions `lag/leadInFrame`, that are
|
||||||
// analogous to `lag/lead`, but respect the frame.
|
// analogous to `lag/lead`, but respect the frame.
|
||||||
// Functions like cume_dist() do require materializing the entire
|
// Functions like cume_dist() do require materializing the entire
|
||||||
// partition, but it's probably also simpler to implement them by rewriting
|
// partition, but it's probably also simpler to implement them by rewriting
|
||||||
@ -1553,14 +1553,14 @@ void registerWindowFunctions(AggregateFunctionFactory & factory)
|
|||||||
parameters);
|
parameters);
|
||||||
});
|
});
|
||||||
|
|
||||||
factory.registerFunction("lag_in_frame", [](const std::string & name,
|
factory.registerFunction("lagInFrame", [](const std::string & name,
|
||||||
const DataTypes & argument_types, const Array & parameters)
|
const DataTypes & argument_types, const Array & parameters)
|
||||||
{
|
{
|
||||||
return std::make_shared<WindowFunctionLagLeadInFrame<false>>(
|
return std::make_shared<WindowFunctionLagLeadInFrame<false>>(
|
||||||
name, argument_types, parameters);
|
name, argument_types, parameters);
|
||||||
});
|
});
|
||||||
|
|
||||||
factory.registerFunction("lead_in_frame", [](const std::string & name,
|
factory.registerFunction("leadInFrame", [](const std::string & name,
|
||||||
const DataTypes & argument_types, const Array & parameters)
|
const DataTypes & argument_types, const Array & parameters)
|
||||||
{
|
{
|
||||||
return std::make_shared<WindowFunctionLagLeadInFrame<true>>(
|
return std::make_shared<WindowFunctionLagLeadInFrame<true>>(
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
|
|
||||||
<!-- Our variant of lead. -->
|
<!-- Our variant of lead. -->
|
||||||
<query>
|
<query>
|
||||||
select lead_in_frame(number) over w
|
select leadInFrame(number) over w
|
||||||
from
|
from
|
||||||
(select number, intDiv(number, 1111) p, mod(number, 111) o
|
(select number, intDiv(number, 1111) p, mod(number, 111) o
|
||||||
from numbers(10000000)) t
|
from numbers(10000000)) t
|
||||||
@ -133,7 +133,7 @@
|
|||||||
</query>
|
</query>
|
||||||
|
|
||||||
<query>
|
<query>
|
||||||
select lead_in_frame(number, number) over w
|
select leadInFrame(number, number) over w
|
||||||
from
|
from
|
||||||
(select number, intDiv(number, 1111) p, mod(number, 111) o
|
(select number, intDiv(number, 1111) p, mod(number, 111) o
|
||||||
from numbers(10000000)) t
|
from numbers(10000000)) t
|
||||||
@ -143,7 +143,7 @@
|
|||||||
</query>
|
</query>
|
||||||
|
|
||||||
<query>
|
<query>
|
||||||
select lead_in_frame(number, number, number) over w
|
select leadInFrame(number, number, number) over w
|
||||||
from
|
from
|
||||||
(select number, intDiv(number, 1111) p, mod(number, 111) o
|
(select number, intDiv(number, 1111) p, mod(number, 111) o
|
||||||
from numbers(10000000)) t
|
from numbers(10000000)) t
|
||||||
|
@ -1004,8 +1004,8 @@ from numbers(5);
|
|||||||
3 \N
|
3 \N
|
||||||
-- variants of lag/lead that respect the frame
|
-- variants of lag/lead that respect the frame
|
||||||
select number, p, pp,
|
select number, p, pp,
|
||||||
lag_in_frame(number, number - pp, number * 11) over w as lag,
|
lagInFrame(number, number - pp, number * 11) over w as lag,
|
||||||
lead_in_frame(number, number - pp, number * 11) over w as lead
|
leadInFrame(number, number - pp, number * 11) over w as lead
|
||||||
from (select number, intDiv(number, 5) p, p * 5 pp from numbers(16))
|
from (select number, intDiv(number, 5) p, p * 5 pp from numbers(16))
|
||||||
window w as (partition by p order by number
|
window w as (partition by p order by number
|
||||||
rows between unbounded preceding and unbounded following)
|
rows between unbounded preceding and unbounded following)
|
||||||
|
@ -349,8 +349,8 @@ from numbers(5);
|
|||||||
|
|
||||||
-- variants of lag/lead that respect the frame
|
-- variants of lag/lead that respect the frame
|
||||||
select number, p, pp,
|
select number, p, pp,
|
||||||
lag_in_frame(number, number - pp, number * 11) over w as lag,
|
lagInFrame(number, number - pp, number * 11) over w as lag,
|
||||||
lead_in_frame(number, number - pp, number * 11) over w as lead
|
leadInFrame(number, number - pp, number * 11) over w as lead
|
||||||
from (select number, intDiv(number, 5) p, p * 5 pp from numbers(16))
|
from (select number, intDiv(number, 5) p, p * 5 pp from numbers(16))
|
||||||
window w as (partition by p order by number
|
window w as (partition by p order by number
|
||||||
rows between unbounded preceding and unbounded following)
|
rows between unbounded preceding and unbounded following)
|
||||||
|
Loading…
Reference in New Issue
Block a user