46 size_t code_point_count = 0;
47 size_t safe_point = 0;
49 for (
size_t i = 0; i < source.size(); ++i) {
51 if ((source[i] & 0xC0) != 0x80) {
53 if (code_point_count >
static_cast<size_t>(L)) {
60 if (safe_point != 0) {
62 source.resize(safe_point);
88 requires std::is_same_v<T, int32_t> || std::is_same_v<T, int64_t>
90 return v - (((v % W) + W) % W);
133 const Literal& value, int32_t width);
Represents 128-bit fixed-point decimal numbers. The max decimal precision that can be safely represen...
Definition decimal.h:46
Literal is a literal value that is associated with a primitive type.
Definition literal.h:42
A data type that does not have child fields.
Definition type.h:78
Definition truncate_util.h:36
static Result< Literal > TruncateLiteral(const Literal &literal, int32_t width)
Truncate a Literal to a specified width.
static Decimal TruncateDecimal(const Decimal &decimal, int32_t width)
Truncate a Decimal to a specified width.
static T TruncateInteger(T v, int32_t W)
Truncate an integer v, either int32_t or int64_t, to v - (v % W).
Definition truncate_util.h:89
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.
static Result< Literal > TruncateLowerBound(const PrimitiveType &type, const Literal &value, int32_t width)
Truncate the lower bound of a string or binary value.
static std::string TruncateUTF8(std::string source, size_t L)
Truncate a UTF-8 string to a specified number of code points.
Definition truncate_util.h:45
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.
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.
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::expected< T, E > Result
Result alias.
Definition result.h:88
Define Result, Status, and error helpers.