be/src/exprs/function/parse/variant_string_parse.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <array> |
21 | | #include <cmath> |
22 | | #include <cstddef> |
23 | | #include <cstdint> |
24 | | #include <memory> |
25 | | #include <string> |
26 | | |
27 | | #include "common/status.h" |
28 | | #include "core/value/variant/variant_batch_builder.h" |
29 | | #include "core/value/variant/variant_value.h" |
30 | | |
31 | | namespace cctz { |
32 | | class time_zone; |
33 | | } |
34 | | |
35 | | namespace doris { |
36 | | |
37 | | // Formatting state supplied by the column adapter. A null time zone means UTC. |
38 | | struct VariantJsonFormatOptions { |
39 | | const cctz::time_zone* timezone = nullptr; |
40 | | }; |
41 | | |
42 | | struct JsonToVariantOptions { |
43 | | uint32_t max_json_key_length = 255; |
44 | | // Text that is not a JSON document, including an empty string, fails the row. The Variant |
45 | | // serde turns this off because it mostly re-reads JSON that a Variant serde wrote: a value the |
46 | | // parser cannot read back, such as an integer beyond 64 bits, then keeps its text. |
47 | | bool throw_on_invalid_json = true; |
48 | | |
49 | | // Takes a value snapshot. Later changes to mutable config do not affect an encoder. |
50 | | static JsonToVariantOptions current_config(); |
51 | | }; |
52 | | |
53 | | // Reuses one JSON parser and one batch builder. Each add_json() collects into a stack-only row; |
54 | | // finish_batch() performs pass 2. A failed add_json() is terminal, as is a successful |
55 | | // finish_batch(). try_add_json() rolls back invalid input rows and keeps collecting. |
56 | | class JsonStringToVariantEncoder { |
57 | | public: |
58 | | JsonStringToVariantEncoder(); |
59 | | explicit JsonStringToVariantEncoder(JsonToVariantOptions options); |
60 | | ~JsonStringToVariantEncoder(); |
61 | | |
62 | | JsonStringToVariantEncoder(const JsonStringToVariantEncoder&) = delete; |
63 | | JsonStringToVariantEncoder& operator=(const JsonStringToVariantEncoder&) = delete; |
64 | | JsonStringToVariantEncoder(JsonStringToVariantEncoder&&) noexcept; |
65 | | JsonStringToVariantEncoder& operator=(JsonStringToVariantEncoder&&) noexcept; |
66 | | |
67 | | void add_json(StringRef json); |
68 | | Status try_add_json(StringRef json); |
69 | | VariantBatchBuilder finish_batch(); |
70 | | |
71 | | private: |
72 | | struct Impl; |
73 | | std::unique_ptr<Impl> _impl; |
74 | | }; |
75 | | |
76 | | namespace variant_json { |
77 | | |
78 | | struct FormattedScalar { |
79 | | std::array<char, 128> bytes {}; |
80 | | size_t size = 0; |
81 | | }; |
82 | | |
83 | | void require_json_depth(uint32_t depth); |
84 | | void require_exact_json_value(VariantRef value); |
85 | | void require_valid_json_utf8(StringRef value, const char* description); |
86 | | void require_json_object_key(StringRef key, StringRef previous_key, uint32_t field_index); |
87 | | [[noreturn]] void throw_unsupported_json_primitive(VariantPrimitiveId id); |
88 | | |
89 | | FormattedScalar format_json_int(int64_t value); |
90 | | FormattedScalar format_json_float(float value); |
91 | | FormattedScalar format_json_double(double value); |
92 | | FormattedScalar format_json_decimal(VariantDecimal value); |
93 | | FormattedScalar format_json_date(int32_t days_since_epoch); |
94 | | FormattedScalar format_json_timestamp(int64_t value, uint8_t fractional_digits, bool utc_adjusted, |
95 | | const cctz::time_zone* timezone); |
96 | | FormattedScalar format_json_time_micros(int64_t value); |
97 | | FormattedScalar format_json_uuid(const std::array<uint8_t, 16>& value); |
98 | | |
99 | | template <typename Writer, size_t N> |
100 | 444k | void write_literal(Writer& out, const char (&value)[N]) { |
101 | 444k | out.write(value, N - 1); |
102 | 444k | } column_variant_v2_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_110JsonWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 1.43k | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 1.43k | out.write(value, N - 1); | 102 | 1.43k | } |
Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_110JsonWriterELm5EEEvRT_RAT0__Kc Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_110JsonWriterELm6EEEvRT_RAT0__Kc Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_110JsonWriterELm11EEEvRT_RAT0__Kc Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_110JsonWriterELm12EEEvRT_RAT0__Kc function_variant_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 26 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 26 | out.write(value, N - 1); | 102 | 26 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 100 | 4 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 4 | out.write(value, N - 1); | 102 | 4 | } |
Unexecuted instantiation: function_variant_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm6EEEvRT_RAT0__Kc Unexecuted instantiation: function_variant_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm11EEEvRT_RAT0__Kc Unexecuted instantiation: function_variant_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm12EEEvRT_RAT0__Kc segment_flusher_format_test.cpp:_ZN5doris12variant_json13write_literalIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterLm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 284 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 284 | out.write(value, N - 1); | 102 | 284 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json13write_literalIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterLm5EEEvRT_RAT0__Kc Line | Count | Source | 100 | 15 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 15 | out.write(value, N - 1); | 102 | 15 | } |
Unexecuted instantiation: segment_flusher_format_test.cpp:_ZN5doris12variant_json13write_literalIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterLm6EEEvRT_RAT0__Kc Unexecuted instantiation: segment_flusher_format_test.cpp:_ZN5doris12variant_json13write_literalIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterLm11EEEvRT_RAT0__Kc Unexecuted instantiation: segment_flusher_format_test.cpp:_ZN5doris12variant_json13write_literalIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterLm12EEEvRT_RAT0__Kc hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_117VariantJsonWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 31 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 31 | out.write(value, N - 1); | 102 | 31 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_117VariantJsonWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 100 | 2 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 2 | out.write(value, N - 1); | 102 | 2 | } |
Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_117VariantJsonWriterELm6EEEvRT_RAT0__Kc Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_117VariantJsonWriterELm11EEEvRT_RAT0__Kc Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_117VariantJsonWriterELm12EEEvRT_RAT0__Kc variant_assembler_legacy_test.cpp:_ZN5doris12variant_json13write_literalINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 524 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 524 | out.write(value, N - 1); | 102 | 524 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json13write_literalINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 100 | 48 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 48 | out.write(value, N - 1); | 102 | 48 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json13write_literalINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterELm6EEEvRT_RAT0__Kc Line | Count | Source | 100 | 1 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 1 | out.write(value, N - 1); | 102 | 1 | } |
Unexecuted instantiation: variant_assembler_legacy_test.cpp:_ZN5doris12variant_json13write_literalINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterELm11EEEvRT_RAT0__Kc Unexecuted instantiation: variant_assembler_legacy_test.cpp:_ZN5doris12variant_json13write_literalINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterELm12EEEvRT_RAT0__Kc variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 528 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 528 | out.write(value, N - 1); | 102 | 528 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 100 | 9 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 9 | out.write(value, N - 1); | 102 | 9 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm6EEEvRT_RAT0__Kc Line | Count | Source | 100 | 3 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 3 | out.write(value, N - 1); | 102 | 3 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm11EEEvRT_RAT0__Kc Line | Count | Source | 100 | 1 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 1 | out.write(value, N - 1); | 102 | 1 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm12EEEvRT_RAT0__Kc Line | Count | Source | 100 | 1 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 1 | out.write(value, N - 1); | 102 | 1 | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 238k | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 238k | out.write(value, N - 1); | 102 | 238k | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm5EEEvRT_RAT0__Kc Line | Count | Source | 100 | 41 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 41 | out.write(value, N - 1); | 102 | 41 | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm6EEEvRT_RAT0__Kc Line | Count | Source | 100 | 6 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 6 | out.write(value, N - 1); | 102 | 6 | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm11EEEvRT_RAT0__Kc Line | Count | Source | 100 | 6 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 6 | out.write(value, N - 1); | 102 | 6 | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm12EEEvRT_RAT0__Kc Line | Count | Source | 100 | 6 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 6 | out.write(value, N - 1); | 102 | 6 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 202k | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 202k | out.write(value, N - 1); | 102 | 202k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 100 | 48 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 48 | out.write(value, N - 1); | 102 | 48 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm6EEEvRT_RAT0__Kc Line | Count | Source | 100 | 10 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 10 | out.write(value, N - 1); | 102 | 10 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm11EEEvRT_RAT0__Kc Line | Count | Source | 100 | 10 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 10 | out.write(value, N - 1); | 102 | 10 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm12EEEvRT_RAT0__Kc Line | Count | Source | 100 | 10 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 10 | out.write(value, N - 1); | 102 | 10 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 100 | 130 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 130 | out.write(value, N - 1); | 102 | 130 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 100 | 16 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 16 | out.write(value, N - 1); | 102 | 16 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm6EEEvRT_RAT0__Kc Line | Count | Source | 100 | 8 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 8 | out.write(value, N - 1); | 102 | 8 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm11EEEvRT_RAT0__Kc Line | Count | Source | 100 | 8 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 8 | out.write(value, N - 1); | 102 | 8 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm12EEEvRT_RAT0__Kc Line | Count | Source | 100 | 8 | void write_literal(Writer& out, const char (&value)[N]) { | 101 | 8 | out.write(value, N - 1); | 102 | 8 | } |
|
103 | | |
104 | | template <typename Writer> |
105 | 47.7k | void write_scalar(Writer& out, const FormattedScalar& value) { |
106 | 47.7k | out.write(value.bytes.data(), value.size); |
107 | 47.7k | } column_variant_v2_test.cpp:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_110JsonWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 321 | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 321 | out.write(value.bytes.data(), value.size); | 107 | 321 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_112StringWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 8 | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 8 | out.write(value.bytes.data(), value.size); | 107 | 8 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json12write_scalarIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 29 | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 29 | out.write(value.bytes.data(), value.size); | 107 | 29 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 2 | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 2 | out.write(value.bytes.data(), value.size); | 107 | 2 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json12write_scalarINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 114 | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 114 | out.write(value.bytes.data(), value.size); | 107 | 114 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_112StringWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 33 | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 33 | out.write(value.bytes.data(), value.size); | 107 | 33 | } |
_ZN5doris12variant_json12write_scalarINS_14BufferWritableEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 25.9k | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 25.9k | out.write(value.bytes.data(), value.size); | 107 | 25.9k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_114CountingWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 21.2k | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 21.2k | out.write(value.bytes.data(), value.size); | 107 | 21.2k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_111FixedWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 105 | 39 | void write_scalar(Writer& out, const FormattedScalar& value) { | 106 | 39 | out.write(value.bytes.data(), value.size); | 107 | 39 | } |
|
108 | | |
109 | | template <typename Writer> |
110 | 106 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { |
111 | 106 | write_literal(out, "\""); |
112 | 106 | write_scalar(out, value); |
113 | 106 | write_literal(out, "\""); |
114 | 106 | } Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_110JsonWriterEEEvRT_RKNS0_15FormattedScalarE Unexecuted instantiation: function_variant_parse_test.cpp:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_112StringWriterEEEvRT_RKNS0_15FormattedScalarE Unexecuted instantiation: segment_flusher_format_test.cpp:_ZN5doris12variant_json19write_quoted_scalarIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_RKNS0_15FormattedScalarE Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_RKNS0_15FormattedScalarE variant_assembler_legacy_test.cpp:_ZN5doris12variant_json19write_quoted_scalarINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 110 | 52 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 111 | 52 | write_literal(out, "\""); | 112 | 52 | write_scalar(out, value); | 113 | 52 | write_literal(out, "\""); | 114 | 52 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_112StringWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 110 | 13 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 111 | 13 | write_literal(out, "\""); | 112 | 13 | write_scalar(out, value); | 113 | 13 | write_literal(out, "\""); | 114 | 13 | } |
_ZN5doris12variant_json19write_quoted_scalarINS_14BufferWritableEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 110 | 7 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 111 | 7 | write_literal(out, "\""); | 112 | 7 | write_scalar(out, value); | 113 | 7 | write_literal(out, "\""); | 114 | 7 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_114CountingWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 110 | 20 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 111 | 20 | write_literal(out, "\""); | 112 | 20 | write_scalar(out, value); | 113 | 20 | write_literal(out, "\""); | 114 | 20 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_111FixedWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 110 | 14 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 111 | 14 | write_literal(out, "\""); | 112 | 14 | write_scalar(out, value); | 113 | 14 | write_literal(out, "\""); | 114 | 14 | } |
|
115 | | |
116 | | template <typename Writer> |
117 | 122k | void write_escaped_json_string(Writer& out, StringRef value) { |
118 | 122k | write_literal(out, "\""); |
119 | 122k | size_t plain_begin = 0; |
120 | 122k | size_t index = 0; |
121 | 2.73M | while (index < value.size) { |
122 | 2.61M | const auto byte = static_cast<uint8_t>(value.data[index]); |
123 | 2.61M | const char* escaped = nullptr; |
124 | 2.61M | size_t escaped_size = 0; |
125 | 2.61M | size_t consumed = 1; |
126 | 2.61M | switch (byte) { |
127 | 57 | case '"': |
128 | 57 | escaped = "\\\""; |
129 | 57 | escaped_size = 2; |
130 | 57 | break; |
131 | 3 | case '\\': |
132 | 3 | escaped = "\\\\"; |
133 | 3 | escaped_size = 2; |
134 | 3 | break; |
135 | 0 | case '\b': |
136 | 0 | escaped = "\\b"; |
137 | 0 | escaped_size = 2; |
138 | 0 | break; |
139 | 0 | case '\f': |
140 | 0 | escaped = "\\f"; |
141 | 0 | escaped_size = 2; |
142 | 0 | break; |
143 | 21 | case '\n': |
144 | 21 | escaped = "\\n"; |
145 | 21 | escaped_size = 2; |
146 | 21 | break; |
147 | 0 | case '\r': |
148 | 0 | escaped = "\\r"; |
149 | 0 | escaped_size = 2; |
150 | 0 | break; |
151 | 1 | case '\t': |
152 | 1 | escaped = "\\t"; |
153 | 1 | escaped_size = 2; |
154 | 1 | break; |
155 | 2.61M | default: |
156 | 2.61M | if (byte < 0x20) { |
157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; |
158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; |
159 | 0 | if (index != plain_begin) { |
160 | 0 | out.write(value.data + plain_begin, index - plain_begin); |
161 | 0 | } |
162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); |
163 | 0 | ++index; |
164 | 0 | plain_begin = index; |
165 | 0 | continue; |
166 | 0 | } |
167 | 2.61M | if (index + 2 < value.size && byte == 0xE2 && |
168 | 2.61M | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && |
169 | 2.61M | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || |
170 | 1 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { |
171 | 1 | escaped = |
172 | 1 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; |
173 | 1 | escaped_size = 6; |
174 | 1 | consumed = 3; |
175 | 1 | } |
176 | 2.61M | break; |
177 | 2.61M | } |
178 | 2.61M | if (escaped == nullptr) { |
179 | 2.61M | ++index; |
180 | 2.61M | continue; |
181 | 2.61M | } |
182 | 83 | if (index != plain_begin) { |
183 | 62 | out.write(value.data + plain_begin, index - plain_begin); |
184 | 62 | } |
185 | 83 | out.write(escaped, escaped_size); |
186 | 83 | index += consumed; |
187 | 83 | plain_begin = index; |
188 | 83 | } |
189 | 122k | if (plain_begin != value.size) { |
190 | 122k | out.write(value.data + plain_begin, value.size - plain_begin); |
191 | 122k | } |
192 | 122k | write_literal(out, "\""); |
193 | 122k | } column_variant_v2_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefE Line | Count | Source | 117 | 309 | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 309 | write_literal(out, "\""); | 119 | 309 | size_t plain_begin = 0; | 120 | 309 | size_t index = 0; | 121 | 1.06k | while (index < value.size) { | 122 | 752 | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 752 | const char* escaped = nullptr; | 124 | 752 | size_t escaped_size = 0; | 125 | 752 | size_t consumed = 1; | 126 | 752 | switch (byte) { | 127 | 0 | case '"': | 128 | 0 | escaped = "\\\""; | 129 | 0 | escaped_size = 2; | 130 | 0 | break; | 131 | 0 | case '\\': | 132 | 0 | escaped = "\\\\"; | 133 | 0 | escaped_size = 2; | 134 | 0 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 0 | case '\n': | 144 | 0 | escaped = "\\n"; | 145 | 0 | escaped_size = 2; | 146 | 0 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 0 | case '\t': | 152 | 0 | escaped = "\\t"; | 153 | 0 | escaped_size = 2; | 154 | 0 | break; | 155 | 752 | default: | 156 | 752 | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 752 | if (index + 2 < value.size && byte == 0xE2 && | 168 | 752 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 752 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 0 | escaped = | 172 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 0 | escaped_size = 6; | 174 | 0 | consumed = 3; | 175 | 0 | } | 176 | 752 | break; | 177 | 752 | } | 178 | 752 | if (escaped == nullptr) { | 179 | 752 | ++index; | 180 | 752 | continue; | 181 | 752 | } | 182 | 0 | if (index != plain_begin) { | 183 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 0 | } | 185 | 0 | out.write(escaped, escaped_size); | 186 | 0 | index += consumed; | 187 | 0 | plain_begin = index; | 188 | 0 | } | 189 | 309 | if (plain_begin != value.size) { | 190 | 309 | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 309 | } | 192 | 309 | write_literal(out, "\""); | 193 | 309 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefE Line | Count | Source | 117 | 4 | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 4 | write_literal(out, "\""); | 119 | 4 | size_t plain_begin = 0; | 120 | 4 | size_t index = 0; | 121 | 12 | while (index < value.size) { | 122 | 8 | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 8 | const char* escaped = nullptr; | 124 | 8 | size_t escaped_size = 0; | 125 | 8 | size_t consumed = 1; | 126 | 8 | switch (byte) { | 127 | 0 | case '"': | 128 | 0 | escaped = "\\\""; | 129 | 0 | escaped_size = 2; | 130 | 0 | break; | 131 | 0 | case '\\': | 132 | 0 | escaped = "\\\\"; | 133 | 0 | escaped_size = 2; | 134 | 0 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 0 | case '\n': | 144 | 0 | escaped = "\\n"; | 145 | 0 | escaped_size = 2; | 146 | 0 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 0 | case '\t': | 152 | 0 | escaped = "\\t"; | 153 | 0 | escaped_size = 2; | 154 | 0 | break; | 155 | 8 | default: | 156 | 8 | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 8 | if (index + 2 < value.size && byte == 0xE2 && | 168 | 8 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 8 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 0 | escaped = | 172 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 0 | escaped_size = 6; | 174 | 0 | consumed = 3; | 175 | 0 | } | 176 | 8 | break; | 177 | 8 | } | 178 | 8 | if (escaped == nullptr) { | 179 | 8 | ++index; | 180 | 8 | continue; | 181 | 8 | } | 182 | 0 | if (index != plain_begin) { | 183 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 0 | } | 185 | 0 | out.write(escaped, escaped_size); | 186 | 0 | index += consumed; | 187 | 0 | plain_begin = index; | 188 | 0 | } | 189 | 4 | if (plain_begin != value.size) { | 190 | 4 | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 4 | } | 192 | 4 | write_literal(out, "\""); | 193 | 4 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_NS_9StringRefE Line | Count | Source | 117 | 64 | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 64 | write_literal(out, "\""); | 119 | 64 | size_t plain_begin = 0; | 120 | 64 | size_t index = 0; | 121 | 336 | while (index < value.size) { | 122 | 272 | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 272 | const char* escaped = nullptr; | 124 | 272 | size_t escaped_size = 0; | 125 | 272 | size_t consumed = 1; | 126 | 272 | switch (byte) { | 127 | 0 | case '"': | 128 | 0 | escaped = "\\\""; | 129 | 0 | escaped_size = 2; | 130 | 0 | break; | 131 | 0 | case '\\': | 132 | 0 | escaped = "\\\\"; | 133 | 0 | escaped_size = 2; | 134 | 0 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 0 | case '\n': | 144 | 0 | escaped = "\\n"; | 145 | 0 | escaped_size = 2; | 146 | 0 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 0 | case '\t': | 152 | 0 | escaped = "\\t"; | 153 | 0 | escaped_size = 2; | 154 | 0 | break; | 155 | 272 | default: | 156 | 272 | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 272 | if (index + 2 < value.size && byte == 0xE2 && | 168 | 272 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 272 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 0 | escaped = | 172 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 0 | escaped_size = 6; | 174 | 0 | consumed = 3; | 175 | 0 | } | 176 | 272 | break; | 177 | 272 | } | 178 | 272 | if (escaped == nullptr) { | 179 | 272 | ++index; | 180 | 272 | continue; | 181 | 272 | } | 182 | 0 | if (index != plain_begin) { | 183 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 0 | } | 185 | 0 | out.write(escaped, escaped_size); | 186 | 0 | index += consumed; | 187 | 0 | plain_begin = index; | 188 | 0 | } | 189 | 64 | if (plain_begin != value.size) { | 190 | 64 | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 64 | } | 192 | 64 | write_literal(out, "\""); | 193 | 64 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_NS_9StringRefE Line | Count | Source | 117 | 8 | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 8 | write_literal(out, "\""); | 119 | 8 | size_t plain_begin = 0; | 120 | 8 | size_t index = 0; | 121 | 33 | while (index < value.size) { | 122 | 25 | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 25 | const char* escaped = nullptr; | 124 | 25 | size_t escaped_size = 0; | 125 | 25 | size_t consumed = 1; | 126 | 25 | switch (byte) { | 127 | 0 | case '"': | 128 | 0 | escaped = "\\\""; | 129 | 0 | escaped_size = 2; | 130 | 0 | break; | 131 | 0 | case '\\': | 132 | 0 | escaped = "\\\\"; | 133 | 0 | escaped_size = 2; | 134 | 0 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 0 | case '\n': | 144 | 0 | escaped = "\\n"; | 145 | 0 | escaped_size = 2; | 146 | 0 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 0 | case '\t': | 152 | 0 | escaped = "\\t"; | 153 | 0 | escaped_size = 2; | 154 | 0 | break; | 155 | 25 | default: | 156 | 25 | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 25 | if (index + 2 < value.size && byte == 0xE2 && | 168 | 25 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 25 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 0 | escaped = | 172 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 0 | escaped_size = 6; | 174 | 0 | consumed = 3; | 175 | 0 | } | 176 | 25 | break; | 177 | 25 | } | 178 | 25 | if (escaped == nullptr) { | 179 | 25 | ++index; | 180 | 25 | continue; | 181 | 25 | } | 182 | 0 | if (index != plain_begin) { | 183 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 0 | } | 185 | 0 | out.write(escaped, escaped_size); | 186 | 0 | index += consumed; | 187 | 0 | plain_begin = index; | 188 | 0 | } | 189 | 8 | if (plain_begin != value.size) { | 190 | 8 | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 8 | } | 192 | 8 | write_literal(out, "\""); | 193 | 8 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefE Line | Count | Source | 117 | 84 | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 84 | write_literal(out, "\""); | 119 | 84 | size_t plain_begin = 0; | 120 | 84 | size_t index = 0; | 121 | 268 | while (index < value.size) { | 122 | 184 | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 184 | const char* escaped = nullptr; | 124 | 184 | size_t escaped_size = 0; | 125 | 184 | size_t consumed = 1; | 126 | 184 | switch (byte) { | 127 | 0 | case '"': | 128 | 0 | escaped = "\\\""; | 129 | 0 | escaped_size = 2; | 130 | 0 | break; | 131 | 0 | case '\\': | 132 | 0 | escaped = "\\\\"; | 133 | 0 | escaped_size = 2; | 134 | 0 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 0 | case '\n': | 144 | 0 | escaped = "\\n"; | 145 | 0 | escaped_size = 2; | 146 | 0 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 0 | case '\t': | 152 | 0 | escaped = "\\t"; | 153 | 0 | escaped_size = 2; | 154 | 0 | break; | 155 | 184 | default: | 156 | 184 | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 184 | if (index + 2 < value.size && byte == 0xE2 && | 168 | 184 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 184 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 0 | escaped = | 172 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 0 | escaped_size = 6; | 174 | 0 | consumed = 3; | 175 | 0 | } | 176 | 184 | break; | 177 | 184 | } | 178 | 184 | if (escaped == nullptr) { | 179 | 184 | ++index; | 180 | 184 | continue; | 181 | 184 | } | 182 | 0 | if (index != plain_begin) { | 183 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 0 | } | 185 | 0 | out.write(escaped, escaped_size); | 186 | 0 | index += consumed; | 187 | 0 | plain_begin = index; | 188 | 0 | } | 189 | 84 | if (plain_begin != value.size) { | 190 | 82 | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 82 | } | 192 | 84 | write_literal(out, "\""); | 193 | 84 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefE Line | Count | Source | 117 | 24 | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 24 | write_literal(out, "\""); | 119 | 24 | size_t plain_begin = 0; | 120 | 24 | size_t index = 0; | 121 | 137 | while (index < value.size) { | 122 | 113 | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 113 | const char* escaped = nullptr; | 124 | 113 | size_t escaped_size = 0; | 125 | 113 | size_t consumed = 1; | 126 | 113 | switch (byte) { | 127 | 1 | case '"': | 128 | 1 | escaped = "\\\""; | 129 | 1 | escaped_size = 2; | 130 | 1 | break; | 131 | 1 | case '\\': | 132 | 1 | escaped = "\\\\"; | 133 | 1 | escaped_size = 2; | 134 | 1 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 1 | case '\n': | 144 | 1 | escaped = "\\n"; | 145 | 1 | escaped_size = 2; | 146 | 1 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 1 | case '\t': | 152 | 1 | escaped = "\\t"; | 153 | 1 | escaped_size = 2; | 154 | 1 | break; | 155 | 109 | default: | 156 | 109 | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 109 | if (index + 2 < value.size && byte == 0xE2 && | 168 | 109 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 109 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 1 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 1 | escaped = | 172 | 1 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 1 | escaped_size = 6; | 174 | 1 | consumed = 3; | 175 | 1 | } | 176 | 109 | break; | 177 | 113 | } | 178 | 113 | if (escaped == nullptr) { | 179 | 108 | ++index; | 180 | 108 | continue; | 181 | 108 | } | 182 | 5 | if (index != plain_begin) { | 183 | 2 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 2 | } | 185 | 5 | out.write(escaped, escaped_size); | 186 | 5 | index += consumed; | 187 | 5 | plain_begin = index; | 188 | 5 | } | 189 | 24 | if (plain_begin != value.size) { | 190 | 22 | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 22 | } | 192 | 24 | write_literal(out, "\""); | 193 | 24 | } |
_ZN5doris12variant_json25write_escaped_json_stringINS_14BufferWritableEEEvRT_NS_9StringRefE Line | Count | Source | 117 | 65.9k | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 65.9k | write_literal(out, "\""); | 119 | 65.9k | size_t plain_begin = 0; | 120 | 65.9k | size_t index = 0; | 121 | 1.38M | while (index < value.size) { | 122 | 1.32M | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 1.32M | const char* escaped = nullptr; | 124 | 1.32M | size_t escaped_size = 0; | 125 | 1.32M | size_t consumed = 1; | 126 | 1.32M | switch (byte) { | 127 | 11 | case '"': | 128 | 11 | escaped = "\\\""; | 129 | 11 | escaped_size = 2; | 130 | 11 | break; | 131 | 1 | case '\\': | 132 | 1 | escaped = "\\\\"; | 133 | 1 | escaped_size = 2; | 134 | 1 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 5 | case '\n': | 144 | 5 | escaped = "\\n"; | 145 | 5 | escaped_size = 2; | 146 | 5 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 0 | case '\t': | 152 | 0 | escaped = "\\t"; | 153 | 0 | escaped_size = 2; | 154 | 0 | break; | 155 | 1.32M | default: | 156 | 1.32M | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 1.32M | if (index + 2 < value.size && byte == 0xE2 && | 168 | 1.32M | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 1.32M | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 0 | escaped = | 172 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 0 | escaped_size = 6; | 174 | 0 | consumed = 3; | 175 | 0 | } | 176 | 1.32M | break; | 177 | 1.32M | } | 178 | 1.32M | if (escaped == nullptr) { | 179 | 1.32M | ++index; | 180 | 1.32M | continue; | 181 | 1.32M | } | 182 | 17 | if (index != plain_begin) { | 183 | 13 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 13 | } | 185 | 17 | out.write(escaped, escaped_size); | 186 | 17 | index += consumed; | 187 | 17 | plain_begin = index; | 188 | 17 | } | 189 | 65.9k | if (plain_begin != value.size) { | 190 | 65.9k | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 65.9k | } | 192 | 65.9k | write_literal(out, "\""); | 193 | 65.9k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_114CountingWriterEEEvRT_NS_9StringRefE Line | Count | Source | 117 | 56.3k | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 56.3k | write_literal(out, "\""); | 119 | 56.3k | size_t plain_begin = 0; | 120 | 56.3k | size_t index = 0; | 121 | 1.34M | while (index < value.size) { | 122 | 1.28M | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 1.28M | const char* escaped = nullptr; | 124 | 1.28M | size_t escaped_size = 0; | 125 | 1.28M | size_t consumed = 1; | 126 | 1.28M | switch (byte) { | 127 | 27 | case '"': | 128 | 27 | escaped = "\\\""; | 129 | 27 | escaped_size = 2; | 130 | 27 | break; | 131 | 1 | case '\\': | 132 | 1 | escaped = "\\\\"; | 133 | 1 | escaped_size = 2; | 134 | 1 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 9 | case '\n': | 144 | 9 | escaped = "\\n"; | 145 | 9 | escaped_size = 2; | 146 | 9 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 0 | case '\t': | 152 | 0 | escaped = "\\t"; | 153 | 0 | escaped_size = 2; | 154 | 0 | break; | 155 | 1.28M | default: | 156 | 1.28M | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 1.28M | if (index + 2 < value.size && byte == 0xE2 && | 168 | 1.28M | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 1.28M | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 0 | escaped = | 172 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 0 | escaped_size = 6; | 174 | 0 | consumed = 3; | 175 | 0 | } | 176 | 1.28M | break; | 177 | 1.28M | } | 178 | 1.28M | if (escaped == nullptr) { | 179 | 1.28M | ++index; | 180 | 1.28M | continue; | 181 | 1.28M | } | 182 | 37 | if (index != plain_begin) { | 183 | 29 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 29 | } | 185 | 37 | out.write(escaped, escaped_size); | 186 | 37 | index += consumed; | 187 | 37 | plain_begin = index; | 188 | 37 | } | 189 | 56.3k | if (plain_begin != value.size) { | 190 | 56.3k | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 56.3k | } | 192 | 56.3k | write_literal(out, "\""); | 193 | 56.3k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_111FixedWriterEEEvRT_NS_9StringRefE Line | Count | Source | 117 | 34 | void write_escaped_json_string(Writer& out, StringRef value) { | 118 | 34 | write_literal(out, "\""); | 119 | 34 | size_t plain_begin = 0; | 120 | 34 | size_t index = 0; | 121 | 167 | while (index < value.size) { | 122 | 133 | const auto byte = static_cast<uint8_t>(value.data[index]); | 123 | 133 | const char* escaped = nullptr; | 124 | 133 | size_t escaped_size = 0; | 125 | 133 | size_t consumed = 1; | 126 | 133 | switch (byte) { | 127 | 18 | case '"': | 128 | 18 | escaped = "\\\""; | 129 | 18 | escaped_size = 2; | 130 | 18 | break; | 131 | 0 | case '\\': | 132 | 0 | escaped = "\\\\"; | 133 | 0 | escaped_size = 2; | 134 | 0 | break; | 135 | 0 | case '\b': | 136 | 0 | escaped = "\\b"; | 137 | 0 | escaped_size = 2; | 138 | 0 | break; | 139 | 0 | case '\f': | 140 | 0 | escaped = "\\f"; | 141 | 0 | escaped_size = 2; | 142 | 0 | break; | 143 | 6 | case '\n': | 144 | 6 | escaped = "\\n"; | 145 | 6 | escaped_size = 2; | 146 | 6 | break; | 147 | 0 | case '\r': | 148 | 0 | escaped = "\\r"; | 149 | 0 | escaped_size = 2; | 150 | 0 | break; | 151 | 0 | case '\t': | 152 | 0 | escaped = "\\t"; | 153 | 0 | escaped_size = 2; | 154 | 0 | break; | 155 | 109 | default: | 156 | 109 | if (byte < 0x20) { | 157 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 158 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 159 | 0 | if (index != plain_begin) { | 160 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 161 | 0 | } | 162 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 163 | 0 | ++index; | 164 | 0 | plain_begin = index; | 165 | 0 | continue; | 166 | 0 | } | 167 | 109 | if (index + 2 < value.size && byte == 0xE2 && | 168 | 109 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 169 | 109 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 171 | 0 | escaped = | 172 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 173 | 0 | escaped_size = 6; | 174 | 0 | consumed = 3; | 175 | 0 | } | 176 | 109 | break; | 177 | 133 | } | 178 | 133 | if (escaped == nullptr) { | 179 | 109 | ++index; | 180 | 109 | continue; | 181 | 109 | } | 182 | 24 | if (index != plain_begin) { | 183 | 18 | out.write(value.data + plain_begin, index - plain_begin); | 184 | 18 | } | 185 | 24 | out.write(escaped, escaped_size); | 186 | 24 | index += consumed; | 187 | 24 | plain_begin = index; | 188 | 24 | } | 189 | 34 | if (plain_begin != value.size) { | 190 | 22 | out.write(value.data + plain_begin, value.size - plain_begin); | 191 | 22 | } | 192 | 34 | write_literal(out, "\""); | 193 | 34 | } |
|
194 | | |
195 | | template <typename Writer> |
196 | 38.3k | void write_json_string(Writer& out, StringRef value, const char* description) { |
197 | 38.3k | require_valid_json_utf8(value, description); |
198 | 38.3k | write_escaped_json_string(out, value); |
199 | 38.3k | } column_variant_v2_test.cpp:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 196 | 4 | void write_json_string(Writer& out, StringRef value, const char* description) { | 197 | 4 | require_valid_json_utf8(value, description); | 198 | 4 | write_escaped_json_string(out, value); | 199 | 4 | } |
Unexecuted instantiation: function_variant_parse_test.cpp:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefEPKc segment_flusher_format_test.cpp:_ZN5doris12variant_json17write_json_stringIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_NS_9StringRefEPKc Line | Count | Source | 196 | 8 | void write_json_string(Writer& out, StringRef value, const char* description) { | 197 | 8 | require_valid_json_utf8(value, description); | 198 | 8 | write_escaped_json_string(out, value); | 199 | 8 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 196 | 3 | void write_json_string(Writer& out, StringRef value, const char* description) { | 197 | 3 | require_valid_json_utf8(value, description); | 198 | 3 | write_escaped_json_string(out, value); | 199 | 3 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json17write_json_stringINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 196 | 13 | void write_json_string(Writer& out, StringRef value, const char* description) { | 197 | 13 | require_valid_json_utf8(value, description); | 198 | 13 | write_escaped_json_string(out, value); | 199 | 13 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 196 | 8 | void write_json_string(Writer& out, StringRef value, const char* description) { | 197 | 8 | require_valid_json_utf8(value, description); | 198 | 8 | write_escaped_json_string(out, value); | 199 | 8 | } |
_ZN5doris12variant_json17write_json_stringINS_14BufferWritableEEEvRT_NS_9StringRefEPKc Line | Count | Source | 196 | 20.3k | void write_json_string(Writer& out, StringRef value, const char* description) { | 197 | 20.3k | require_valid_json_utf8(value, description); | 198 | 20.3k | write_escaped_json_string(out, value); | 199 | 20.3k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_114CountingWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 196 | 17.9k | void write_json_string(Writer& out, StringRef value, const char* description) { | 197 | 17.9k | require_valid_json_utf8(value, description); | 198 | 17.9k | write_escaped_json_string(out, value); | 199 | 17.9k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_111FixedWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 196 | 30 | void write_json_string(Writer& out, StringRef value, const char* description) { | 197 | 30 | require_valid_json_utf8(value, description); | 198 | 30 | write_escaped_json_string(out, value); | 199 | 30 | } |
|
200 | | |
201 | | template <typename Writer> |
202 | 2 | void write_json_binary(Writer& out, StringRef value) { |
203 | 2 | static constexpr char BASE64[] = |
204 | 2 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
205 | 2 | write_literal(out, "\""); |
206 | 2 | std::array<char, 1024> encoded {}; |
207 | 2 | size_t encoded_size = 0; |
208 | 2 | size_t index = 0; |
209 | 2 | const auto flush = [&]() { |
210 | 2 | if (encoded_size != 0) { |
211 | 2 | out.write(encoded.data(), encoded_size); |
212 | 2 | encoded_size = 0; |
213 | 2 | } |
214 | 2 | }; Unexecuted instantiation: column_variant_v2_test.cpp:_ZZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefEENKUlvE_clEv Unexecuted instantiation: function_variant_parse_test.cpp:_ZZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefEENKUlvE_clEv Unexecuted instantiation: segment_flusher_format_test.cpp:_ZZN5doris12variant_json17write_json_binaryIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_NS_9StringRefEENKUlvE_clEv Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_NS_9StringRefEENKUlvE_clEv Unexecuted instantiation: variant_assembler_legacy_test.cpp:_ZZN5doris12variant_json17write_json_binaryINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefEENKUlvE_clEv variant_string_parse_test.cpp:_ZZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefEENKUlvE_clEv Line | Count | Source | 209 | 1 | const auto flush = [&]() { | 210 | 1 | if (encoded_size != 0) { | 211 | 1 | out.write(encoded.data(), encoded_size); | 212 | 1 | encoded_size = 0; | 213 | 1 | } | 214 | 1 | }; |
_ZZN5doris12variant_json17write_json_binaryINS_14BufferWritableEEEvRT_NS_9StringRefEENKUlvE_clEv Line | Count | Source | 209 | 1 | const auto flush = [&]() { | 210 | 1 | if (encoded_size != 0) { | 211 | 1 | out.write(encoded.data(), encoded_size); | 212 | 1 | encoded_size = 0; | 213 | 1 | } | 214 | 1 | }; |
Unexecuted instantiation: unity_5_cxx.cxx:_ZZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_114CountingWriterEEEvRT_NS_9StringRefEENKUlvE_clEv Unexecuted instantiation: unity_5_cxx.cxx:_ZZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_111FixedWriterEEEvRT_NS_9StringRefEENKUlvE_clEv |
215 | 3 | while (index + 3 <= value.size) { |
216 | 1 | if (encoded.size() - encoded_size < 4) { |
217 | 0 | flush(); |
218 | 0 | } |
219 | 1 | const auto first = static_cast<uint8_t>(value.data[index]); |
220 | 1 | const auto second = static_cast<uint8_t>(value.data[index + 1]); |
221 | 1 | const auto third = static_cast<uint8_t>(value.data[index + 2]); |
222 | 1 | encoded[encoded_size++] = BASE64[first >> 2]; |
223 | 1 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; |
224 | 1 | encoded[encoded_size++] = BASE64[((second & 0x0F) << 2) | (third >> 6)]; |
225 | 1 | encoded[encoded_size++] = BASE64[third & 0x3F]; |
226 | 1 | index += 3; |
227 | 1 | } |
228 | 2 | if (index != value.size) { |
229 | 2 | if (encoded.size() - encoded_size < 4) { |
230 | 0 | flush(); |
231 | 0 | } |
232 | 2 | const auto first = static_cast<uint8_t>(value.data[index]); |
233 | 2 | encoded[encoded_size++] = BASE64[first >> 2]; |
234 | 2 | if (index + 1 == value.size) { |
235 | 1 | encoded[encoded_size++] = BASE64[(first & 0x03) << 4]; |
236 | 1 | encoded[encoded_size++] = '='; |
237 | 1 | encoded[encoded_size++] = '='; |
238 | 1 | } else { |
239 | 1 | const auto second = static_cast<uint8_t>(value.data[index + 1]); |
240 | 1 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; |
241 | 1 | encoded[encoded_size++] = BASE64[(second & 0x0F) << 2]; |
242 | 1 | encoded[encoded_size++] = '='; |
243 | 1 | } |
244 | 2 | } |
245 | 2 | flush(); |
246 | 2 | write_literal(out, "\""); |
247 | 2 | } Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefE Unexecuted instantiation: function_variant_parse_test.cpp:_ZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefE Unexecuted instantiation: segment_flusher_format_test.cpp:_ZN5doris12variant_json17write_json_binaryIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_NS_9StringRefE Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_NS_9StringRefE Unexecuted instantiation: variant_assembler_legacy_test.cpp:_ZN5doris12variant_json17write_json_binaryINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefE variant_string_parse_test.cpp:_ZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefE Line | Count | Source | 202 | 1 | void write_json_binary(Writer& out, StringRef value) { | 203 | 1 | static constexpr char BASE64[] = | 204 | 1 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 205 | 1 | write_literal(out, "\""); | 206 | 1 | std::array<char, 1024> encoded {}; | 207 | 1 | size_t encoded_size = 0; | 208 | 1 | size_t index = 0; | 209 | 1 | const auto flush = [&]() { | 210 | 1 | if (encoded_size != 0) { | 211 | 1 | out.write(encoded.data(), encoded_size); | 212 | 1 | encoded_size = 0; | 213 | 1 | } | 214 | 1 | }; | 215 | 2 | while (index + 3 <= value.size) { | 216 | 1 | if (encoded.size() - encoded_size < 4) { | 217 | 0 | flush(); | 218 | 0 | } | 219 | 1 | const auto first = static_cast<uint8_t>(value.data[index]); | 220 | 1 | const auto second = static_cast<uint8_t>(value.data[index + 1]); | 221 | 1 | const auto third = static_cast<uint8_t>(value.data[index + 2]); | 222 | 1 | encoded[encoded_size++] = BASE64[first >> 2]; | 223 | 1 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; | 224 | 1 | encoded[encoded_size++] = BASE64[((second & 0x0F) << 2) | (third >> 6)]; | 225 | 1 | encoded[encoded_size++] = BASE64[third & 0x3F]; | 226 | 1 | index += 3; | 227 | 1 | } | 228 | 1 | if (index != value.size) { | 229 | 1 | if (encoded.size() - encoded_size < 4) { | 230 | 0 | flush(); | 231 | 0 | } | 232 | 1 | const auto first = static_cast<uint8_t>(value.data[index]); | 233 | 1 | encoded[encoded_size++] = BASE64[first >> 2]; | 234 | 1 | if (index + 1 == value.size) { | 235 | 1 | encoded[encoded_size++] = BASE64[(first & 0x03) << 4]; | 236 | 1 | encoded[encoded_size++] = '='; | 237 | 1 | encoded[encoded_size++] = '='; | 238 | 1 | } else { | 239 | 0 | const auto second = static_cast<uint8_t>(value.data[index + 1]); | 240 | 0 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; | 241 | 0 | encoded[encoded_size++] = BASE64[(second & 0x0F) << 2]; | 242 | 0 | encoded[encoded_size++] = '='; | 243 | 0 | } | 244 | 1 | } | 245 | 1 | flush(); | 246 | 1 | write_literal(out, "\""); | 247 | 1 | } |
_ZN5doris12variant_json17write_json_binaryINS_14BufferWritableEEEvRT_NS_9StringRefE Line | Count | Source | 202 | 1 | void write_json_binary(Writer& out, StringRef value) { | 203 | 1 | static constexpr char BASE64[] = | 204 | 1 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 205 | 1 | write_literal(out, "\""); | 206 | 1 | std::array<char, 1024> encoded {}; | 207 | 1 | size_t encoded_size = 0; | 208 | 1 | size_t index = 0; | 209 | 1 | const auto flush = [&]() { | 210 | 1 | if (encoded_size != 0) { | 211 | 1 | out.write(encoded.data(), encoded_size); | 212 | 1 | encoded_size = 0; | 213 | 1 | } | 214 | 1 | }; | 215 | 1 | while (index + 3 <= value.size) { | 216 | 0 | if (encoded.size() - encoded_size < 4) { | 217 | 0 | flush(); | 218 | 0 | } | 219 | 0 | const auto first = static_cast<uint8_t>(value.data[index]); | 220 | 0 | const auto second = static_cast<uint8_t>(value.data[index + 1]); | 221 | 0 | const auto third = static_cast<uint8_t>(value.data[index + 2]); | 222 | 0 | encoded[encoded_size++] = BASE64[first >> 2]; | 223 | 0 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; | 224 | 0 | encoded[encoded_size++] = BASE64[((second & 0x0F) << 2) | (third >> 6)]; | 225 | 0 | encoded[encoded_size++] = BASE64[third & 0x3F]; | 226 | 0 | index += 3; | 227 | 0 | } | 228 | 1 | if (index != value.size) { | 229 | 1 | if (encoded.size() - encoded_size < 4) { | 230 | 0 | flush(); | 231 | 0 | } | 232 | 1 | const auto first = static_cast<uint8_t>(value.data[index]); | 233 | 1 | encoded[encoded_size++] = BASE64[first >> 2]; | 234 | 1 | if (index + 1 == value.size) { | 235 | 0 | encoded[encoded_size++] = BASE64[(first & 0x03) << 4]; | 236 | 0 | encoded[encoded_size++] = '='; | 237 | 0 | encoded[encoded_size++] = '='; | 238 | 1 | } else { | 239 | 1 | const auto second = static_cast<uint8_t>(value.data[index + 1]); | 240 | 1 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; | 241 | 1 | encoded[encoded_size++] = BASE64[(second & 0x0F) << 2]; | 242 | 1 | encoded[encoded_size++] = '='; | 243 | 1 | } | 244 | 1 | } | 245 | 1 | flush(); | 246 | 1 | write_literal(out, "\""); | 247 | 1 | } |
Unexecuted instantiation: unity_5_cxx.cxx:_ZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_114CountingWriterEEEvRT_NS_9StringRefE Unexecuted instantiation: unity_5_cxx.cxx:_ZN5doris12variant_json17write_json_binaryINS_12_GLOBAL__N_111FixedWriterEEEvRT_NS_9StringRefE |
248 | | |
249 | | template <typename Writer> |
250 | | class Printer { |
251 | | public: |
252 | 29.2k | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {}column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEEC2ERS3_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 154 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEEC2ERS3_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 10 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEC2ERS6_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 24 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEEC2ERS3_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 7 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEC2ERS5_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 153 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEEC2ERS3_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 39 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEEC2ERS2_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 15.5k | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEEC2ERS3_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 13.2k | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEEC2ERS3_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 252 | 111 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
|
253 | | |
254 | 114k | void write(VariantRef value, uint32_t depth) { |
255 | 114k | require_json_depth(depth); |
256 | 114k | switch (value.basic_type()) { |
257 | 38.3k | case VariantBasicType::SHORT_STRING: |
258 | 38.3k | write_json_string(_out, value.get_string(), "string"); |
259 | 38.3k | return; |
260 | 47.9k | case VariantBasicType::PRIMITIVE: |
261 | 47.9k | write_primitive(value); |
262 | 47.9k | return; |
263 | 27.6k | case VariantBasicType::OBJECT: |
264 | 27.6k | write_object(value, depth); |
265 | 27.6k | return; |
266 | 407 | case VariantBasicType::ARRAY: |
267 | 407 | write_array(value, depth); |
268 | 407 | return; |
269 | 114k | } |
270 | 114k | } column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE5writeENS_10VariantRefEj Line | Count | Source | 254 | 481 | void write(VariantRef value, uint32_t depth) { | 255 | 481 | require_json_depth(depth); | 256 | 481 | switch (value.basic_type()) { | 257 | 4 | case VariantBasicType::SHORT_STRING: | 258 | 4 | write_json_string(_out, value.get_string(), "string"); | 259 | 4 | return; | 260 | 321 | case VariantBasicType::PRIMITIVE: | 261 | 321 | write_primitive(value); | 262 | 321 | return; | 263 | 134 | case VariantBasicType::OBJECT: | 264 | 134 | write_object(value, depth); | 265 | 134 | return; | 266 | 22 | case VariantBasicType::ARRAY: | 267 | 22 | write_array(value, depth); | 268 | 22 | return; | 269 | 481 | } | 270 | 481 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE5writeENS_10VariantRefEj Line | Count | Source | 254 | 18 | void write(VariantRef value, uint32_t depth) { | 255 | 18 | require_json_depth(depth); | 256 | 18 | switch (value.basic_type()) { | 257 | 0 | case VariantBasicType::SHORT_STRING: | 258 | 0 | write_json_string(_out, value.get_string(), "string"); | 259 | 0 | return; | 260 | 12 | case VariantBasicType::PRIMITIVE: | 261 | 12 | write_primitive(value); | 262 | 12 | return; | 263 | 4 | case VariantBasicType::OBJECT: | 264 | 4 | write_object(value, depth); | 265 | 4 | return; | 266 | 2 | case VariantBasicType::ARRAY: | 267 | 2 | write_array(value, depth); | 268 | 2 | return; | 269 | 18 | } | 270 | 18 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE5writeENS_10VariantRefEj Line | Count | Source | 254 | 88 | void write(VariantRef value, uint32_t depth) { | 255 | 88 | require_json_depth(depth); | 256 | 88 | switch (value.basic_type()) { | 257 | 8 | case VariantBasicType::SHORT_STRING: | 258 | 8 | write_json_string(_out, value.get_string(), "string"); | 259 | 8 | return; | 260 | 44 | case VariantBasicType::PRIMITIVE: | 261 | 44 | write_primitive(value); | 262 | 44 | return; | 263 | 32 | case VariantBasicType::OBJECT: | 264 | 32 | write_object(value, depth); | 265 | 32 | return; | 266 | 4 | case VariantBasicType::ARRAY: | 267 | 4 | write_array(value, depth); | 268 | 4 | return; | 269 | 88 | } | 270 | 88 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE5writeENS_10VariantRefEj Line | Count | Source | 254 | 12 | void write(VariantRef value, uint32_t depth) { | 255 | 12 | require_json_depth(depth); | 256 | 12 | switch (value.basic_type()) { | 257 | 3 | case VariantBasicType::SHORT_STRING: | 258 | 3 | write_json_string(_out, value.get_string(), "string"); | 259 | 3 | return; | 260 | 4 | case VariantBasicType::PRIMITIVE: | 261 | 4 | write_primitive(value); | 262 | 4 | return; | 263 | 5 | case VariantBasicType::OBJECT: | 264 | 5 | write_object(value, depth); | 265 | 5 | return; | 266 | 0 | case VariantBasicType::ARRAY: | 267 | 0 | write_array(value, depth); | 268 | 0 | return; | 269 | 12 | } | 270 | 12 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE5writeENS_10VariantRefEj Line | Count | Source | 254 | 252 | void write(VariantRef value, uint32_t depth) { | 255 | 252 | require_json_depth(depth); | 256 | 252 | switch (value.basic_type()) { | 257 | 13 | case VariantBasicType::SHORT_STRING: | 258 | 13 | write_json_string(_out, value.get_string(), "string"); | 259 | 13 | return; | 260 | 163 | case VariantBasicType::PRIMITIVE: | 261 | 163 | write_primitive(value); | 262 | 163 | return; | 263 | 56 | case VariantBasicType::OBJECT: | 264 | 56 | write_object(value, depth); | 265 | 56 | return; | 266 | 20 | case VariantBasicType::ARRAY: | 267 | 20 | write_array(value, depth); | 268 | 20 | return; | 269 | 252 | } | 270 | 252 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE5writeENS_10VariantRefEj Line | Count | Source | 254 | 330 | void write(VariantRef value, uint32_t depth) { | 255 | 330 | require_json_depth(depth); | 256 | 330 | switch (value.basic_type()) { | 257 | 7 | case VariantBasicType::SHORT_STRING: | 258 | 7 | write_json_string(_out, value.get_string(), "string"); | 259 | 7 | return; | 260 | 49 | case VariantBasicType::PRIMITIVE: | 261 | 49 | write_primitive(value); | 262 | 49 | return; | 263 | 11 | case VariantBasicType::OBJECT: | 264 | 11 | write_object(value, depth); | 265 | 11 | return; | 266 | 262 | case VariantBasicType::ARRAY: | 267 | 262 | write_array(value, depth); | 268 | 262 | return; | 269 | 330 | } | 270 | 330 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE5writeENS_10VariantRefEj Line | Count | Source | 254 | 61.2k | void write(VariantRef value, uint32_t depth) { | 255 | 61.2k | require_json_depth(depth); | 256 | 61.2k | switch (value.basic_type()) { | 257 | 20.3k | case VariantBasicType::SHORT_STRING: | 258 | 20.3k | write_json_string(_out, value.get_string(), "string"); | 259 | 20.3k | return; | 260 | 26.0k | case VariantBasicType::PRIMITIVE: | 261 | 26.0k | write_primitive(value); | 262 | 26.0k | return; | 263 | 14.8k | case VariantBasicType::OBJECT: | 264 | 14.8k | write_object(value, depth); | 265 | 14.8k | return; | 266 | 44 | case VariantBasicType::ARRAY: | 267 | 44 | write_array(value, depth); | 268 | 44 | return; | 269 | 61.2k | } | 270 | 61.2k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE5writeENS_10VariantRefEj Line | Count | Source | 254 | 51.7k | void write(VariantRef value, uint32_t depth) { | 255 | 51.7k | require_json_depth(depth); | 256 | 51.7k | switch (value.basic_type()) { | 257 | 17.9k | case VariantBasicType::SHORT_STRING: | 258 | 17.9k | write_json_string(_out, value.get_string(), "string"); | 259 | 17.9k | return; | 260 | 21.2k | case VariantBasicType::PRIMITIVE: | 261 | 21.2k | write_primitive(value); | 262 | 21.2k | return; | 263 | 12.4k | case VariantBasicType::OBJECT: | 264 | 12.4k | write_object(value, depth); | 265 | 12.4k | return; | 266 | 46 | case VariantBasicType::ARRAY: | 267 | 46 | write_array(value, depth); | 268 | 46 | return; | 269 | 51.7k | } | 270 | 51.7k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE5writeENS_10VariantRefEj Line | Count | Source | 254 | 103 | void write(VariantRef value, uint32_t depth) { | 255 | 103 | require_json_depth(depth); | 256 | 103 | switch (value.basic_type()) { | 257 | 30 | case VariantBasicType::SHORT_STRING: | 258 | 30 | write_json_string(_out, value.get_string(), "string"); | 259 | 30 | return; | 260 | 62 | case VariantBasicType::PRIMITIVE: | 261 | 62 | write_primitive(value); | 262 | 62 | return; | 263 | 4 | case VariantBasicType::OBJECT: | 264 | 4 | write_object(value, depth); | 265 | 4 | return; | 266 | 7 | case VariantBasicType::ARRAY: | 267 | 7 | write_array(value, depth); | 268 | 7 | return; | 269 | 103 | } | 270 | 103 | } |
|
271 | | |
272 | 2.50k | void write_plain_scalar(VariantRef value) { |
273 | 2.50k | require_json_depth(0); |
274 | 2.50k | if (value.basic_type() == VariantBasicType::SHORT_STRING) { |
275 | 27 | const StringRef string = value.get_string(); |
276 | 27 | require_valid_json_utf8(string, "string"); |
277 | 27 | _out.write(string.data, string.size); |
278 | 27 | return; |
279 | 27 | } |
280 | 2.47k | if (value.basic_type() != VariantBasicType::PRIMITIVE) { |
281 | 2.40k | write(value, 0); |
282 | 2.40k | return; |
283 | 2.40k | } |
284 | | |
285 | 68 | switch (value.primitive_id()) { |
286 | 0 | case VariantPrimitiveId::STRING: { |
287 | 0 | const StringRef string = value.get_string(); |
288 | 0 | require_valid_json_utf8(string, "string"); |
289 | 0 | _out.write(string.data, string.size); |
290 | 0 | return; |
291 | 0 | } |
292 | 8 | case VariantPrimitiveId::DATE: |
293 | 8 | write_scalar(_out, format_json_date(value.get_date())); |
294 | 8 | return; |
295 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: |
296 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, |
297 | 0 | _options.timezone)); |
298 | 0 | return; |
299 | 8 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: |
300 | 8 | write_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, false, |
301 | 8 | nullptr)); |
302 | 8 | return; |
303 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: |
304 | 0 | write_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); |
305 | 0 | return; |
306 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: |
307 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, |
308 | 0 | _options.timezone)); |
309 | 0 | return; |
310 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: |
311 | 0 | write_scalar(_out, |
312 | 0 | format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, false, nullptr)); |
313 | 0 | return; |
314 | 0 | case VariantPrimitiveId::UUID: |
315 | 0 | write_scalar(_out, format_json_uuid(value.get_uuid())); |
316 | 0 | return; |
317 | 52 | default: |
318 | 52 | write_primitive(value); |
319 | 52 | return; |
320 | 68 | } |
321 | 68 | } _ZN5doris12variant_json7PrinterINS_14BufferWritableEE18write_plain_scalarENS_10VariantRefE Line | Count | Source | 272 | 2.45k | void write_plain_scalar(VariantRef value) { | 273 | 2.45k | require_json_depth(0); | 274 | 2.45k | if (value.basic_type() == VariantBasicType::SHORT_STRING) { | 275 | 13 | const StringRef string = value.get_string(); | 276 | 13 | require_valid_json_utf8(string, "string"); | 277 | 13 | _out.write(string.data, string.size); | 278 | 13 | return; | 279 | 13 | } | 280 | 2.43k | if (value.basic_type() != VariantBasicType::PRIMITIVE) { | 281 | 2.40k | write(value, 0); | 282 | 2.40k | return; | 283 | 2.40k | } | 284 | | | 285 | 34 | switch (value.primitive_id()) { | 286 | 0 | case VariantPrimitiveId::STRING: { | 287 | 0 | const StringRef string = value.get_string(); | 288 | 0 | require_valid_json_utf8(string, "string"); | 289 | 0 | _out.write(string.data, string.size); | 290 | 0 | return; | 291 | 0 | } | 292 | 4 | case VariantPrimitiveId::DATE: | 293 | 4 | write_scalar(_out, format_json_date(value.get_date())); | 294 | 4 | return; | 295 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 296 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 297 | 0 | _options.timezone)); | 298 | 0 | return; | 299 | 4 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 300 | 4 | write_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, false, | 301 | 4 | nullptr)); | 302 | 4 | return; | 303 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 304 | 0 | write_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 305 | 0 | return; | 306 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 307 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 308 | 0 | _options.timezone)); | 309 | 0 | return; | 310 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 311 | 0 | write_scalar(_out, | 312 | 0 | format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, false, nullptr)); | 313 | 0 | return; | 314 | 0 | case VariantPrimitiveId::UUID: | 315 | 0 | write_scalar(_out, format_json_uuid(value.get_uuid())); | 316 | 0 | return; | 317 | 26 | default: | 318 | 26 | write_primitive(value); | 319 | 26 | return; | 320 | 34 | } | 321 | 34 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE18write_plain_scalarENS_10VariantRefE Line | Count | Source | 272 | 26 | void write_plain_scalar(VariantRef value) { | 273 | 26 | require_json_depth(0); | 274 | 26 | if (value.basic_type() == VariantBasicType::SHORT_STRING) { | 275 | 7 | const StringRef string = value.get_string(); | 276 | 7 | require_valid_json_utf8(string, "string"); | 277 | 7 | _out.write(string.data, string.size); | 278 | 7 | return; | 279 | 7 | } | 280 | 19 | if (value.basic_type() != VariantBasicType::PRIMITIVE) { | 281 | 2 | write(value, 0); | 282 | 2 | return; | 283 | 2 | } | 284 | | | 285 | 17 | switch (value.primitive_id()) { | 286 | 0 | case VariantPrimitiveId::STRING: { | 287 | 0 | const StringRef string = value.get_string(); | 288 | 0 | require_valid_json_utf8(string, "string"); | 289 | 0 | _out.write(string.data, string.size); | 290 | 0 | return; | 291 | 0 | } | 292 | 2 | case VariantPrimitiveId::DATE: | 293 | 2 | write_scalar(_out, format_json_date(value.get_date())); | 294 | 2 | return; | 295 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 296 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 297 | 0 | _options.timezone)); | 298 | 0 | return; | 299 | 2 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 300 | 2 | write_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, false, | 301 | 2 | nullptr)); | 302 | 2 | return; | 303 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 304 | 0 | write_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 305 | 0 | return; | 306 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 307 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 308 | 0 | _options.timezone)); | 309 | 0 | return; | 310 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 311 | 0 | write_scalar(_out, | 312 | 0 | format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, false, nullptr)); | 313 | 0 | return; | 314 | 0 | case VariantPrimitiveId::UUID: | 315 | 0 | write_scalar(_out, format_json_uuid(value.get_uuid())); | 316 | 0 | return; | 317 | 13 | default: | 318 | 13 | write_primitive(value); | 319 | 13 | return; | 320 | 17 | } | 321 | 17 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE18write_plain_scalarENS_10VariantRefE Line | Count | Source | 272 | 26 | void write_plain_scalar(VariantRef value) { | 273 | 26 | require_json_depth(0); | 274 | 26 | if (value.basic_type() == VariantBasicType::SHORT_STRING) { | 275 | 7 | const StringRef string = value.get_string(); | 276 | 7 | require_valid_json_utf8(string, "string"); | 277 | 7 | _out.write(string.data, string.size); | 278 | 7 | return; | 279 | 7 | } | 280 | 19 | if (value.basic_type() != VariantBasicType::PRIMITIVE) { | 281 | 2 | write(value, 0); | 282 | 2 | return; | 283 | 2 | } | 284 | | | 285 | 17 | switch (value.primitive_id()) { | 286 | 0 | case VariantPrimitiveId::STRING: { | 287 | 0 | const StringRef string = value.get_string(); | 288 | 0 | require_valid_json_utf8(string, "string"); | 289 | 0 | _out.write(string.data, string.size); | 290 | 0 | return; | 291 | 0 | } | 292 | 2 | case VariantPrimitiveId::DATE: | 293 | 2 | write_scalar(_out, format_json_date(value.get_date())); | 294 | 2 | return; | 295 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 296 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 297 | 0 | _options.timezone)); | 298 | 0 | return; | 299 | 2 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 300 | 2 | write_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, false, | 301 | 2 | nullptr)); | 302 | 2 | return; | 303 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 304 | 0 | write_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 305 | 0 | return; | 306 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 307 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 308 | 0 | _options.timezone)); | 309 | 0 | return; | 310 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 311 | 0 | write_scalar(_out, | 312 | 0 | format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, false, nullptr)); | 313 | 0 | return; | 314 | 0 | case VariantPrimitiveId::UUID: | 315 | 0 | write_scalar(_out, format_json_uuid(value.get_uuid())); | 316 | 0 | return; | 317 | 13 | default: | 318 | 13 | write_primitive(value); | 319 | 13 | return; | 320 | 17 | } | 321 | 17 | } |
|
322 | | |
323 | | private: |
324 | 47.9k | void write_primitive(VariantRef value) { |
325 | 47.9k | const VariantPrimitiveId id = value.primitive_id(); |
326 | 47.9k | switch (id) { |
327 | 136 | case VariantPrimitiveId::NULL_VALUE: |
328 | 136 | write_literal(_out, "null"); |
329 | 136 | return; |
330 | 47 | case VariantPrimitiveId::TRUE_VALUE: |
331 | 47 | write_literal(_out, "true"); |
332 | 47 | return; |
333 | 3 | case VariantPrimitiveId::FALSE_VALUE: |
334 | 3 | write_literal(_out, "false"); |
335 | 3 | return; |
336 | 43.9k | case VariantPrimitiveId::INT8: |
337 | 47.5k | case VariantPrimitiveId::INT16: |
338 | 47.5k | case VariantPrimitiveId::INT32: |
339 | 47.5k | case VariantPrimitiveId::INT64: |
340 | 47.5k | write_scalar(_out, format_json_int(value.get_int())); |
341 | 47.5k | return; |
342 | 128 | case VariantPrimitiveId::DOUBLE: { |
343 | 128 | const double number = value.get_double(); |
344 | 128 | if (!std::isfinite(number)) { |
345 | 73 | write_non_finite(number); |
346 | 73 | return; |
347 | 73 | } |
348 | 55 | write_scalar(_out, format_json_double(number)); |
349 | 55 | return; |
350 | 128 | } |
351 | 3 | case VariantPrimitiveId::DECIMAL4: |
352 | 13 | case VariantPrimitiveId::DECIMAL8: |
353 | 25 | case VariantPrimitiveId::DECIMAL16: |
354 | 25 | write_scalar(_out, format_json_decimal(value.get_decimal())); |
355 | 25 | return; |
356 | 61 | case VariantPrimitiveId::DATE: |
357 | 61 | write_quoted_scalar(_out, format_json_date(value.get_date())); |
358 | 61 | return; |
359 | 5 | case VariantPrimitiveId::TIMESTAMP_MICROS: |
360 | 5 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, |
361 | 5 | _options.timezone)); |
362 | 5 | return; |
363 | 26 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: |
364 | 26 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, |
365 | 26 | false, nullptr)); |
366 | 26 | return; |
367 | 6 | case VariantPrimitiveId::FLOAT: { |
368 | 6 | const float number = value.get_float(); |
369 | 6 | if (!std::isfinite(number)) { |
370 | 2 | write_non_finite(number); |
371 | 2 | return; |
372 | 2 | } |
373 | 4 | write_scalar(_out, format_json_float(number)); |
374 | 4 | return; |
375 | 6 | } |
376 | 2 | case VariantPrimitiveId::BINARY: |
377 | 2 | write_json_binary(_out, value.get_binary()); |
378 | 2 | return; |
379 | 3 | case VariantPrimitiveId::STRING: |
380 | 3 | write_json_string(_out, value.get_string(), "string"); |
381 | 3 | return; |
382 | 2 | case VariantPrimitiveId::TIME_NTZ_MICROS: |
383 | 2 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); |
384 | 2 | return; |
385 | 3 | case VariantPrimitiveId::TIMESTAMP_NANOS: |
386 | 3 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, |
387 | 3 | _options.timezone)); |
388 | 3 | return; |
389 | 4 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: |
390 | 4 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, |
391 | 4 | false, nullptr)); |
392 | 4 | return; |
393 | 5 | case VariantPrimitiveId::UUID: |
394 | 5 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); |
395 | 5 | return; |
396 | 47.9k | } |
397 | 0 | throw_unsupported_json_primitive(id); |
398 | 0 | } column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 321 | void write_primitive(VariantRef value) { | 325 | 321 | const VariantPrimitiveId id = value.primitive_id(); | 326 | 321 | switch (id) { | 327 | 0 | case VariantPrimitiveId::NULL_VALUE: | 328 | 0 | write_literal(_out, "null"); | 329 | 0 | return; | 330 | 0 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 0 | write_literal(_out, "true"); | 332 | 0 | return; | 333 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 0 | write_literal(_out, "false"); | 335 | 0 | return; | 336 | 321 | case VariantPrimitiveId::INT8: | 337 | 321 | case VariantPrimitiveId::INT16: | 338 | 321 | case VariantPrimitiveId::INT32: | 339 | 321 | case VariantPrimitiveId::INT64: | 340 | 321 | write_scalar(_out, format_json_int(value.get_int())); | 341 | 321 | return; | 342 | 0 | case VariantPrimitiveId::DOUBLE: { | 343 | 0 | const double number = value.get_double(); | 344 | 0 | if (!std::isfinite(number)) { | 345 | 0 | write_non_finite(number); | 346 | 0 | return; | 347 | 0 | } | 348 | 0 | write_scalar(_out, format_json_double(number)); | 349 | 0 | return; | 350 | 0 | } | 351 | 0 | case VariantPrimitiveId::DECIMAL4: | 352 | 0 | case VariantPrimitiveId::DECIMAL8: | 353 | 0 | case VariantPrimitiveId::DECIMAL16: | 354 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 0 | return; | 356 | 0 | case VariantPrimitiveId::DATE: | 357 | 0 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 0 | return; | 359 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 0 | _options.timezone)); | 362 | 0 | return; | 363 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 0 | false, nullptr)); | 366 | 0 | return; | 367 | 0 | case VariantPrimitiveId::FLOAT: { | 368 | 0 | const float number = value.get_float(); | 369 | 0 | if (!std::isfinite(number)) { | 370 | 0 | write_non_finite(number); | 371 | 0 | return; | 372 | 0 | } | 373 | 0 | write_scalar(_out, format_json_float(number)); | 374 | 0 | return; | 375 | 0 | } | 376 | 0 | case VariantPrimitiveId::BINARY: | 377 | 0 | write_json_binary(_out, value.get_binary()); | 378 | 0 | return; | 379 | 0 | case VariantPrimitiveId::STRING: | 380 | 0 | write_json_string(_out, value.get_string(), "string"); | 381 | 0 | return; | 382 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 0 | return; | 385 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 0 | _options.timezone)); | 388 | 0 | return; | 389 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 0 | false, nullptr)); | 392 | 0 | return; | 393 | 0 | case VariantPrimitiveId::UUID: | 394 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 0 | return; | 396 | 321 | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 12 | void write_primitive(VariantRef value) { | 325 | 12 | const VariantPrimitiveId id = value.primitive_id(); | 326 | 12 | switch (id) { | 327 | 3 | case VariantPrimitiveId::NULL_VALUE: | 328 | 3 | write_literal(_out, "null"); | 329 | 3 | return; | 330 | 1 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 1 | write_literal(_out, "true"); | 332 | 1 | return; | 333 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 0 | write_literal(_out, "false"); | 335 | 0 | return; | 336 | 8 | case VariantPrimitiveId::INT8: | 337 | 8 | case VariantPrimitiveId::INT16: | 338 | 8 | case VariantPrimitiveId::INT32: | 339 | 8 | case VariantPrimitiveId::INT64: | 340 | 8 | write_scalar(_out, format_json_int(value.get_int())); | 341 | 8 | return; | 342 | 0 | case VariantPrimitiveId::DOUBLE: { | 343 | 0 | const double number = value.get_double(); | 344 | 0 | if (!std::isfinite(number)) { | 345 | 0 | write_non_finite(number); | 346 | 0 | return; | 347 | 0 | } | 348 | 0 | write_scalar(_out, format_json_double(number)); | 349 | 0 | return; | 350 | 0 | } | 351 | 0 | case VariantPrimitiveId::DECIMAL4: | 352 | 0 | case VariantPrimitiveId::DECIMAL8: | 353 | 0 | case VariantPrimitiveId::DECIMAL16: | 354 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 0 | return; | 356 | 0 | case VariantPrimitiveId::DATE: | 357 | 0 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 0 | return; | 359 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 0 | _options.timezone)); | 362 | 0 | return; | 363 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 0 | false, nullptr)); | 366 | 0 | return; | 367 | 0 | case VariantPrimitiveId::FLOAT: { | 368 | 0 | const float number = value.get_float(); | 369 | 0 | if (!std::isfinite(number)) { | 370 | 0 | write_non_finite(number); | 371 | 0 | return; | 372 | 0 | } | 373 | 0 | write_scalar(_out, format_json_float(number)); | 374 | 0 | return; | 375 | 0 | } | 376 | 0 | case VariantPrimitiveId::BINARY: | 377 | 0 | write_json_binary(_out, value.get_binary()); | 378 | 0 | return; | 379 | 0 | case VariantPrimitiveId::STRING: | 380 | 0 | write_json_string(_out, value.get_string(), "string"); | 381 | 0 | return; | 382 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 0 | return; | 385 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 0 | _options.timezone)); | 388 | 0 | return; | 389 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 0 | false, nullptr)); | 392 | 0 | return; | 393 | 0 | case VariantPrimitiveId::UUID: | 394 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 0 | return; | 396 | 12 | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 44 | void write_primitive(VariantRef value) { | 325 | 44 | const VariantPrimitiveId id = value.primitive_id(); | 326 | 44 | switch (id) { | 327 | 0 | case VariantPrimitiveId::NULL_VALUE: | 328 | 0 | write_literal(_out, "null"); | 329 | 0 | return; | 330 | 15 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 15 | write_literal(_out, "true"); | 332 | 15 | return; | 333 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 0 | write_literal(_out, "false"); | 335 | 0 | return; | 336 | 25 | case VariantPrimitiveId::INT8: | 337 | 25 | case VariantPrimitiveId::INT16: | 338 | 25 | case VariantPrimitiveId::INT32: | 339 | 25 | case VariantPrimitiveId::INT64: | 340 | 25 | write_scalar(_out, format_json_int(value.get_int())); | 341 | 25 | return; | 342 | 4 | case VariantPrimitiveId::DOUBLE: { | 343 | 4 | const double number = value.get_double(); | 344 | 4 | if (!std::isfinite(number)) { | 345 | 0 | write_non_finite(number); | 346 | 0 | return; | 347 | 0 | } | 348 | 4 | write_scalar(_out, format_json_double(number)); | 349 | 4 | return; | 350 | 4 | } | 351 | 0 | case VariantPrimitiveId::DECIMAL4: | 352 | 0 | case VariantPrimitiveId::DECIMAL8: | 353 | 0 | case VariantPrimitiveId::DECIMAL16: | 354 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 0 | return; | 356 | 0 | case VariantPrimitiveId::DATE: | 357 | 0 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 0 | return; | 359 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 0 | _options.timezone)); | 362 | 0 | return; | 363 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 0 | false, nullptr)); | 366 | 0 | return; | 367 | 0 | case VariantPrimitiveId::FLOAT: { | 368 | 0 | const float number = value.get_float(); | 369 | 0 | if (!std::isfinite(number)) { | 370 | 0 | write_non_finite(number); | 371 | 0 | return; | 372 | 0 | } | 373 | 0 | write_scalar(_out, format_json_float(number)); | 374 | 0 | return; | 375 | 0 | } | 376 | 0 | case VariantPrimitiveId::BINARY: | 377 | 0 | write_json_binary(_out, value.get_binary()); | 378 | 0 | return; | 379 | 0 | case VariantPrimitiveId::STRING: | 380 | 0 | write_json_string(_out, value.get_string(), "string"); | 381 | 0 | return; | 382 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 0 | return; | 385 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 0 | _options.timezone)); | 388 | 0 | return; | 389 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 0 | false, nullptr)); | 392 | 0 | return; | 393 | 0 | case VariantPrimitiveId::UUID: | 394 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 0 | return; | 396 | 44 | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 4 | void write_primitive(VariantRef value) { | 325 | 4 | const VariantPrimitiveId id = value.primitive_id(); | 326 | 4 | switch (id) { | 327 | 2 | case VariantPrimitiveId::NULL_VALUE: | 328 | 2 | write_literal(_out, "null"); | 329 | 2 | return; | 330 | 0 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 0 | write_literal(_out, "true"); | 332 | 0 | return; | 333 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 0 | write_literal(_out, "false"); | 335 | 0 | return; | 336 | 2 | case VariantPrimitiveId::INT8: | 337 | 2 | case VariantPrimitiveId::INT16: | 338 | 2 | case VariantPrimitiveId::INT32: | 339 | 2 | case VariantPrimitiveId::INT64: | 340 | 2 | write_scalar(_out, format_json_int(value.get_int())); | 341 | 2 | return; | 342 | 0 | case VariantPrimitiveId::DOUBLE: { | 343 | 0 | const double number = value.get_double(); | 344 | 0 | if (!std::isfinite(number)) { | 345 | 0 | write_non_finite(number); | 346 | 0 | return; | 347 | 0 | } | 348 | 0 | write_scalar(_out, format_json_double(number)); | 349 | 0 | return; | 350 | 0 | } | 351 | 0 | case VariantPrimitiveId::DECIMAL4: | 352 | 0 | case VariantPrimitiveId::DECIMAL8: | 353 | 0 | case VariantPrimitiveId::DECIMAL16: | 354 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 0 | return; | 356 | 0 | case VariantPrimitiveId::DATE: | 357 | 0 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 0 | return; | 359 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 0 | _options.timezone)); | 362 | 0 | return; | 363 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 0 | false, nullptr)); | 366 | 0 | return; | 367 | 0 | case VariantPrimitiveId::FLOAT: { | 368 | 0 | const float number = value.get_float(); | 369 | 0 | if (!std::isfinite(number)) { | 370 | 0 | write_non_finite(number); | 371 | 0 | return; | 372 | 0 | } | 373 | 0 | write_scalar(_out, format_json_float(number)); | 374 | 0 | return; | 375 | 0 | } | 376 | 0 | case VariantPrimitiveId::BINARY: | 377 | 0 | write_json_binary(_out, value.get_binary()); | 378 | 0 | return; | 379 | 0 | case VariantPrimitiveId::STRING: | 380 | 0 | write_json_string(_out, value.get_string(), "string"); | 381 | 0 | return; | 382 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 0 | return; | 385 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 0 | _options.timezone)); | 388 | 0 | return; | 389 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 0 | false, nullptr)); | 392 | 0 | return; | 393 | 0 | case VariantPrimitiveId::UUID: | 394 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 0 | return; | 396 | 4 | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 163 | void write_primitive(VariantRef value) { | 325 | 163 | const VariantPrimitiveId id = value.primitive_id(); | 326 | 163 | switch (id) { | 327 | 46 | case VariantPrimitiveId::NULL_VALUE: | 328 | 46 | write_literal(_out, "null"); | 329 | 46 | return; | 330 | 2 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 2 | write_literal(_out, "true"); | 332 | 2 | return; | 333 | 1 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 1 | write_literal(_out, "false"); | 335 | 1 | return; | 336 | 31 | case VariantPrimitiveId::INT8: | 337 | 32 | case VariantPrimitiveId::INT16: | 338 | 34 | case VariantPrimitiveId::INT32: | 339 | 36 | case VariantPrimitiveId::INT64: | 340 | 36 | write_scalar(_out, format_json_int(value.get_int())); | 341 | 36 | return; | 342 | 2 | case VariantPrimitiveId::DOUBLE: { | 343 | 2 | const double number = value.get_double(); | 344 | 2 | if (!std::isfinite(number)) { | 345 | 0 | write_non_finite(number); | 346 | 0 | return; | 347 | 0 | } | 348 | 2 | write_scalar(_out, format_json_double(number)); | 349 | 2 | return; | 350 | 2 | } | 351 | 2 | case VariantPrimitiveId::DECIMAL4: | 352 | 11 | case VariantPrimitiveId::DECIMAL8: | 353 | 21 | case VariantPrimitiveId::DECIMAL16: | 354 | 21 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 21 | return; | 356 | 40 | case VariantPrimitiveId::DATE: | 357 | 40 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 40 | return; | 359 | 2 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 2 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 2 | _options.timezone)); | 362 | 2 | return; | 363 | 8 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 8 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 8 | false, nullptr)); | 366 | 8 | return; | 367 | 3 | case VariantPrimitiveId::FLOAT: { | 368 | 3 | const float number = value.get_float(); | 369 | 3 | if (!std::isfinite(number)) { | 370 | 0 | write_non_finite(number); | 371 | 0 | return; | 372 | 0 | } | 373 | 3 | write_scalar(_out, format_json_float(number)); | 374 | 3 | return; | 375 | 3 | } | 376 | 0 | case VariantPrimitiveId::BINARY: | 377 | 0 | write_json_binary(_out, value.get_binary()); | 378 | 0 | return; | 379 | 0 | case VariantPrimitiveId::STRING: | 380 | 0 | write_json_string(_out, value.get_string(), "string"); | 381 | 0 | return; | 382 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 0 | return; | 385 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 0 | _options.timezone)); | 388 | 0 | return; | 389 | 2 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 2 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 2 | false, nullptr)); | 392 | 2 | return; | 393 | 0 | case VariantPrimitiveId::UUID: | 394 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 0 | return; | 396 | 163 | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 49 | void write_primitive(VariantRef value) { | 325 | 49 | const VariantPrimitiveId id = value.primitive_id(); | 326 | 49 | switch (id) { | 327 | 5 | case VariantPrimitiveId::NULL_VALUE: | 328 | 5 | write_literal(_out, "null"); | 329 | 5 | return; | 330 | 4 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 4 | write_literal(_out, "true"); | 332 | 4 | return; | 333 | 2 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 2 | write_literal(_out, "false"); | 335 | 2 | return; | 336 | 11 | case VariantPrimitiveId::INT8: | 337 | 12 | case VariantPrimitiveId::INT16: | 338 | 13 | case VariantPrimitiveId::INT32: | 339 | 14 | case VariantPrimitiveId::INT64: | 340 | 14 | write_scalar(_out, format_json_int(value.get_int())); | 341 | 14 | return; | 342 | 2 | case VariantPrimitiveId::DOUBLE: { | 343 | 2 | const double number = value.get_double(); | 344 | 2 | if (!std::isfinite(number)) { | 345 | 1 | write_non_finite(number); | 346 | 1 | return; | 347 | 1 | } | 348 | 1 | write_scalar(_out, format_json_double(number)); | 349 | 1 | return; | 350 | 2 | } | 351 | 1 | case VariantPrimitiveId::DECIMAL4: | 352 | 2 | case VariantPrimitiveId::DECIMAL8: | 353 | 4 | case VariantPrimitiveId::DECIMAL16: | 354 | 4 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 4 | return; | 356 | 1 | case VariantPrimitiveId::DATE: | 357 | 1 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 1 | return; | 359 | 3 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 3 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 3 | _options.timezone)); | 362 | 3 | return; | 363 | 2 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 2 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 2 | false, nullptr)); | 366 | 2 | return; | 367 | 3 | case VariantPrimitiveId::FLOAT: { | 368 | 3 | const float number = value.get_float(); | 369 | 3 | if (!std::isfinite(number)) { | 370 | 2 | write_non_finite(number); | 371 | 2 | return; | 372 | 2 | } | 373 | 1 | write_scalar(_out, format_json_float(number)); | 374 | 1 | return; | 375 | 3 | } | 376 | 1 | case VariantPrimitiveId::BINARY: | 377 | 1 | write_json_binary(_out, value.get_binary()); | 378 | 1 | return; | 379 | 1 | case VariantPrimitiveId::STRING: | 380 | 1 | write_json_string(_out, value.get_string(), "string"); | 381 | 1 | return; | 382 | 1 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 1 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 1 | return; | 385 | 3 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 3 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 3 | _options.timezone)); | 388 | 3 | return; | 389 | 2 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 2 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 2 | false, nullptr)); | 392 | 2 | return; | 393 | 1 | case VariantPrimitiveId::UUID: | 394 | 1 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 1 | return; | 396 | 49 | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 26.0k | void write_primitive(VariantRef value) { | 325 | 26.0k | const VariantPrimitiveId id = value.primitive_id(); | 326 | 26.0k | switch (id) { | 327 | 28 | case VariantPrimitiveId::NULL_VALUE: | 328 | 28 | write_literal(_out, "null"); | 329 | 28 | return; | 330 | 13 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 13 | write_literal(_out, "true"); | 332 | 13 | return; | 333 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 0 | write_literal(_out, "false"); | 335 | 0 | return; | 336 | 22.6k | case VariantPrimitiveId::INT8: | 337 | 25.9k | case VariantPrimitiveId::INT16: | 338 | 25.9k | case VariantPrimitiveId::INT32: | 339 | 25.9k | case VariantPrimitiveId::INT64: | 340 | 25.9k | write_scalar(_out, format_json_int(value.get_int())); | 341 | 25.9k | return; | 342 | 30 | case VariantPrimitiveId::DOUBLE: { | 343 | 30 | const double number = value.get_double(); | 344 | 30 | if (!std::isfinite(number)) { | 345 | 18 | write_non_finite(number); | 346 | 18 | return; | 347 | 18 | } | 348 | 12 | write_scalar(_out, format_json_double(number)); | 349 | 12 | return; | 350 | 30 | } | 351 | 0 | case VariantPrimitiveId::DECIMAL4: | 352 | 0 | case VariantPrimitiveId::DECIMAL8: | 353 | 0 | case VariantPrimitiveId::DECIMAL16: | 354 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 0 | return; | 356 | 2 | case VariantPrimitiveId::DATE: | 357 | 2 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 2 | return; | 359 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 0 | _options.timezone)); | 362 | 0 | return; | 363 | 2 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 2 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 2 | false, nullptr)); | 366 | 2 | return; | 367 | 0 | case VariantPrimitiveId::FLOAT: { | 368 | 0 | const float number = value.get_float(); | 369 | 0 | if (!std::isfinite(number)) { | 370 | 0 | write_non_finite(number); | 371 | 0 | return; | 372 | 0 | } | 373 | 0 | write_scalar(_out, format_json_float(number)); | 374 | 0 | return; | 375 | 0 | } | 376 | 1 | case VariantPrimitiveId::BINARY: | 377 | 1 | write_json_binary(_out, value.get_binary()); | 378 | 1 | return; | 379 | 1 | case VariantPrimitiveId::STRING: | 380 | 1 | write_json_string(_out, value.get_string(), "string"); | 381 | 1 | return; | 382 | 1 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 1 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 1 | return; | 385 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 0 | _options.timezone)); | 388 | 0 | return; | 389 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 0 | false, nullptr)); | 392 | 0 | return; | 393 | 2 | case VariantPrimitiveId::UUID: | 394 | 2 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 2 | return; | 396 | 26.0k | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 21.2k | void write_primitive(VariantRef value) { | 325 | 21.2k | const VariantPrimitiveId id = value.primitive_id(); | 326 | 21.2k | switch (id) { | 327 | 36 | case VariantPrimitiveId::NULL_VALUE: | 328 | 36 | write_literal(_out, "null"); | 329 | 36 | return; | 330 | 12 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 12 | write_literal(_out, "true"); | 332 | 12 | return; | 333 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 0 | write_literal(_out, "false"); | 335 | 0 | return; | 336 | 20.9k | case VariantPrimitiveId::INT8: | 337 | 21.1k | case VariantPrimitiveId::INT16: | 338 | 21.1k | case VariantPrimitiveId::INT32: | 339 | 21.1k | case VariantPrimitiveId::INT64: | 340 | 21.1k | write_scalar(_out, format_json_int(value.get_int())); | 341 | 21.1k | return; | 342 | 50 | case VariantPrimitiveId::DOUBLE: { | 343 | 50 | const double number = value.get_double(); | 344 | 50 | if (!std::isfinite(number)) { | 345 | 30 | write_non_finite(number); | 346 | 30 | return; | 347 | 30 | } | 348 | 20 | write_scalar(_out, format_json_double(number)); | 349 | 20 | return; | 350 | 50 | } | 351 | 0 | case VariantPrimitiveId::DECIMAL4: | 352 | 0 | case VariantPrimitiveId::DECIMAL8: | 353 | 0 | case VariantPrimitiveId::DECIMAL16: | 354 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 0 | return; | 356 | 10 | case VariantPrimitiveId::DATE: | 357 | 10 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 10 | return; | 359 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 0 | _options.timezone)); | 362 | 0 | return; | 363 | 8 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 8 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 8 | false, nullptr)); | 366 | 8 | return; | 367 | 0 | case VariantPrimitiveId::FLOAT: { | 368 | 0 | const float number = value.get_float(); | 369 | 0 | if (!std::isfinite(number)) { | 370 | 0 | write_non_finite(number); | 371 | 0 | return; | 372 | 0 | } | 373 | 0 | write_scalar(_out, format_json_float(number)); | 374 | 0 | return; | 375 | 0 | } | 376 | 0 | case VariantPrimitiveId::BINARY: | 377 | 0 | write_json_binary(_out, value.get_binary()); | 378 | 0 | return; | 379 | 1 | case VariantPrimitiveId::STRING: | 380 | 1 | write_json_string(_out, value.get_string(), "string"); | 381 | 1 | return; | 382 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 0 | return; | 385 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 0 | _options.timezone)); | 388 | 0 | return; | 389 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 0 | false, nullptr)); | 392 | 0 | return; | 393 | 2 | case VariantPrimitiveId::UUID: | 394 | 2 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 2 | return; | 396 | 21.2k | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 324 | 75 | void write_primitive(VariantRef value) { | 325 | 75 | const VariantPrimitiveId id = value.primitive_id(); | 326 | 75 | switch (id) { | 327 | 16 | case VariantPrimitiveId::NULL_VALUE: | 328 | 16 | write_literal(_out, "null"); | 329 | 16 | return; | 330 | 0 | case VariantPrimitiveId::TRUE_VALUE: | 331 | 0 | write_literal(_out, "true"); | 332 | 0 | return; | 333 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 334 | 0 | write_literal(_out, "false"); | 335 | 0 | return; | 336 | 5 | case VariantPrimitiveId::INT8: | 337 | 5 | case VariantPrimitiveId::INT16: | 338 | 5 | case VariantPrimitiveId::INT32: | 339 | 5 | case VariantPrimitiveId::INT64: | 340 | 5 | write_scalar(_out, format_json_int(value.get_int())); | 341 | 5 | return; | 342 | 40 | case VariantPrimitiveId::DOUBLE: { | 343 | 40 | const double number = value.get_double(); | 344 | 40 | if (!std::isfinite(number)) { | 345 | 24 | write_non_finite(number); | 346 | 24 | return; | 347 | 24 | } | 348 | 16 | write_scalar(_out, format_json_double(number)); | 349 | 16 | return; | 350 | 40 | } | 351 | 0 | case VariantPrimitiveId::DECIMAL4: | 352 | 0 | case VariantPrimitiveId::DECIMAL8: | 353 | 0 | case VariantPrimitiveId::DECIMAL16: | 354 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 355 | 0 | return; | 356 | 8 | case VariantPrimitiveId::DATE: | 357 | 8 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 358 | 8 | return; | 359 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 360 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 361 | 0 | _options.timezone)); | 362 | 0 | return; | 363 | 6 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 364 | 6 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 365 | 6 | false, nullptr)); | 366 | 6 | return; | 367 | 0 | case VariantPrimitiveId::FLOAT: { | 368 | 0 | const float number = value.get_float(); | 369 | 0 | if (!std::isfinite(number)) { | 370 | 0 | write_non_finite(number); | 371 | 0 | return; | 372 | 0 | } | 373 | 0 | write_scalar(_out, format_json_float(number)); | 374 | 0 | return; | 375 | 0 | } | 376 | 0 | case VariantPrimitiveId::BINARY: | 377 | 0 | write_json_binary(_out, value.get_binary()); | 378 | 0 | return; | 379 | 0 | case VariantPrimitiveId::STRING: | 380 | 0 | write_json_string(_out, value.get_string(), "string"); | 381 | 0 | return; | 382 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 383 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 384 | 0 | return; | 385 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 386 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 387 | 0 | _options.timezone)); | 388 | 0 | return; | 389 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 390 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 391 | 0 | false, nullptr)); | 392 | 0 | return; | 393 | 0 | case VariantPrimitiveId::UUID: | 394 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 395 | 0 | return; | 396 | 75 | } | 397 | 0 | throw_unsupported_json_primitive(id); | 398 | 0 | } |
|
399 | | |
400 | | template <typename Number> |
401 | 75 | void write_non_finite(Number value) { |
402 | 75 | if (std::isnan(value)) { |
403 | 25 | write_literal(_out, "\"NaN\""); |
404 | 50 | } else if (value > 0) { |
405 | 25 | write_literal(_out, "\"Infinity\""); |
406 | 25 | } else { |
407 | 25 | write_literal(_out, "\"-Infinity\""); |
408 | 25 | } |
409 | 75 | } Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE16write_non_finiteIdEEvT_ Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE16write_non_finiteIfEEvT_ Unexecuted instantiation: function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE16write_non_finiteIdEEvT_ Unexecuted instantiation: function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE16write_non_finiteIfEEvT_ Unexecuted instantiation: segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE16write_non_finiteIdEEvT_ Unexecuted instantiation: segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE16write_non_finiteIfEEvT_ Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE16write_non_finiteIdEEvT_ Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE16write_non_finiteIfEEvT_ Unexecuted instantiation: variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE16write_non_finiteIdEEvT_ Unexecuted instantiation: variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE16write_non_finiteIfEEvT_ variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE16write_non_finiteIdEEvT_ Line | Count | Source | 401 | 1 | void write_non_finite(Number value) { | 402 | 1 | if (std::isnan(value)) { | 403 | 0 | write_literal(_out, "\"NaN\""); | 404 | 1 | } else if (value > 0) { | 405 | 0 | write_literal(_out, "\"Infinity\""); | 406 | 1 | } else { | 407 | 1 | write_literal(_out, "\"-Infinity\""); | 408 | 1 | } | 409 | 1 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE16write_non_finiteIfEEvT_ Line | Count | Source | 401 | 2 | void write_non_finite(Number value) { | 402 | 2 | if (std::isnan(value)) { | 403 | 1 | write_literal(_out, "\"NaN\""); | 404 | 1 | } else if (value > 0) { | 405 | 1 | write_literal(_out, "\"Infinity\""); | 406 | 1 | } else { | 407 | 0 | write_literal(_out, "\"-Infinity\""); | 408 | 0 | } | 409 | 2 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE16write_non_finiteIdEEvT_ Line | Count | Source | 401 | 18 | void write_non_finite(Number value) { | 402 | 18 | if (std::isnan(value)) { | 403 | 6 | write_literal(_out, "\"NaN\""); | 404 | 12 | } else if (value > 0) { | 405 | 6 | write_literal(_out, "\"Infinity\""); | 406 | 6 | } else { | 407 | 6 | write_literal(_out, "\"-Infinity\""); | 408 | 6 | } | 409 | 18 | } |
Unexecuted instantiation: _ZN5doris12variant_json7PrinterINS_14BufferWritableEE16write_non_finiteIfEEvT_ unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE16write_non_finiteIdEEvT_ Line | Count | Source | 401 | 30 | void write_non_finite(Number value) { | 402 | 30 | if (std::isnan(value)) { | 403 | 10 | write_literal(_out, "\"NaN\""); | 404 | 20 | } else if (value > 0) { | 405 | 10 | write_literal(_out, "\"Infinity\""); | 406 | 10 | } else { | 407 | 10 | write_literal(_out, "\"-Infinity\""); | 408 | 10 | } | 409 | 30 | } |
Unexecuted instantiation: unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE16write_non_finiteIfEEvT_ unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE16write_non_finiteIdEEvT_ Line | Count | Source | 401 | 24 | void write_non_finite(Number value) { | 402 | 24 | if (std::isnan(value)) { | 403 | 8 | write_literal(_out, "\"NaN\""); | 404 | 16 | } else if (value > 0) { | 405 | 8 | write_literal(_out, "\"Infinity\""); | 406 | 8 | } else { | 407 | 8 | write_literal(_out, "\"-Infinity\""); | 408 | 8 | } | 409 | 24 | } |
Unexecuted instantiation: unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE16write_non_finiteIfEEvT_ |
410 | | |
411 | 27.6k | void write_object(VariantRef value, uint32_t depth) { |
412 | 27.6k | write_literal(_out, "{"); |
413 | 27.6k | const uint32_t count = value.num_elements(); |
414 | 27.6k | StringRef previous_key; |
415 | 112k | for (uint32_t index = 0; index < count; ++index) { |
416 | 84.5k | if (index != 0) { |
417 | 57.5k | write_literal(_out, ","); |
418 | 57.5k | } |
419 | 84.5k | uint32_t field_id = 0; |
420 | 84.5k | VariantRef child = value.object_value_at(index, &field_id); |
421 | 84.5k | const StringRef key = value.metadata.key_at(field_id); |
422 | 84.5k | require_json_object_key(key, previous_key, index); |
423 | 84.5k | write_escaped_json_string(_out, key); |
424 | 84.5k | write_literal(_out, ":"); |
425 | 84.5k | write(child, depth + 1); |
426 | 84.5k | previous_key = key; |
427 | 84.5k | } |
428 | 27.6k | write_literal(_out, "}"); |
429 | 27.6k | } column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 134 | void write_object(VariantRef value, uint32_t depth) { | 412 | 134 | write_literal(_out, "{"); | 413 | 134 | const uint32_t count = value.num_elements(); | 414 | 134 | StringRef previous_key; | 415 | 439 | for (uint32_t index = 0; index < count; ++index) { | 416 | 305 | if (index != 0) { | 417 | 195 | write_literal(_out, ","); | 418 | 195 | } | 419 | 305 | uint32_t field_id = 0; | 420 | 305 | VariantRef child = value.object_value_at(index, &field_id); | 421 | 305 | const StringRef key = value.metadata.key_at(field_id); | 422 | 305 | require_json_object_key(key, previous_key, index); | 423 | 305 | write_escaped_json_string(_out, key); | 424 | 305 | write_literal(_out, ":"); | 425 | 305 | write(child, depth + 1); | 426 | 305 | previous_key = key; | 427 | 305 | } | 428 | 134 | write_literal(_out, "}"); | 429 | 134 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 4 | void write_object(VariantRef value, uint32_t depth) { | 412 | 4 | write_literal(_out, "{"); | 413 | 4 | const uint32_t count = value.num_elements(); | 414 | 4 | StringRef previous_key; | 415 | 8 | for (uint32_t index = 0; index < count; ++index) { | 416 | 4 | if (index != 0) { | 417 | 0 | write_literal(_out, ","); | 418 | 0 | } | 419 | 4 | uint32_t field_id = 0; | 420 | 4 | VariantRef child = value.object_value_at(index, &field_id); | 421 | 4 | const StringRef key = value.metadata.key_at(field_id); | 422 | 4 | require_json_object_key(key, previous_key, index); | 423 | 4 | write_escaped_json_string(_out, key); | 424 | 4 | write_literal(_out, ":"); | 425 | 4 | write(child, depth + 1); | 426 | 4 | previous_key = key; | 427 | 4 | } | 428 | 4 | write_literal(_out, "}"); | 429 | 4 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 32 | void write_object(VariantRef value, uint32_t depth) { | 412 | 32 | write_literal(_out, "{"); | 413 | 32 | const uint32_t count = value.num_elements(); | 414 | 32 | StringRef previous_key; | 415 | 88 | for (uint32_t index = 0; index < count; ++index) { | 416 | 56 | if (index != 0) { | 417 | 24 | write_literal(_out, ","); | 418 | 24 | } | 419 | 56 | uint32_t field_id = 0; | 420 | 56 | VariantRef child = value.object_value_at(index, &field_id); | 421 | 56 | const StringRef key = value.metadata.key_at(field_id); | 422 | 56 | require_json_object_key(key, previous_key, index); | 423 | 56 | write_escaped_json_string(_out, key); | 424 | 56 | write_literal(_out, ":"); | 425 | 56 | write(child, depth + 1); | 426 | 56 | previous_key = key; | 427 | 56 | } | 428 | 32 | write_literal(_out, "}"); | 429 | 32 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 5 | void write_object(VariantRef value, uint32_t depth) { | 412 | 5 | write_literal(_out, "{"); | 413 | 5 | const uint32_t count = value.num_elements(); | 414 | 5 | StringRef previous_key; | 415 | 10 | for (uint32_t index = 0; index < count; ++index) { | 416 | 5 | if (index != 0) { | 417 | 0 | write_literal(_out, ","); | 418 | 0 | } | 419 | 5 | uint32_t field_id = 0; | 420 | 5 | VariantRef child = value.object_value_at(index, &field_id); | 421 | 5 | const StringRef key = value.metadata.key_at(field_id); | 422 | 5 | require_json_object_key(key, previous_key, index); | 423 | 5 | write_escaped_json_string(_out, key); | 424 | 5 | write_literal(_out, ":"); | 425 | 5 | write(child, depth + 1); | 426 | 5 | previous_key = key; | 427 | 5 | } | 428 | 5 | write_literal(_out, "}"); | 429 | 5 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 56 | void write_object(VariantRef value, uint32_t depth) { | 412 | 56 | write_literal(_out, "{"); | 413 | 56 | const uint32_t count = value.num_elements(); | 414 | 56 | StringRef previous_key; | 415 | 127 | for (uint32_t index = 0; index < count; ++index) { | 416 | 71 | if (index != 0) { | 417 | 19 | write_literal(_out, ","); | 418 | 19 | } | 419 | 71 | uint32_t field_id = 0; | 420 | 71 | VariantRef child = value.object_value_at(index, &field_id); | 421 | 71 | const StringRef key = value.metadata.key_at(field_id); | 422 | 71 | require_json_object_key(key, previous_key, index); | 423 | 71 | write_escaped_json_string(_out, key); | 424 | 71 | write_literal(_out, ":"); | 425 | 71 | write(child, depth + 1); | 426 | 71 | previous_key = key; | 427 | 71 | } | 428 | 56 | write_literal(_out, "}"); | 429 | 56 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 11 | void write_object(VariantRef value, uint32_t depth) { | 412 | 11 | write_literal(_out, "{"); | 413 | 11 | const uint32_t count = value.num_elements(); | 414 | 11 | StringRef previous_key; | 415 | 30 | for (uint32_t index = 0; index < count; ++index) { | 416 | 19 | if (index != 0) { | 417 | 8 | write_literal(_out, ","); | 418 | 8 | } | 419 | 19 | uint32_t field_id = 0; | 420 | 19 | VariantRef child = value.object_value_at(index, &field_id); | 421 | 19 | const StringRef key = value.metadata.key_at(field_id); | 422 | 19 | require_json_object_key(key, previous_key, index); | 423 | 19 | write_escaped_json_string(_out, key); | 424 | 19 | write_literal(_out, ":"); | 425 | 19 | write(child, depth + 1); | 426 | 19 | previous_key = key; | 427 | 19 | } | 428 | 11 | write_literal(_out, "}"); | 429 | 11 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 14.8k | void write_object(VariantRef value, uint32_t depth) { | 412 | 14.8k | write_literal(_out, "{"); | 413 | 14.8k | const uint32_t count = value.num_elements(); | 414 | 14.8k | StringRef previous_key; | 415 | 60.5k | for (uint32_t index = 0; index < count; ++index) { | 416 | 45.6k | if (index != 0) { | 417 | 31.0k | write_literal(_out, ","); | 418 | 31.0k | } | 419 | 45.6k | uint32_t field_id = 0; | 420 | 45.6k | VariantRef child = value.object_value_at(index, &field_id); | 421 | 45.6k | const StringRef key = value.metadata.key_at(field_id); | 422 | 45.6k | require_json_object_key(key, previous_key, index); | 423 | 45.6k | write_escaped_json_string(_out, key); | 424 | 45.6k | write_literal(_out, ":"); | 425 | 45.6k | write(child, depth + 1); | 426 | 45.6k | previous_key = key; | 427 | 45.6k | } | 428 | 14.8k | write_literal(_out, "}"); | 429 | 14.8k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 12.4k | void write_object(VariantRef value, uint32_t depth) { | 412 | 12.4k | write_literal(_out, "{"); | 413 | 12.4k | const uint32_t count = value.num_elements(); | 414 | 12.4k | StringRef previous_key; | 415 | 50.9k | for (uint32_t index = 0; index < count; ++index) { | 416 | 38.4k | if (index != 0) { | 417 | 26.2k | write_literal(_out, ","); | 418 | 26.2k | } | 419 | 38.4k | uint32_t field_id = 0; | 420 | 38.4k | VariantRef child = value.object_value_at(index, &field_id); | 421 | 38.4k | const StringRef key = value.metadata.key_at(field_id); | 422 | 38.4k | require_json_object_key(key, previous_key, index); | 423 | 38.4k | write_escaped_json_string(_out, key); | 424 | 38.4k | write_literal(_out, ":"); | 425 | 38.4k | write(child, depth + 1); | 426 | 38.4k | previous_key = key; | 427 | 38.4k | } | 428 | 12.4k | write_literal(_out, "}"); | 429 | 12.4k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 411 | 4 | void write_object(VariantRef value, uint32_t depth) { | 412 | 4 | write_literal(_out, "{"); | 413 | 4 | const uint32_t count = value.num_elements(); | 414 | 4 | StringRef previous_key; | 415 | 8 | for (uint32_t index = 0; index < count; ++index) { | 416 | 4 | if (index != 0) { | 417 | 0 | write_literal(_out, ","); | 418 | 0 | } | 419 | 4 | uint32_t field_id = 0; | 420 | 4 | VariantRef child = value.object_value_at(index, &field_id); | 421 | 4 | const StringRef key = value.metadata.key_at(field_id); | 422 | 4 | require_json_object_key(key, previous_key, index); | 423 | 4 | write_escaped_json_string(_out, key); | 424 | 4 | write_literal(_out, ":"); | 425 | 4 | write(child, depth + 1); | 426 | 4 | previous_key = key; | 427 | 4 | } | 428 | 4 | write_literal(_out, "}"); | 429 | 4 | } |
|
430 | | |
431 | 407 | void write_array(VariantRef value, uint32_t depth) { |
432 | 407 | write_literal(_out, "["); |
433 | 407 | const uint32_t count = value.num_elements(); |
434 | 899 | for (uint32_t index = 0; index < count; ++index) { |
435 | 492 | if (index != 0) { |
436 | 105 | write_literal(_out, ","); |
437 | 105 | } |
438 | 492 | write(value.array_at(index), depth + 1); |
439 | 492 | } |
440 | 407 | write_literal(_out, "]"); |
441 | 407 | } column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 431 | 22 | void write_array(VariantRef value, uint32_t depth) { | 432 | 22 | write_literal(_out, "["); | 433 | 22 | const uint32_t count = value.num_elements(); | 434 | 44 | for (uint32_t index = 0; index < count; ++index) { | 435 | 22 | if (index != 0) { | 436 | 0 | write_literal(_out, ","); | 437 | 0 | } | 438 | 22 | write(value.array_at(index), depth + 1); | 439 | 22 | } | 440 | 22 | write_literal(_out, "]"); | 441 | 22 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 431 | 2 | void write_array(VariantRef value, uint32_t depth) { | 432 | 2 | write_literal(_out, "["); | 433 | 2 | const uint32_t count = value.num_elements(); | 434 | 6 | for (uint32_t index = 0; index < count; ++index) { | 435 | 4 | if (index != 0) { | 436 | 2 | write_literal(_out, ","); | 437 | 2 | } | 438 | 4 | write(value.array_at(index), depth + 1); | 439 | 4 | } | 440 | 2 | write_literal(_out, "]"); | 441 | 2 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE11write_arrayENS_10VariantRefEj Line | Count | Source | 431 | 4 | void write_array(VariantRef value, uint32_t depth) { | 432 | 4 | write_literal(_out, "["); | 433 | 4 | const uint32_t count = value.num_elements(); | 434 | 12 | for (uint32_t index = 0; index < count; ++index) { | 435 | 8 | if (index != 0) { | 436 | 4 | write_literal(_out, ","); | 437 | 4 | } | 438 | 8 | write(value.array_at(index), depth + 1); | 439 | 8 | } | 440 | 4 | write_literal(_out, "]"); | 441 | 4 | } |
Unexecuted instantiation: hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE11write_arrayENS_10VariantRefEj variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 431 | 20 | void write_array(VariantRef value, uint32_t depth) { | 432 | 20 | write_literal(_out, "["); | 433 | 20 | const uint32_t count = value.num_elements(); | 434 | 48 | for (uint32_t index = 0; index < count; ++index) { | 435 | 28 | if (index != 0) { | 436 | 10 | write_literal(_out, ","); | 437 | 10 | } | 438 | 28 | write(value.array_at(index), depth + 1); | 439 | 28 | } | 440 | 20 | write_literal(_out, "]"); | 441 | 20 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 431 | 262 | void write_array(VariantRef value, uint32_t depth) { | 432 | 262 | write_literal(_out, "["); | 433 | 262 | const uint32_t count = value.num_elements(); | 434 | 536 | for (uint32_t index = 0; index < count; ++index) { | 435 | 274 | if (index != 0) { | 436 | 12 | write_literal(_out, ","); | 437 | 12 | } | 438 | 274 | write(value.array_at(index), depth + 1); | 439 | 274 | } | 440 | 262 | write_literal(_out, "]"); | 441 | 262 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE11write_arrayENS_10VariantRefEj Line | Count | Source | 431 | 44 | void write_array(VariantRef value, uint32_t depth) { | 432 | 44 | write_literal(_out, "["); | 433 | 44 | const uint32_t count = value.num_elements(); | 434 | 114 | for (uint32_t index = 0; index < count; ++index) { | 435 | 70 | if (index != 0) { | 436 | 33 | write_literal(_out, ","); | 437 | 33 | } | 438 | 70 | write(value.array_at(index), depth + 1); | 439 | 70 | } | 440 | 44 | write_literal(_out, "]"); | 441 | 44 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 431 | 46 | void write_array(VariantRef value, uint32_t depth) { | 432 | 46 | write_literal(_out, "["); | 433 | 46 | const uint32_t count = value.num_elements(); | 434 | 120 | for (uint32_t index = 0; index < count; ++index) { | 435 | 74 | if (index != 0) { | 436 | 36 | write_literal(_out, ","); | 437 | 36 | } | 438 | 74 | write(value.array_at(index), depth + 1); | 439 | 74 | } | 440 | 46 | write_literal(_out, "]"); | 441 | 46 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 431 | 7 | void write_array(VariantRef value, uint32_t depth) { | 432 | 7 | write_literal(_out, "["); | 433 | 7 | const uint32_t count = value.num_elements(); | 434 | 19 | for (uint32_t index = 0; index < count; ++index) { | 435 | 12 | if (index != 0) { | 436 | 8 | write_literal(_out, ","); | 437 | 8 | } | 438 | 12 | write(value.array_at(index), depth + 1); | 439 | 12 | } | 440 | 7 | write_literal(_out, "]"); | 441 | 7 | } |
|
442 | | |
443 | | Writer& _out; |
444 | | const VariantJsonFormatOptions& _options; |
445 | | }; |
446 | | |
447 | | } // namespace variant_json |
448 | | |
449 | | // Writer is statically dispatched and only needs write(const char*, size_t). |
450 | | template <typename Writer> |
451 | | void to_json(VariantRef value, Writer& out, |
452 | 26.7k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { |
453 | 26.7k | variant_json::require_exact_json_value(value); |
454 | 26.7k | variant_json::Printer<Writer>(out, options).write(value, 0); |
455 | 26.7k | } column_variant_v2_test.cpp:_ZN5doris7to_jsonINS_12_GLOBAL__N_110JsonWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 154 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 154 | variant_json::require_exact_json_value(value); | 454 | 154 | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 154 | } |
function_variant_parse_test.cpp:_ZN5doris7to_jsonINS_12_GLOBAL__N_112StringWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 10 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 10 | variant_json::require_exact_json_value(value); | 454 | 10 | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 10 | } |
segment_flusher_format_test.cpp:_ZN5doris7to_jsonIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 24 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 24 | variant_json::require_exact_json_value(value); | 454 | 24 | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 24 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris7to_jsonINS_12_GLOBAL__N_117VariantJsonWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 7 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 7 | variant_json::require_exact_json_value(value); | 454 | 7 | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 7 | } |
variant_assembler_legacy_test.cpp:_ZN5doris7to_jsonINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 153 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 153 | variant_json::require_exact_json_value(value); | 454 | 153 | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 153 | } |
variant_string_parse_test.cpp:_ZN5doris7to_jsonINS_12_GLOBAL__N_112StringWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 40 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 40 | variant_json::require_exact_json_value(value); | 454 | 40 | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 40 | } |
_ZN5doris7to_jsonINS_14BufferWritableEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 13.1k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 13.1k | variant_json::require_exact_json_value(value); | 454 | 13.1k | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 13.1k | } |
unity_5_cxx.cxx:_ZN5doris7to_jsonINS_12_GLOBAL__N_114CountingWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 13.1k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 13.1k | variant_json::require_exact_json_value(value); | 454 | 13.1k | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 13.1k | } |
unity_5_cxx.cxx:_ZN5doris7to_jsonINS_12_GLOBAL__N_111FixedWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 452 | 85 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 453 | 85 | variant_json::require_exact_json_value(value); | 454 | 85 | variant_json::Printer<Writer>(out, options).write(value, 0); | 455 | 85 | } |
|
456 | | |
457 | | // Preserve the current Variant V1 SQL result contract for top-level scalar values: JSON strings |
458 | | // such as "value" and "2" are returned as value and 2. Once V1 is removed, this compatibility |
459 | | // output will change to the uniform JSON representation ("value" and "2"). |
460 | | template <typename Writer> |
461 | | void to_sql_string(VariantRef value, Writer& out, |
462 | 2.50k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { |
463 | 2.50k | variant_json::require_exact_json_value(value); |
464 | 2.50k | variant_json::Printer<Writer>(out, options).write_plain_scalar(value); |
465 | 2.50k | } _ZN5doris13to_sql_stringINS_14BufferWritableEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 462 | 2.45k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 463 | 2.45k | variant_json::require_exact_json_value(value); | 464 | 2.45k | variant_json::Printer<Writer>(out, options).write_plain_scalar(value); | 465 | 2.45k | } |
unity_5_cxx.cxx:_ZN5doris13to_sql_stringINS_12_GLOBAL__N_114CountingWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 462 | 26 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 463 | 26 | variant_json::require_exact_json_value(value); | 464 | 26 | variant_json::Printer<Writer>(out, options).write_plain_scalar(value); | 465 | 26 | } |
unity_5_cxx.cxx:_ZN5doris13to_sql_stringINS_12_GLOBAL__N_111FixedWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 462 | 26 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 463 | 26 | variant_json::require_exact_json_value(value); | 464 | 26 | variant_json::Printer<Writer>(out, options).write_plain_scalar(value); | 465 | 26 | } |
|
466 | | |
467 | | } // namespace doris |