yiguolei commented on code in PR #51766:
URL: https://github.com/apache/doris/pull/51766#discussion_r2160600965
##########
be/src/util/jsonb_document.h:
##########
@@ -1660,6 +1586,45 @@ inline bool JsonbPath::parse_member(Stream* stream,
JsonbPath* path) {
return true;
}
+static_assert(is_pod_v<JsonbDocument>, "JsonbDocument must be standard layout
and trivial");
+static_assert(is_pod_v<JsonbValue>, "JsonbValue must be standard layout and
trivial");
+static_assert(is_pod_v<JsonbDecimal32>, "JsonbDecimal32 must be standard
layout and trivial");
+static_assert(is_pod_v<JsonbDecimal64>, "JsonbDecimal64 must be standard
layout and trivial");
+static_assert(is_pod_v<JsonbDecimal128>, "JsonbDecimal128 must be standard
layout and trivial");
+static_assert(is_pod_v<JsonbDecimal256>, "JsonbDecimal256 must be standard
layout and trivial");
+static_assert(is_pod_v<JsonbInt8Val>, "JsonbInt8Val must be standard layout
and trivial");
+static_assert(is_pod_v<JsonbInt32Val>, "JsonbInt32Val must be standard layout
and trivial");
+static_assert(is_pod_v<JsonbInt64Val>, "JsonbInt64Val must be standard layout
and trivial");
+static_assert(is_pod_v<JsonbInt128Val>, "JsonbInt128Val must be standard
layout and trivial");
+static_assert(is_pod_v<JsonbDoubleVal>, "JsonbDoubleVal must be standard
layout and trivial");
+static_assert(is_pod_v<JsonbFloatVal>, "JsonbFloatVal must be standard layout
and trivial");
+static_assert(is_pod_v<JsonbBinaryVal>, "JsonbBinaryVal must be standard
layout and trivial");
+static_assert(is_pod_v<ContainerVal>, "ContainerVal must be standard layout
and trivial");
+
+#define ASSERT_DECIMAL_LAYOUT(type) \
+ static_assert(offsetof(type, precision) == 0); \
+ static_assert(offsetof(type, scale) == 4); \
+ static_assert(offsetof(type, value) == 8);
+
+ASSERT_DECIMAL_LAYOUT(JsonbDecimal32)
+ASSERT_DECIMAL_LAYOUT(JsonbDecimal64)
+ASSERT_DECIMAL_LAYOUT(JsonbDecimal128)
+ASSERT_DECIMAL_LAYOUT(JsonbDecimal256)
+
Review Comment:
decimal value 需要把那个native type 里也加一下验证,可能是到decimal field 那个文件里去加这些check
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]