polars_io/utils/mod.rs
1pub mod compression;
2mod other;
3
4pub use other::*;
5#[cfg(any(feature = "async", feature = "cloud"))]
6pub mod byte_source;
7pub mod file;
8pub mod mkdir;
9pub mod slice;
10pub mod stream_buf_reader;
11pub mod sync_on_close;
12
13/// Excludes only the unreserved URI characters in RFC-3986:
14///
15/// <https://datatracker.ietf.org/doc/html/rfc3986#section-2.3>
16///
17/// Characters that are allowed in a URI but do not have a reserved
18/// purpose are called unreserved. These include uppercase and lowercase
19/// letters, decimal digits, hyphen, period, underscore, and tilde.
20///
21/// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
22pub const URL_ENCODE_CHARSET: &percent_encoding::AsciiSet = &percent_encoding::NON_ALPHANUMERIC
23 .remove(b'-')
24 .remove(b'.')
25 .remove(b'_')
26 .remove(b'~');
27
28/// Characters to percent-encode for hive values such that they round-trip from bucket storage.
29///
30/// This is much more relaxed than the RFC-3986 URI spec as bucket storage is more permissive of allowed
31/// characters.
32pub const HIVE_VALUE_ENCODE_CHARSET: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
33 .add(b'/') // Exclude path separator
34 .add(b'=') // Exclude hive `key=value` separator
35 .add(b'%') // Percent itself.
36 // Colon and space are supported by object storage, but are encoded to mimic
37 // the datetime output format from pyarrow:
38 // * i.e. 'date2=2023-01-01 00:00:00.000000' becomes 'date2=2023-01-01%2000%3A00%3A00.000000'
39 .add(b':')
40 .add(b' ');