jon-whit opened a new issue, #1904:
URL: https://github.com/apache/cassandra-gocql-driver/issues/1904

   The gocql documentation has somewhat contradictory statements in the 
description of behavior for pagination.
   
   <img width="1028" height="610" alt="Image" 
src="https://github.com/user-attachments/assets/3fa050c1-970e-409f-b42b-51b248cfb809";
 />
   
   > ... While Cassandra returns exactly PageSize items (except for last page) 
in a page currently, the protocol authors explicitly reserved the right to 
return smaller or larger amount of items in a page for performance reasons, so 
don't rely on the page having the exact count of items.
   
   I don't know how to make sense of this, frankly. It says that Cassandra will 
return exactly PageSize items (except for last page) but simultaneously says 
not to rely on the page having the exact count of items and that the authors 
reserve the right to return fewer more more items per page.
   
   Futhermore, if I refer to the Datastax page on pagination (see [Setting the 
Page 
Size](https://docs.datastax.com/en/developer/java-driver/4.4/manual/core/paging/index.html#setting-the-page-size))
 it also says
   
   > Note that the page size is merely a hint; the server will not always 
return the exact number of rows, it might decide to return slightly more or 
less.
   
   Can you please clarify what the expected behavior is as a developer using 
gocql and the native pagination features of the client?
   
   If I have code written like so:
   
   ```go
   ...
   session, err := cluster.CreateSession()
   if err != nil {
        log.Fatal(err)
   }
   defer session.Close()
   
   var pageState []byte
   for {
        iter := session.Query(`SELECT id, description FROM 
itoa`).PageSize(1000).PageState(pageState).Iter()
        nextPageState := iter.PageState()
        scanner := iter.Scanner()
        for scanner.Next() {
                var (
                        id          int
                        description string
                )
                err = scanner.Scan(&id, &description)
                if err != nil {
                        log.Fatal(err)
                }
                fmt.Println(id, description)
        }
        err = scanner.Err()
        if err != nil {
                log.Fatal(err)
        }
   
        if len(nextPageState) == 0 {
                break
        }
        
        pageState = nextPageState
   }
   ```
   
   will I always be guaranteed to see 1000 items scanned if 1000 or more items 
exist? 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to