|
| 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::optional< 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< std::optional< Literal > > | TruncateLiteralMax (const Literal &value, int32_t width) |
| | Truncate a Literal to a specified width for use as an upper-bound value.
|
| |
| static Result< Literal > | TruncateLowerBound (const PrimitiveType &type, const Literal &value, int32_t width) |
| | Truncate the lower bound of a string or binary value.
|
| |
| static Result< std::optional< Literal > > | TruncateUpperBound (const PrimitiveType &type, const Literal &value, int32_t width) |
| | Truncate the upper bound of a string or binary 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< std::optional< 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), the smallest Literal greater than the truncated prefix, or nullopt if no safe upper bound can be represented.
◆ TruncateLowerBound()
Truncate the lower bound of a string or binary value.
For string/binary types, truncates to the given length. For other types, returns the value unchanged.
- Parameters
-
| type | The Iceberg primitive type. |
| value | The lower bound literal value. |
| width | The width to truncate to. |
- Returns
- The truncated lower bound literal.
◆ TruncateUpperBound()
| Result< std::optional< Literal > > iceberg::TruncateUtils::TruncateUpperBound |
( |
const PrimitiveType & |
type, |
|
|
const Literal & |
value, |
|
|
int32_t |
width |
|
) |
| |
|
static |
Truncate the upper bound of a string or binary value.
For string/binary types, truncates to the smallest value greater than the truncated prefix. For other types, returns the value unchanged.
- Parameters
-
| type | The Iceberg primitive type. |
| value | The upper bound literal value. |
| width | The width to truncate to. |
- Returns
- The truncated upper bound literal, or nullopt if no safe upper bound can 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::optional< 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), the smallest string greater than the truncated prefix, or nullopt if no safe upper bound can be represented. Invalid UTF-8 is returned as an error.
The documentation for this class was generated from the following files: