laskoviymishka commented on code in PR #3295:
URL: https://github.com/apache/iceberg-rust/pull/3295#discussion_r4335047567


##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -254,6 +267,22 @@ impl RestCatalogConfig {
         self.props.get("oauth2-server-uri").cloned()
     }
 
+    /// Parse only the effective value, after server defaults and overrides 
are merged.
+    fn page_size(&self) -> Result<Option<NonZeroU32>> {
+        self.props
+            .get(REST_CATALOG_PROP_PAGE_SIZE)
+            .map(|value| {
+                value.parse::<NonZeroU32>().map_err(|err| {

Review Comment:
   Java parses `rest-page-size` with `Integer.parseInt`, and so do its 
reference `CatalogHandlers` for `pageSize`, so values above `i32::MAX` pass 
here and then throw on a Java-backed server. I'd cap the effective value at 
`i32::MAX` and flip the `u32::MAX` precedence row into a rejection case. The 
spec only says `minimum: 1`, so this is about Java interop, not conformance.



##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -254,6 +267,22 @@ impl RestCatalogConfig {
         self.props.get("oauth2-server-uri").cloned()
     }
 
+    /// Parse only the effective value, after server defaults and overrides 
are merged.
+    fn page_size(&self) -> Result<Option<NonZeroU32>> {
+        self.props
+            .get(REST_CATALOG_PROP_PAGE_SIZE)
+            .map(|value| {
+                value.parse::<NonZeroU32>().map_err(|err| {
+                    Error::new(
+                        ErrorKind::DataInvalid,
+                        format!("{REST_CATALOG_PROP_PAGE_SIZE} must be a 
positive u32"),

Review Comment:
   I'd include the value here, like the `table_cache` check does with `Invalid 
{key}: {v}`. This runs in `RestCatalogClient::init`, so a bad server default or 
override fails every catalog call, not just listings, and the value is the 
quickest clue to which layer set it.



-- 
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