diff --git a/be/src/http/action/compaction_score_action.cpp b/be/src/http/action/compaction_score_action.cpp index 10b8cc6bdbab04..8c761f0951d369 100644 --- a/be/src/http/action/compaction_score_action.cpp +++ b/be/src/http/action/compaction_score_action.cpp @@ -62,8 +62,8 @@ constexpr std::string_view TABLET_ID = "tablet_id"; template concept CompactionScoreAccessble = requires(T t) { - { t.get_real_compaction_score() } -> std::same_as; -}; + { t.get_real_compaction_score() } -> std::same_as; + }; template std::vector calculate_compaction_scores( diff --git a/be/src/vec/data_types/serde/data_type_ipv6_serde.cpp b/be/src/vec/data_types/serde/data_type_ipv6_serde.cpp index 6d3e64e817b767..f9a692fc541f9b 100644 --- a/be/src/vec/data_types/serde/data_type_ipv6_serde.cpp +++ b/be/src/vec/data_types/serde/data_type_ipv6_serde.cpp @@ -69,28 +69,17 @@ Status DataTypeIPv6SerDe::write_column_to_mysql(const IColumn& column, } void DataTypeIPv6SerDe::read_one_cell_from_jsonb(IColumn& column, const JsonbValue* arg) const { - IPv6 val = 0; - const auto* str_value = static_cast(arg); - ReadBuffer rb(reinterpret_cast(str_value->getBlob()), - str_value->getBlobLen()); - if (!read_ipv6_text_impl(val, rb)) { - throw doris::Exception(ErrorCode::INVALID_ARGUMENT, "parse ipv6 fail, string: '{}'", - rb.to_string()); - } - assert_cast(column).insert_value(val); + const auto ip_value = static_cast(arg)->val(); + const IPv6* ip_val = reinterpret_cast(&ip_value); + assert_cast(column).insert_value(*ip_val); } void DataTypeIPv6SerDe::write_one_cell_to_jsonb(const IColumn& column, JsonbWriterT& result, Arena* mem_pool, int col_id, int row_num) const { - // we make ipv6 as string in jsonb result.writeKey(col_id); IPv6 data = assert_cast(column).get_element(row_num); - IPv6Value ipv6_value(data); - std::string ipv6_str = ipv6_value.to_string(); - result.writeStartString(); - result.writeString(ipv6_str.c_str(), ipv6_str.size()); - result.writeEndString(); + result.writeInt128(int128_t(data)); } Status DataTypeIPv6SerDe::serialize_one_cell_to_json(const IColumn& column, int row_num, diff --git a/be/src/vec/exec/format/json/new_json_reader.cpp b/be/src/vec/exec/format/json/new_json_reader.cpp index 4db2d62b9949e7..7dfc3c528cd88e 100644 --- a/be/src/vec/exec/format/json/new_json_reader.cpp +++ b/be/src/vec/exec/format/json/new_json_reader.cpp @@ -333,6 +333,11 @@ Status NewJsonReader::get_parsed_schema(std::vector* col_names, objectValue = _json_doc; } + if (!objectValue->IsObject()) { + return Status::DataQualityError("JSON data is not an object. but: {}", + objectValue->GetType()); + } + // use jsonpaths to col_names if (!_parsed_jsonpaths.empty()) { for (auto& _parsed_jsonpath : _parsed_jsonpaths) { diff --git a/regression-test/suites/datatype_p0/ip/test_ip_basic.groovy b/regression-test/suites/datatype_p0/ip/test_ip_basic.groovy index d8aeda9a6f2b97..468b6f6f146e14 100644 --- a/regression-test/suites/datatype_p0/ip/test_ip_basic.groovy +++ b/regression-test/suites/datatype_p0/ip/test_ip_basic.groovy @@ -157,7 +157,7 @@ suite("test_ip_basic") { sql """ Update table_ip set col1 = false where col0 = 1 """ qt_sql """ select * from table_ip """ sql """ Update table_ip set col24 = '127.0.0.1' where col0 = 1 """ - qt_sql """ select * from table_ip """ + qt_sql """ select * from table_ip where col0 = 1""" sql """ Update table_ip set col25 = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' where col0 = 1 """ - qt_sql """ select * from table_ip """ + qt_sql """ select * from table_ip where col0 = 1""" }