Skip to content

Make Statement.setPagingSize method public#30

Open
virtan wants to merge 3 commits into
apple:mainfrom
virtan:make-statement-setpagingsize-method-public-20240603T170102
Open

Make Statement.setPagingSize method public#30
virtan wants to merge 3 commits into
apple:mainfrom
virtan:make-statement-setpagingsize-method-public-20240603T170102

Conversation

@virtan

@virtan virtan commented Jun 4, 2024

Copy link
Copy Markdown

Make Statement.setPagingSize method public

Motivation:

In some cases we may need to change paging size to reduce chances of read timeouts

Modifications:

The method setPagingSize() existed but wasn't public so was inaccessible for clients

Result:

With this change it would become public and let a client to set custom paging sizes on per statement basis

Comment thread Sources/CassandraClient/Statement.swift Outdated

func setPagingSize(_ pagingSize: Int32) throws {
/// Sets the paging size of the returned paginated results.
public func setPagingSize(_ pagingSize: Int32) throws {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Int instead here? It should be preferred for public APIs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the rationale of using Int, besides the preference for public API?
Cassandra's native protocol accepts 32-bits int. From this perspective, Int32 reflects the API constraint precisely, meanwhile Int can be 64-bits depending on the platform, potentially causing overflow theoretically. In reality, no one should set the page size this large.

@virtan

virtan commented Jun 4, 2024

Copy link
Copy Markdown
Author

There is a variant of execute() method which also expects pageSize in Int32. It is public already, so changing it may introduce some backward compatibility issues.

@glbrntt

glbrntt commented Jun 5, 2024

Copy link
Copy Markdown

There is a variant of execute() method which also expects pageSize in Int32. It is public already, so changing it may introduce some backward compatibility issues.

That one should ideally be Int too, we can separately deprecate that variant of execute and add one using Int.

I'd much rather we course correct and add appropriate APIs rather than being consistent with past mistakes.

@virtan virtan force-pushed the make-statement-setpagingsize-method-public-20240603T170102 branch from 017c634 to d183c0e Compare December 9, 2025 23:52
@glbrntt glbrntt added the 🆕 semver/minor Adds new public API. label Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants