Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window Function: ntile(num_buckets integer) [CORE3618] #3971

Closed
firebird-automations opened this issue Oct 6, 2011 · 8 comments
Closed

Window Function: ntile(num_buckets integer) [CORE3618] #3971

firebird-automations opened this issue Oct 6, 2011 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Sean Leyne (seanleyne)

Jira_subtask_inward CORE1688

Votes: 1

Commits: 01c131b 0bd8fd6

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

Should NTILE() allow to use EXPRESSION or only literal ?

DDL:
recreate table test(id int, x int);
commit;
insert into test values(null, 100);
insert into test values(null, 101);
insert into test values(null, 102);
insert into test values(2000, 200);
insert into test values(2001, 201);
insert into test values(2002, 300);
insert into test values(2003, 301);
commit;

Now try:

select id,x,ntile( 2+3 )over(order by http://t.id) from test t order by http://t.id,t.x;

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 21
-+

select id,x,ntile( (2+5)/3 )over(order by http://t.id) from test t order by http://t.id,t.x;

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 20
-(

PS. MS SQL works fine with such query (i.e. when argument for ntile is expression).

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Deferred

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

PS.

select x,y,ntile(2.718)over(order by x,y) from test order by x,y;

- should this raise error about positive int/bigint as the only allowed type ? (MS SQL "The function 'ntile' takes only a positive int or bigint expression as its input.")

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Pavel, I committed inprovements: 01c131b

Not everything can be in the NTILE parameter. I did now what the sql spec. says.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Deferred => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants