mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 09:20:39 +01:00
Improvements to NTILE after Pavel Zotov comments in CORE-3618.
This commit is contained in:
parent
fc3cd8f4be
commit
01c131b6f7
@ -185,7 +185,8 @@ after the duplicate salary. On the other hand, ROW_NUMBER always assigns sequent
|
||||
when there is duplicate values.
|
||||
PERCENT_RANK is a ratio of RANK to group count.
|
||||
CUME_DIST is cumulative distribution of a value in a group.
|
||||
NTILE distributes the rows into a specified number of groups.
|
||||
NTILE distributes the rows into a specified number of groups. NTILE argument is restricted to
|
||||
integral positive literal, variable (:var) and DSQL parameter (question mark).
|
||||
|
||||
4.2 Navigational functions
|
||||
--------------------------
|
||||
|
@ -890,6 +890,15 @@ string NTileWinNode::internalPrint(NodePrinter& printer) const
|
||||
|
||||
void NTileWinNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc)
|
||||
{
|
||||
dsc argDesc;
|
||||
MAKE_desc(dsqlScratch, &argDesc, arg);
|
||||
|
||||
if (!argDesc.isExact() || argDesc.dsc_scale != 0)
|
||||
{
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_sysf_argmustbe_exact) << "NTILE");
|
||||
}
|
||||
|
||||
if (dsqlScratch->clientDialect == 1)
|
||||
desc->makeDouble();
|
||||
else
|
||||
@ -984,7 +993,14 @@ dsc* NTileWinNode::winPass(thread_db* /*tdbb*/, jrd_req* request, SlidingWindow*
|
||||
|
||||
AggNode* NTileWinNode::dsqlCopy(DsqlCompilerScratch* dsqlScratch) /*const*/
|
||||
{
|
||||
return FB_NEW_POOL(getPool()) NTileWinNode(getPool(), doDsqlPass(dsqlScratch, arg));
|
||||
NTileWinNode* node = FB_NEW_POOL(getPool()) NTileWinNode(getPool(),
|
||||
doDsqlPass(dsqlScratch, arg));
|
||||
|
||||
dsc argDesc;
|
||||
argDesc.makeInt64(0);
|
||||
PASS1_set_parameter_type(dsqlScratch, node->arg, &argDesc, false);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
|
@ -7027,7 +7027,7 @@ window_function
|
||||
{ $$ = newNode<LeadWinNode>($3, $5, newNode<NullNode>()); }
|
||||
| LEAD '(' value ')'
|
||||
{ $$ = newNode<LeadWinNode>($3, MAKE_const_slong(1), newNode<NullNode>()); }
|
||||
| NTILE '(' u_numeric_constant ')'
|
||||
| NTILE '(' ntile_arg ')'
|
||||
{ $$ = newNode<NTileWinNode>($3); }
|
||||
;
|
||||
|
||||
@ -7038,6 +7038,13 @@ nth_from
|
||||
| FROM LAST { $$ = MAKE_const_slong(NthValueWinNode::FROM_LAST); }
|
||||
;
|
||||
|
||||
%type <valueExprNode> ntile_arg
|
||||
ntile_arg
|
||||
: u_numeric_constant
|
||||
| variable
|
||||
| parameter
|
||||
;
|
||||
|
||||
%type <aggNode> aggregate_window_function
|
||||
aggregate_window_function
|
||||
: aggregate_function
|
||||
|
@ -644,8 +644,11 @@ void makeBin(DataTypeUtilBase*, const SysFunction* function, dsc* result,
|
||||
}
|
||||
|
||||
if (!args[i]->isExact() || args[i]->dsc_scale != 0)
|
||||
status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
|
||||
Arg::Gds(isc_sysf_argmustbe_exact) << Arg::Str(function->name));
|
||||
{
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_expression_eval_err) <<
|
||||
Arg::Gds(isc_sysf_argmustbe_exact) << Arg::Str(function->name));
|
||||
}
|
||||
|
||||
if (first)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user