[ 
https://issues.apache.org/jira/browse/CASSANDRA-8871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Tolbert updated CASSANDRA-8871:
------------------------------------
    Description: 
When retrieving the next page from the result of a simple statement, the result 
will return a non-null paging state even if it's the last page of the query. 
This only happens if it's the last page, and the results of the last page 
exactly matches the paging size.

Schema:
{noformat}
      CREATE KEYSPACE simplex WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': 3};
      USE simplex;
      CREATE TABLE test (k text, v int, PRIMARY KEY (k, v));
      INSERT INTO test (k, v) VALUES ('a', 0);
      INSERT INTO test (k, v) VALUES ('b', 1);
      INSERT INTO test (k, v) VALUES ('c', 2);
      INSERT INTO test (k, v) VALUES ('d', 3);
      INSERT INTO test (k, v) VALUES ('e', 4);
{noformat}

Query:
{noformat}
      result  = session.execute("SELECT * FROM test", page_size: 5)

      loop do
        puts "last page? #{result.last_page?}"
        puts "page size: #{result.size}"

        result.each do |row|
          puts row
        end
        puts ""

        break if result.last_page?
        result = result.next_page
      end
{noformat}

Result:
{noformat}
      last page? false
      page size: 5
      {"k"=>"a", "v"=>0}
      {"k"=>"c", "v"=>2}
      {"k"=>"m", "v"=>12}
      {"k"=>"f", "v"=>5}
      {"k"=>"o", "v"=>14}
      
      last page? true
      page size: 0
{noformat}


  was:
tWhen retrieving the next page from the result of a simple statement, the 
result will return a non-null paging state even if it's the last page of the 
query. This only happens if it's the last page, and the results of the last 
page exactly matches the paging size.

Schema:
{noformat}
      CREATE KEYSPACE simplex WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': 3};
      USE simplex;
      CREATE TABLE test (k text, v int, PRIMARY KEY (k, v));
      INSERT INTO test (k, v) VALUES ('a', 0);
      INSERT INTO test (k, v) VALUES ('b', 1);
      INSERT INTO test (k, v) VALUES ('c', 2);
      INSERT INTO test (k, v) VALUES ('d', 3);
      INSERT INTO test (k, v) VALUES ('e', 4);
{noformat}

Query:
{noformat}
      result  = session.execute("SELECT * FROM test", page_size: 5)

      loop do
        puts "last page? #{result.last_page?}"
        puts "page size: #{result.size}"

        result.each do |row|
          puts row
        end
        puts ""

        break if result.last_page?
        result = result.next_page
      end
{noformat}

Result:
{noformat}
      last page? false
      page size: 5
      {"k"=>"a", "v"=>0}
      {"k"=>"c", "v"=>2}
      {"k"=>"m", "v"=>12}
      {"k"=>"f", "v"=>5}
      {"k"=>"o", "v"=>14}
      
      last page? true
      page size: 0
{noformat}



> Non-null paging state returned if last page
> -------------------------------------------
>
>                 Key: CASSANDRA-8871
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8871
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: ruby-driver 2.1.0 | C* 2.0.12 | C* 2.1.3
>            Reporter: Kishan Karunaratne
>            Assignee: Tyler Hobbs
>
> When retrieving the next page from the result of a simple statement, the 
> result will return a non-null paging state even if it's the last page of the 
> query. This only happens if it's the last page, and the results of the last 
> page exactly matches the paging size.
> Schema:
> {noformat}
>       CREATE KEYSPACE simplex WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 3};
>       USE simplex;
>       CREATE TABLE test (k text, v int, PRIMARY KEY (k, v));
>       INSERT INTO test (k, v) VALUES ('a', 0);
>       INSERT INTO test (k, v) VALUES ('b', 1);
>       INSERT INTO test (k, v) VALUES ('c', 2);
>       INSERT INTO test (k, v) VALUES ('d', 3);
>       INSERT INTO test (k, v) VALUES ('e', 4);
> {noformat}
> Query:
> {noformat}
>       result  = session.execute("SELECT * FROM test", page_size: 5)
>       loop do
>         puts "last page? #{result.last_page?}"
>         puts "page size: #{result.size}"
>         result.each do |row|
>           puts row
>         end
>         puts ""
>         break if result.last_page?
>         result = result.next_page
>       end
> {noformat}
> Result:
> {noformat}
>       last page? false
>       page size: 5
>       {"k"=>"a", "v"=>0}
>       {"k"=>"c", "v"=>2}
>       {"k"=>"m", "v"=>12}
>       {"k"=>"f", "v"=>5}
>       {"k"=>"o", "v"=>14}
>       
>       last page? true
>       page size: 0
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to