{"record":{"id":"2b7e53c25d344a75","repo":"nautechsystems/nautilus_trader","slug":"negative-maximum-value-max-for-column-column-n","errorCode":null,"errorMessage":"Negative maximum value {max} for column '{column_name}'","messagePattern":"Negative maximum value (.+?) for column '(.+?)'","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/persistence/src/parquet.rs","lineNumber":468,"sourceCode":"                        anyhow::bail!(\"Warning: Column name '{column_name}' is not of type i64.\");\n                    }\n                } else {\n                    anyhow::bail!(\n                        \"Warning: Statistics not available for column '{column_name}' in row group {i}.\"\n                    );\n                }\n            }\n        }\n    }\n\n    // Return the min/max pair if both are available\n    if let (Some(min), Some(max)) = (overall_min_value, overall_max_value) {\n        Ok((\n            u64::try_from(min).map_err(|_| {\n                anyhow::anyhow!(\"Negative minimum value {min} for column '{column_name}'\")\n            })?,\n            u64::try_from(max).map_err(|_| {\n                anyhow::anyhow!(\"Negative maximum value {max} for column '{column_name}'\")\n            })?,\n        ))\n    } else {\n        anyhow::bail!(\n            \"Column '{column_name}' not found or has no Int64 statistics in any row group.\"\n        )\n    }\n}\n\n/// Creates an object store from a URI string with optional storage options.\n///\n/// Supports multiple cloud storage providers:\n/// - AWS S3: `s3://bucket/path`\n/// - Google Cloud Storage: `gs://bucket/path` or `gcs://bucket/path`\n/// - Azure Blob Storage: `az://account/container/path` or `abfs://container@account.dfs.core.windows.net/path`\n/// - HTTP/WebDAV: `http://` or `https://`\n/// - Local files: `file://path` or plain paths\n///","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/persistence/src/parquet.rs#L450-L486","documentation":"Same function as the minimum variant: after collecting Int64 statistics across row groups, the maximum value is converted to u64. A negative maximum cannot fit in u64, so u64::try_from fails and this error is thrown.","triggerScenarios":"Calling min_max_from_parquet_metadata on a column where the maximum Int64 statistic is negative — meaning every value in the column is negative.","commonSituations":"Persisting all-negative signed columns (e.g. drawdowns, offsets) and then querying them through this unsigned min/max API.","solutions":["Verify the column contains only non-negative values before using this API","Handle the error and query the column with signed arithmetic instead","Re-model the data as unsigned (e.g. store magnitude separately) if negatives are expected","Check that the correct column name is being queried (a negative-filled column may indicate a naming mistake)"],"exampleFix":"// before\nlet (min, max) = min_max_from_parquet_metadata(&meta, column)?;\n// after\nlet (min, max) = min_max_from_parquet_metadata(&meta, column)\n    .map_err(|e| e.context(format!(\"cannot read unsigned stats for '{column}'\")))?;","handlingStrategy":"validation","validationCode":"let stats_max: i64 = /* max statistic */;\nanyhow::ensure!(stats_max >= 0, \"column '{}' max is negative\", column_name);","typeGuard":"fn fits_u64(v: i64) -> bool { v >= 0 }","tryCatchPattern":"let (min, max) = min_max_from_parquet_metadata(&meta, column)\n    .with_context(|| format!(\"reading unsigned stats for '{column}'\"))?;","preventionTips":["Ensure persisted columns never store signed business values","Re-model signed data (e.g. store offset + sign column) if negatives are expected","Confirm the queried column is the intended one"],"tags":["parquet","rust","statistics","conversion"],"backgroundTag":"value-out-of-range","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}