|
| static std::string | TruncateUTF8 (std::string source, size_t L) |
| | Truncate a UTF-8 string to a specified number of code points.
|
| |
| static Result< std::string > | TruncateUTF8Max (const std::string &source, size_t L) |
| | Truncate a UTF-8 string to a specified number of code points for use as an upper-bound value.
|
| |
template<typename T >
requires std::is_same_v<T, int32_t> || std::is_same_v<T, int64_t> |
| static T | TruncateInteger (T v, int32_t W) |
| | Truncate an integer v, either int32_t or int64_t, to v - (v % W).
|
| |
| static Decimal | TruncateDecimal (const Decimal &decimal, int32_t width) |
| | Truncate a Decimal to a specified width.
|
| |
| static Result< Literal > | TruncateLiteral (const Literal &literal, int32_t width) |
| | Truncate a Literal to a specified width.
|
| |
| static Result< Literal > | TruncateLiteralMax (const Literal &value, int32_t width) |
| | Truncate a Literal to a specified width for use as an upper-bound value.
|
| |
◆ TruncateDecimal()
| Decimal iceberg::TruncateUtils::TruncateDecimal |
( |
const Decimal & |
decimal, |
|
|
int32_t |
width |
|
) |
| |
|
static |
Truncate a Decimal to a specified width.
- Parameters
-
| decimal | The input Decimal to truncate. |
| width | The width to truncate to. |
- Returns
- A Decimal truncated to the specified width.
◆ TruncateInteger()
template<typename T >
requires std::is_same_v<T, int32_t> || std::is_same_v<T, int64_t>
| static T iceberg::TruncateUtils::TruncateInteger |
( |
T |
v, |
|
|
int32_t |
W |
|
) |
| |
|
inlinestatic |
Truncate an integer v, either int32_t or int64_t, to v - (v % W).
The remainder, v % W, must be positive. For languages where % can produce negative values, the correct truncate function is: v - (((v % W) + W) % W)
◆ TruncateLiteral()
| Result< Literal > iceberg::TruncateUtils::TruncateLiteral |
( |
const Literal & |
literal, |
|
|
int32_t |
width |
|
) |
| |
|
static |
Truncate a Literal to a specified width.
- Parameters
-
| literal | The input Literal to truncate. |
| width | The width to truncate to. |
- Returns
- A Result containing the truncated Literal or an error. Supported types are: INT, LONG, DECIMAL, STRING, BINARY. Reference:
◆ TruncateLiteralMax()
| Result< Literal > iceberg::TruncateUtils::TruncateLiteralMax |
( |
const Literal & |
value, |
|
|
int32_t |
width |
|
) |
| |
|
static |
Truncate a Literal to a specified width for use as an upper-bound value.
When truncation is required, the returned value is the smallest Literal greater than the truncated prefix. When no truncation is needed for the given width, the original Literal may be returned unchanged.
- Parameters
-
| value | The input Literal maximum value to truncate. |
| width | The width to truncate to. |
- Returns
- A Result containing either the original Literal (if no truncation is needed) or the smallest Literal greater than the truncated prefix, or an error if no such value exists or cannot be represented.
◆ TruncateUTF8()
| static std::string iceberg::TruncateUtils::TruncateUTF8 |
( |
std::string |
source, |
|
|
size_t |
L |
|
) |
| |
|
inlinestatic |
Truncate a UTF-8 string to a specified number of code points.
- Parameters
-
| source | The input string to truncate. |
| L | The maximum number of code points allowed in the output string. |
- Returns
- A valid UTF-8 string truncated to L code points. If the input string is already valid and has fewer than L code points, it is returned unchanged.
◆ TruncateUTF8Max()
| Result< std::string > iceberg::TruncateUtils::TruncateUTF8Max |
( |
const std::string & |
source, |
|
|
size_t |
L |
|
) |
| |
|
static |
Truncate a UTF-8 string to a specified number of code points for use as an upper-bound value.
When truncation is required, the returned value is the smallest UTF-8 string greater than the truncated prefix. When no truncation is needed for the given width, the original string may be returned unchanged.
- Parameters
-
| source | The input string to truncate. |
| L | The maximum number of code points allowed in the output string. |
- Returns
- A Result containing the original string (if no truncation is needed), or the smallest string greater than the truncated prefix, or an error if no such value exists or the input is invalid UTF-8.
The documentation for this class was generated from the following files: