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 | | bool throw_on_invalid_json = false; |
45 | | bool check_duplicate_json_path = false; |
46 | | |
47 | | // Takes a value snapshot. Later changes to mutable config do not affect an encoder. |
48 | | static JsonToVariantOptions current_config(); |
49 | | }; |
50 | | |
51 | | // Reuses one JSON parser and one batch builder. Each add_json() collects into a stack-only row; |
52 | | // finish_batch() performs pass 2. A failed add_json() is terminal, as is a successful |
53 | | // finish_batch(). try_add_json() rolls back invalid input rows and keeps collecting. |
54 | | class JsonStringToVariantEncoder { |
55 | | public: |
56 | | JsonStringToVariantEncoder(); |
57 | | explicit JsonStringToVariantEncoder(JsonToVariantOptions options); |
58 | | ~JsonStringToVariantEncoder(); |
59 | | |
60 | | JsonStringToVariantEncoder(const JsonStringToVariantEncoder&) = delete; |
61 | | JsonStringToVariantEncoder& operator=(const JsonStringToVariantEncoder&) = delete; |
62 | | JsonStringToVariantEncoder(JsonStringToVariantEncoder&&) noexcept; |
63 | | JsonStringToVariantEncoder& operator=(JsonStringToVariantEncoder&&) noexcept; |
64 | | |
65 | | void add_json(StringRef json); |
66 | | Status try_add_json(StringRef json); |
67 | | VariantBatchBuilder finish_batch(); |
68 | | |
69 | | private: |
70 | | struct Impl; |
71 | | std::unique_ptr<Impl> _impl; |
72 | | }; |
73 | | |
74 | | namespace variant_json { |
75 | | |
76 | | struct FormattedScalar { |
77 | | std::array<char, 128> bytes {}; |
78 | | size_t size = 0; |
79 | | }; |
80 | | |
81 | | void require_json_depth(uint32_t depth); |
82 | | void require_exact_json_value(VariantRef value); |
83 | | void require_valid_json_utf8(StringRef value, const char* description); |
84 | | void require_json_object_key(StringRef key, StringRef previous_key, uint32_t field_index); |
85 | | [[noreturn]] void throw_unsupported_json_primitive(VariantPrimitiveId id); |
86 | | |
87 | | FormattedScalar format_json_int(int64_t value); |
88 | | FormattedScalar format_json_float(float value); |
89 | | FormattedScalar format_json_double(double value); |
90 | | FormattedScalar format_json_decimal(VariantDecimal value); |
91 | | FormattedScalar format_json_date(int32_t days_since_epoch); |
92 | | FormattedScalar format_json_timestamp(int64_t value, uint8_t fractional_digits, bool utc_adjusted, |
93 | | const cctz::time_zone* timezone); |
94 | | FormattedScalar format_json_time_micros(int64_t value); |
95 | | FormattedScalar format_json_uuid(const std::array<uint8_t, 16>& value); |
96 | | |
97 | | template <typename Writer, size_t N> |
98 | 887k | void write_literal(Writer& out, const char (&value)[N]) { |
99 | 887k | out.write(value, N - 1); |
100 | 887k | } column_variant_v2_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_110JsonWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 98 | 1.14k | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 1.14k | out.write(value, N - 1); | 100 | 1.14k | } |
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 | 98 | 70 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 70 | out.write(value, N - 1); | 100 | 70 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 98 | 8 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 8 | out.write(value, N - 1); | 100 | 8 | } |
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 | 98 | 568 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 568 | out.write(value, N - 1); | 100 | 568 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json13write_literalIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterLm5EEEvRT_RAT0__Kc Line | Count | Source | 98 | 30 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 30 | out.write(value, N - 1); | 100 | 30 | } |
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 | 98 | 62 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 62 | out.write(value, N - 1); | 100 | 62 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_117VariantJsonWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 98 | 4 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 4 | out.write(value, N - 1); | 100 | 4 | } |
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 | 98 | 1.04k | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 1.04k | out.write(value, N - 1); | 100 | 1.04k | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json13write_literalINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 98 | 96 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 96 | out.write(value, N - 1); | 100 | 96 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json13write_literalINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterELm6EEEvRT_RAT0__Kc Line | Count | Source | 98 | 2 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 2 | out.write(value, N - 1); | 100 | 2 | } |
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 | 98 | 1.15k | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 1.15k | out.write(value, N - 1); | 100 | 1.15k | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 98 | 18 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 18 | out.write(value, N - 1); | 100 | 18 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm6EEEvRT_RAT0__Kc Line | Count | Source | 98 | 6 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 6 | out.write(value, N - 1); | 100 | 6 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm11EEEvRT_RAT0__Kc Line | Count | Source | 98 | 2 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 2 | out.write(value, N - 1); | 100 | 2 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_112StringWriterELm12EEEvRT_RAT0__Kc Line | Count | Source | 98 | 2 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 2 | out.write(value, N - 1); | 100 | 2 | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm2EEEvRT_RAT0__Kc Line | Count | Source | 98 | 477k | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 477k | out.write(value, N - 1); | 100 | 477k | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm5EEEvRT_RAT0__Kc Line | Count | Source | 98 | 82 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 82 | out.write(value, N - 1); | 100 | 82 | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm6EEEvRT_RAT0__Kc Line | Count | Source | 98 | 12 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 12 | out.write(value, N - 1); | 100 | 12 | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm11EEEvRT_RAT0__Kc Line | Count | Source | 98 | 12 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 12 | out.write(value, N - 1); | 100 | 12 | } |
_ZN5doris12variant_json13write_literalINS_14BufferWritableELm12EEEvRT_RAT0__Kc Line | Count | Source | 98 | 12 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 12 | out.write(value, N - 1); | 100 | 12 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 98 | 405k | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 405k | out.write(value, N - 1); | 100 | 405k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 98 | 92 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 92 | out.write(value, N - 1); | 100 | 92 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm6EEEvRT_RAT0__Kc Line | Count | Source | 98 | 20 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 20 | out.write(value, N - 1); | 100 | 20 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm11EEEvRT_RAT0__Kc Line | Count | Source | 98 | 20 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 20 | out.write(value, N - 1); | 100 | 20 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_114CountingWriterELm12EEEvRT_RAT0__Kc Line | Count | Source | 98 | 20 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 20 | out.write(value, N - 1); | 100 | 20 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm2EEEvRT_RAT0__Kc Line | Count | Source | 98 | 234 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 234 | out.write(value, N - 1); | 100 | 234 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm5EEEvRT_RAT0__Kc Line | Count | Source | 98 | 28 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 28 | out.write(value, N - 1); | 100 | 28 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm6EEEvRT_RAT0__Kc Line | Count | Source | 98 | 16 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 16 | out.write(value, N - 1); | 100 | 16 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm11EEEvRT_RAT0__Kc Line | Count | Source | 98 | 16 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 16 | out.write(value, N - 1); | 100 | 16 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json13write_literalINS_12_GLOBAL__N_111FixedWriterELm12EEEvRT_RAT0__Kc Line | Count | Source | 98 | 16 | void write_literal(Writer& out, const char (&value)[N]) { | 99 | 16 | out.write(value, N - 1); | 100 | 16 | } |
|
101 | | |
102 | | template <typename Writer> |
103 | 95.1k | void write_scalar(Writer& out, const FormattedScalar& value) { |
104 | 95.1k | out.write(value.bytes.data(), value.size); |
105 | 95.1k | } column_variant_v2_test.cpp:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_110JsonWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 238 | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 238 | out.write(value.bytes.data(), value.size); | 105 | 238 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_112StringWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 18 | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 18 | out.write(value.bytes.data(), value.size); | 105 | 18 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json12write_scalarIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 58 | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 58 | out.write(value.bytes.data(), value.size); | 105 | 58 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 4 | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 4 | out.write(value.bytes.data(), value.size); | 105 | 4 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json12write_scalarINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 228 | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 228 | out.write(value.bytes.data(), value.size); | 105 | 228 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_112StringWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 82 | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 82 | out.write(value.bytes.data(), value.size); | 105 | 82 | } |
_ZN5doris12variant_json12write_scalarINS_14BufferWritableEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 51.9k | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 51.9k | out.write(value.bytes.data(), value.size); | 105 | 51.9k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_114CountingWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 42.4k | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 42.4k | out.write(value.bytes.data(), value.size); | 105 | 42.4k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json12write_scalarINS_12_GLOBAL__N_111FixedWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 103 | 74 | void write_scalar(Writer& out, const FormattedScalar& value) { | 104 | 74 | out.write(value.bytes.data(), value.size); | 105 | 74 | } |
|
106 | | |
107 | | template <typename Writer> |
108 | 206 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { |
109 | 206 | write_literal(out, "\""); |
110 | 206 | write_scalar(out, value); |
111 | 206 | write_literal(out, "\""); |
112 | 206 | } 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 | 108 | 104 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 109 | 104 | write_literal(out, "\""); | 110 | 104 | write_scalar(out, value); | 111 | 104 | write_literal(out, "\""); | 112 | 104 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_112StringWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 108 | 26 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 109 | 26 | write_literal(out, "\""); | 110 | 26 | write_scalar(out, value); | 111 | 26 | write_literal(out, "\""); | 112 | 26 | } |
_ZN5doris12variant_json19write_quoted_scalarINS_14BufferWritableEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 108 | 12 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 109 | 12 | write_literal(out, "\""); | 110 | 12 | write_scalar(out, value); | 111 | 12 | write_literal(out, "\""); | 112 | 12 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_114CountingWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 108 | 36 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 109 | 36 | write_literal(out, "\""); | 110 | 36 | write_scalar(out, value); | 111 | 36 | write_literal(out, "\""); | 112 | 36 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json19write_quoted_scalarINS_12_GLOBAL__N_111FixedWriterEEEvRT_RKNS0_15FormattedScalarE Line | Count | Source | 108 | 28 | void write_quoted_scalar(Writer& out, const FormattedScalar& value) { | 109 | 28 | write_literal(out, "\""); | 110 | 28 | write_scalar(out, value); | 111 | 28 | write_literal(out, "\""); | 112 | 28 | } |
|
113 | | |
114 | | template <typename Writer> |
115 | 245k | void write_escaped_json_string(Writer& out, StringRef value) { |
116 | 245k | write_literal(out, "\""); |
117 | 245k | size_t plain_begin = 0; |
118 | 245k | size_t index = 0; |
119 | 5.46M | while (index < value.size) { |
120 | 5.22M | const auto byte = static_cast<uint8_t>(value.data[index]); |
121 | 5.22M | const char* escaped = nullptr; |
122 | 5.22M | size_t escaped_size = 0; |
123 | 5.22M | size_t consumed = 1; |
124 | 5.22M | switch (byte) { |
125 | 114 | case '"': |
126 | 114 | escaped = "\\\""; |
127 | 114 | escaped_size = 2; |
128 | 114 | break; |
129 | 6 | case '\\': |
130 | 6 | escaped = "\\\\"; |
131 | 6 | escaped_size = 2; |
132 | 6 | break; |
133 | 0 | case '\b': |
134 | 0 | escaped = "\\b"; |
135 | 0 | escaped_size = 2; |
136 | 0 | break; |
137 | 0 | case '\f': |
138 | 0 | escaped = "\\f"; |
139 | 0 | escaped_size = 2; |
140 | 0 | break; |
141 | 42 | case '\n': |
142 | 42 | escaped = "\\n"; |
143 | 42 | escaped_size = 2; |
144 | 42 | break; |
145 | 0 | case '\r': |
146 | 0 | escaped = "\\r"; |
147 | 0 | escaped_size = 2; |
148 | 0 | break; |
149 | 2 | case '\t': |
150 | 2 | escaped = "\\t"; |
151 | 2 | escaped_size = 2; |
152 | 2 | break; |
153 | 5.22M | default: |
154 | 5.22M | if (byte < 0x20) { |
155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; |
156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; |
157 | 0 | if (index != plain_begin) { |
158 | 0 | out.write(value.data + plain_begin, index - plain_begin); |
159 | 0 | } |
160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); |
161 | 0 | ++index; |
162 | 0 | plain_begin = index; |
163 | 0 | continue; |
164 | 0 | } |
165 | 5.22M | if (index + 2 < value.size && byte == 0xE2 && |
166 | 5.22M | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && |
167 | 5.22M | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || |
168 | 2 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { |
169 | 2 | escaped = |
170 | 2 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; |
171 | 2 | escaped_size = 6; |
172 | 2 | consumed = 3; |
173 | 2 | } |
174 | 5.22M | break; |
175 | 5.22M | } |
176 | 5.22M | if (escaped == nullptr) { |
177 | 5.22M | ++index; |
178 | 5.22M | continue; |
179 | 5.22M | } |
180 | 166 | if (index != plain_begin) { |
181 | 124 | out.write(value.data + plain_begin, index - plain_begin); |
182 | 124 | } |
183 | 166 | out.write(escaped, escaped_size); |
184 | 166 | index += consumed; |
185 | 166 | plain_begin = index; |
186 | 166 | } |
187 | 245k | if (plain_begin != value.size) { |
188 | 245k | out.write(value.data + plain_begin, value.size - plain_begin); |
189 | 245k | } |
190 | 245k | write_literal(out, "\""); |
191 | 245k | } column_variant_v2_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefE Line | Count | Source | 115 | 194 | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 194 | write_literal(out, "\""); | 117 | 194 | size_t plain_begin = 0; | 118 | 194 | size_t index = 0; | 119 | 404 | while (index < value.size) { | 120 | 210 | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 210 | const char* escaped = nullptr; | 122 | 210 | size_t escaped_size = 0; | 123 | 210 | size_t consumed = 1; | 124 | 210 | switch (byte) { | 125 | 0 | case '"': | 126 | 0 | escaped = "\\\""; | 127 | 0 | escaped_size = 2; | 128 | 0 | break; | 129 | 0 | case '\\': | 130 | 0 | escaped = "\\\\"; | 131 | 0 | escaped_size = 2; | 132 | 0 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 0 | case '\n': | 142 | 0 | escaped = "\\n"; | 143 | 0 | escaped_size = 2; | 144 | 0 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 0 | case '\t': | 150 | 0 | escaped = "\\t"; | 151 | 0 | escaped_size = 2; | 152 | 0 | break; | 153 | 210 | default: | 154 | 210 | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 210 | if (index + 2 < value.size && byte == 0xE2 && | 166 | 210 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 210 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 0 | escaped = | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 0 | escaped_size = 6; | 172 | 0 | consumed = 3; | 173 | 0 | } | 174 | 210 | break; | 175 | 210 | } | 176 | 210 | if (escaped == nullptr) { | 177 | 210 | ++index; | 178 | 210 | continue; | 179 | 210 | } | 180 | 0 | if (index != plain_begin) { | 181 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 0 | } | 183 | 0 | out.write(escaped, escaped_size); | 184 | 0 | index += consumed; | 185 | 0 | plain_begin = index; | 186 | 0 | } | 187 | 194 | if (plain_begin != value.size) { | 188 | 194 | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 194 | } | 190 | 194 | write_literal(out, "\""); | 191 | 194 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefE Line | Count | Source | 115 | 12 | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 12 | write_literal(out, "\""); | 117 | 12 | size_t plain_begin = 0; | 118 | 12 | size_t index = 0; | 119 | 32 | while (index < value.size) { | 120 | 20 | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 20 | const char* escaped = nullptr; | 122 | 20 | size_t escaped_size = 0; | 123 | 20 | size_t consumed = 1; | 124 | 20 | switch (byte) { | 125 | 0 | case '"': | 126 | 0 | escaped = "\\\""; | 127 | 0 | escaped_size = 2; | 128 | 0 | break; | 129 | 0 | case '\\': | 130 | 0 | escaped = "\\\\"; | 131 | 0 | escaped_size = 2; | 132 | 0 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 0 | case '\n': | 142 | 0 | escaped = "\\n"; | 143 | 0 | escaped_size = 2; | 144 | 0 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 0 | case '\t': | 150 | 0 | escaped = "\\t"; | 151 | 0 | escaped_size = 2; | 152 | 0 | break; | 153 | 20 | default: | 154 | 20 | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 20 | if (index + 2 < value.size && byte == 0xE2 && | 166 | 20 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 20 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 0 | escaped = | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 0 | escaped_size = 6; | 172 | 0 | consumed = 3; | 173 | 0 | } | 174 | 20 | break; | 175 | 20 | } | 176 | 20 | if (escaped == nullptr) { | 177 | 20 | ++index; | 178 | 20 | continue; | 179 | 20 | } | 180 | 0 | if (index != plain_begin) { | 181 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 0 | } | 183 | 0 | out.write(escaped, escaped_size); | 184 | 0 | index += consumed; | 185 | 0 | plain_begin = index; | 186 | 0 | } | 187 | 12 | if (plain_begin != value.size) { | 188 | 12 | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 12 | } | 190 | 12 | write_literal(out, "\""); | 191 | 12 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_NS_9StringRefE Line | Count | Source | 115 | 128 | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 128 | write_literal(out, "\""); | 117 | 128 | size_t plain_begin = 0; | 118 | 128 | size_t index = 0; | 119 | 672 | while (index < value.size) { | 120 | 544 | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 544 | const char* escaped = nullptr; | 122 | 544 | size_t escaped_size = 0; | 123 | 544 | size_t consumed = 1; | 124 | 544 | switch (byte) { | 125 | 0 | case '"': | 126 | 0 | escaped = "\\\""; | 127 | 0 | escaped_size = 2; | 128 | 0 | break; | 129 | 0 | case '\\': | 130 | 0 | escaped = "\\\\"; | 131 | 0 | escaped_size = 2; | 132 | 0 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 0 | case '\n': | 142 | 0 | escaped = "\\n"; | 143 | 0 | escaped_size = 2; | 144 | 0 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 0 | case '\t': | 150 | 0 | escaped = "\\t"; | 151 | 0 | escaped_size = 2; | 152 | 0 | break; | 153 | 544 | default: | 154 | 544 | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 544 | if (index + 2 < value.size && byte == 0xE2 && | 166 | 544 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 544 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 0 | escaped = | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 0 | escaped_size = 6; | 172 | 0 | consumed = 3; | 173 | 0 | } | 174 | 544 | break; | 175 | 544 | } | 176 | 544 | if (escaped == nullptr) { | 177 | 544 | ++index; | 178 | 544 | continue; | 179 | 544 | } | 180 | 0 | if (index != plain_begin) { | 181 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 0 | } | 183 | 0 | out.write(escaped, escaped_size); | 184 | 0 | index += consumed; | 185 | 0 | plain_begin = index; | 186 | 0 | } | 187 | 128 | if (plain_begin != value.size) { | 188 | 128 | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 128 | } | 190 | 128 | write_literal(out, "\""); | 191 | 128 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_NS_9StringRefE Line | Count | Source | 115 | 16 | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 16 | write_literal(out, "\""); | 117 | 16 | size_t plain_begin = 0; | 118 | 16 | size_t index = 0; | 119 | 66 | while (index < value.size) { | 120 | 50 | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 50 | const char* escaped = nullptr; | 122 | 50 | size_t escaped_size = 0; | 123 | 50 | size_t consumed = 1; | 124 | 50 | switch (byte) { | 125 | 0 | case '"': | 126 | 0 | escaped = "\\\""; | 127 | 0 | escaped_size = 2; | 128 | 0 | break; | 129 | 0 | case '\\': | 130 | 0 | escaped = "\\\\"; | 131 | 0 | escaped_size = 2; | 132 | 0 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 0 | case '\n': | 142 | 0 | escaped = "\\n"; | 143 | 0 | escaped_size = 2; | 144 | 0 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 0 | case '\t': | 150 | 0 | escaped = "\\t"; | 151 | 0 | escaped_size = 2; | 152 | 0 | break; | 153 | 50 | default: | 154 | 50 | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 50 | if (index + 2 < value.size && byte == 0xE2 && | 166 | 50 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 50 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 0 | escaped = | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 0 | escaped_size = 6; | 172 | 0 | consumed = 3; | 173 | 0 | } | 174 | 50 | break; | 175 | 50 | } | 176 | 50 | if (escaped == nullptr) { | 177 | 50 | ++index; | 178 | 50 | continue; | 179 | 50 | } | 180 | 0 | if (index != plain_begin) { | 181 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 0 | } | 183 | 0 | out.write(escaped, escaped_size); | 184 | 0 | index += consumed; | 185 | 0 | plain_begin = index; | 186 | 0 | } | 187 | 16 | if (plain_begin != value.size) { | 188 | 16 | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 16 | } | 190 | 16 | write_literal(out, "\""); | 191 | 16 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefE Line | Count | Source | 115 | 168 | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 168 | write_literal(out, "\""); | 117 | 168 | size_t plain_begin = 0; | 118 | 168 | size_t index = 0; | 119 | 536 | while (index < value.size) { | 120 | 368 | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 368 | const char* escaped = nullptr; | 122 | 368 | size_t escaped_size = 0; | 123 | 368 | size_t consumed = 1; | 124 | 368 | switch (byte) { | 125 | 0 | case '"': | 126 | 0 | escaped = "\\\""; | 127 | 0 | escaped_size = 2; | 128 | 0 | break; | 129 | 0 | case '\\': | 130 | 0 | escaped = "\\\\"; | 131 | 0 | escaped_size = 2; | 132 | 0 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 0 | case '\n': | 142 | 0 | escaped = "\\n"; | 143 | 0 | escaped_size = 2; | 144 | 0 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 0 | case '\t': | 150 | 0 | escaped = "\\t"; | 151 | 0 | escaped_size = 2; | 152 | 0 | break; | 153 | 368 | default: | 154 | 368 | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 368 | if (index + 2 < value.size && byte == 0xE2 && | 166 | 368 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 368 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 0 | escaped = | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 0 | escaped_size = 6; | 172 | 0 | consumed = 3; | 173 | 0 | } | 174 | 368 | break; | 175 | 368 | } | 176 | 368 | if (escaped == nullptr) { | 177 | 368 | ++index; | 178 | 368 | continue; | 179 | 368 | } | 180 | 0 | if (index != plain_begin) { | 181 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 0 | } | 183 | 0 | out.write(escaped, escaped_size); | 184 | 0 | index += consumed; | 185 | 0 | plain_begin = index; | 186 | 0 | } | 187 | 168 | if (plain_begin != value.size) { | 188 | 164 | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 164 | } | 190 | 168 | write_literal(out, "\""); | 191 | 168 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefE Line | Count | Source | 115 | 64 | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 64 | write_literal(out, "\""); | 117 | 64 | size_t plain_begin = 0; | 118 | 64 | size_t index = 0; | 119 | 308 | while (index < value.size) { | 120 | 244 | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 244 | const char* escaped = nullptr; | 122 | 244 | size_t escaped_size = 0; | 123 | 244 | size_t consumed = 1; | 124 | 244 | switch (byte) { | 125 | 2 | case '"': | 126 | 2 | escaped = "\\\""; | 127 | 2 | escaped_size = 2; | 128 | 2 | break; | 129 | 2 | case '\\': | 130 | 2 | escaped = "\\\\"; | 131 | 2 | escaped_size = 2; | 132 | 2 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 2 | case '\n': | 142 | 2 | escaped = "\\n"; | 143 | 2 | escaped_size = 2; | 144 | 2 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 2 | case '\t': | 150 | 2 | escaped = "\\t"; | 151 | 2 | escaped_size = 2; | 152 | 2 | break; | 153 | 236 | default: | 154 | 236 | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 236 | if (index + 2 < value.size && byte == 0xE2 && | 166 | 236 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 236 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 2 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 2 | escaped = | 170 | 2 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 2 | escaped_size = 6; | 172 | 2 | consumed = 3; | 173 | 2 | } | 174 | 236 | break; | 175 | 244 | } | 176 | 244 | if (escaped == nullptr) { | 177 | 234 | ++index; | 178 | 234 | continue; | 179 | 234 | } | 180 | 10 | if (index != plain_begin) { | 181 | 4 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 4 | } | 183 | 10 | out.write(escaped, escaped_size); | 184 | 10 | index += consumed; | 185 | 10 | plain_begin = index; | 186 | 10 | } | 187 | 64 | if (plain_begin != value.size) { | 188 | 62 | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 62 | } | 190 | 64 | write_literal(out, "\""); | 191 | 64 | } |
_ZN5doris12variant_json25write_escaped_json_stringINS_14BufferWritableEEEvRT_NS_9StringRefE Line | Count | Source | 115 | 131k | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 131k | write_literal(out, "\""); | 117 | 131k | size_t plain_begin = 0; | 118 | 131k | size_t index = 0; | 119 | 2.77M | while (index < value.size) { | 120 | 2.64M | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 2.64M | const char* escaped = nullptr; | 122 | 2.64M | size_t escaped_size = 0; | 123 | 2.64M | size_t consumed = 1; | 124 | 2.64M | switch (byte) { | 125 | 22 | case '"': | 126 | 22 | escaped = "\\\""; | 127 | 22 | escaped_size = 2; | 128 | 22 | break; | 129 | 2 | case '\\': | 130 | 2 | escaped = "\\\\"; | 131 | 2 | escaped_size = 2; | 132 | 2 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 10 | case '\n': | 142 | 10 | escaped = "\\n"; | 143 | 10 | escaped_size = 2; | 144 | 10 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 0 | case '\t': | 150 | 0 | escaped = "\\t"; | 151 | 0 | escaped_size = 2; | 152 | 0 | break; | 153 | 2.64M | default: | 154 | 2.64M | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 2.64M | if (index + 2 < value.size && byte == 0xE2 && | 166 | 2.64M | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 2.64M | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 0 | escaped = | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 0 | escaped_size = 6; | 172 | 0 | consumed = 3; | 173 | 0 | } | 174 | 2.64M | break; | 175 | 2.64M | } | 176 | 2.64M | if (escaped == nullptr) { | 177 | 2.64M | ++index; | 178 | 2.64M | continue; | 179 | 2.64M | } | 180 | 34 | if (index != plain_begin) { | 181 | 26 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 26 | } | 183 | 34 | out.write(escaped, escaped_size); | 184 | 34 | index += consumed; | 185 | 34 | plain_begin = index; | 186 | 34 | } | 187 | 131k | if (plain_begin != value.size) { | 188 | 131k | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 131k | } | 190 | 131k | write_literal(out, "\""); | 191 | 131k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_114CountingWriterEEEvRT_NS_9StringRefE Line | Count | Source | 115 | 112k | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 112k | write_literal(out, "\""); | 117 | 112k | size_t plain_begin = 0; | 118 | 112k | size_t index = 0; | 119 | 2.69M | while (index < value.size) { | 120 | 2.57M | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 2.57M | const char* escaped = nullptr; | 122 | 2.57M | size_t escaped_size = 0; | 123 | 2.57M | size_t consumed = 1; | 124 | 2.57M | switch (byte) { | 125 | 54 | case '"': | 126 | 54 | escaped = "\\\""; | 127 | 54 | escaped_size = 2; | 128 | 54 | break; | 129 | 2 | case '\\': | 130 | 2 | escaped = "\\\\"; | 131 | 2 | escaped_size = 2; | 132 | 2 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 18 | case '\n': | 142 | 18 | escaped = "\\n"; | 143 | 18 | escaped_size = 2; | 144 | 18 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 0 | case '\t': | 150 | 0 | escaped = "\\t"; | 151 | 0 | escaped_size = 2; | 152 | 0 | break; | 153 | 2.57M | default: | 154 | 2.57M | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 2.57M | if (index + 2 < value.size && byte == 0xE2 && | 166 | 2.57M | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 2.57M | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 0 | escaped = | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 0 | escaped_size = 6; | 172 | 0 | consumed = 3; | 173 | 0 | } | 174 | 2.57M | break; | 175 | 2.57M | } | 176 | 2.57M | if (escaped == nullptr) { | 177 | 2.57M | ++index; | 178 | 2.57M | continue; | 179 | 2.57M | } | 180 | 74 | if (index != plain_begin) { | 181 | 58 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 58 | } | 183 | 74 | out.write(escaped, escaped_size); | 184 | 74 | index += consumed; | 185 | 74 | plain_begin = index; | 186 | 74 | } | 187 | 112k | if (plain_begin != value.size) { | 188 | 112k | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 112k | } | 190 | 112k | write_literal(out, "\""); | 191 | 112k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json25write_escaped_json_stringINS_12_GLOBAL__N_111FixedWriterEEEvRT_NS_9StringRefE Line | Count | Source | 115 | 62 | void write_escaped_json_string(Writer& out, StringRef value) { | 116 | 62 | write_literal(out, "\""); | 117 | 62 | size_t plain_begin = 0; | 118 | 62 | size_t index = 0; | 119 | 316 | while (index < value.size) { | 120 | 254 | const auto byte = static_cast<uint8_t>(value.data[index]); | 121 | 254 | const char* escaped = nullptr; | 122 | 254 | size_t escaped_size = 0; | 123 | 254 | size_t consumed = 1; | 124 | 254 | switch (byte) { | 125 | 36 | case '"': | 126 | 36 | escaped = "\\\""; | 127 | 36 | escaped_size = 2; | 128 | 36 | break; | 129 | 0 | case '\\': | 130 | 0 | escaped = "\\\\"; | 131 | 0 | escaped_size = 2; | 132 | 0 | break; | 133 | 0 | case '\b': | 134 | 0 | escaped = "\\b"; | 135 | 0 | escaped_size = 2; | 136 | 0 | break; | 137 | 0 | case '\f': | 138 | 0 | escaped = "\\f"; | 139 | 0 | escaped_size = 2; | 140 | 0 | break; | 141 | 12 | case '\n': | 142 | 12 | escaped = "\\n"; | 143 | 12 | escaped_size = 2; | 144 | 12 | break; | 145 | 0 | case '\r': | 146 | 0 | escaped = "\\r"; | 147 | 0 | escaped_size = 2; | 148 | 0 | break; | 149 | 0 | case '\t': | 150 | 0 | escaped = "\\t"; | 151 | 0 | escaped_size = 2; | 152 | 0 | break; | 153 | 206 | default: | 154 | 206 | if (byte < 0x20) { | 155 | 0 | static constexpr char HEX[] = "0123456789ABCDEF"; | 156 | 0 | char unicode_escape[] = {'\\', 'u', '0', '0', HEX[byte >> 4], HEX[byte & 0x0F]}; | 157 | 0 | if (index != plain_begin) { | 158 | 0 | out.write(value.data + plain_begin, index - plain_begin); | 159 | 0 | } | 160 | 0 | out.write(unicode_escape, sizeof(unicode_escape)); | 161 | 0 | ++index; | 162 | 0 | plain_begin = index; | 163 | 0 | continue; | 164 | 0 | } | 165 | 206 | if (index + 2 < value.size && byte == 0xE2 && | 166 | 206 | static_cast<uint8_t>(value.data[index + 1]) == 0x80 && | 167 | 206 | (static_cast<uint8_t>(value.data[index + 2]) == 0xA8 || | 168 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA9)) { | 169 | 0 | escaped = | 170 | 0 | static_cast<uint8_t>(value.data[index + 2]) == 0xA8 ? "\\u2028" : "\\u2029"; | 171 | 0 | escaped_size = 6; | 172 | 0 | consumed = 3; | 173 | 0 | } | 174 | 206 | break; | 175 | 254 | } | 176 | 254 | if (escaped == nullptr) { | 177 | 206 | ++index; | 178 | 206 | continue; | 179 | 206 | } | 180 | 48 | if (index != plain_begin) { | 181 | 36 | out.write(value.data + plain_begin, index - plain_begin); | 182 | 36 | } | 183 | 48 | out.write(escaped, escaped_size); | 184 | 48 | index += consumed; | 185 | 48 | plain_begin = index; | 186 | 48 | } | 187 | 62 | if (plain_begin != value.size) { | 188 | 38 | out.write(value.data + plain_begin, value.size - plain_begin); | 189 | 38 | } | 190 | 62 | write_literal(out, "\""); | 191 | 62 | } |
|
192 | | |
193 | | template <typename Writer> |
194 | 76.5k | void write_json_string(Writer& out, StringRef value, const char* description) { |
195 | 76.5k | require_valid_json_utf8(value, description); |
196 | 76.5k | write_escaped_json_string(out, value); |
197 | 76.5k | } Unexecuted instantiation: column_variant_v2_test.cpp:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefEPKc function_variant_parse_test.cpp:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 194 | 2 | void write_json_string(Writer& out, StringRef value, const char* description) { | 195 | 2 | require_valid_json_utf8(value, description); | 196 | 2 | write_escaped_json_string(out, value); | 197 | 2 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json17write_json_stringIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvRT_NS_9StringRefEPKc Line | Count | Source | 194 | 16 | void write_json_string(Writer& out, StringRef value, const char* description) { | 195 | 16 | require_valid_json_utf8(value, description); | 196 | 16 | write_escaped_json_string(out, value); | 197 | 16 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_117VariantJsonWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 194 | 6 | void write_json_string(Writer& out, StringRef value, const char* description) { | 195 | 6 | require_valid_json_utf8(value, description); | 196 | 6 | write_escaped_json_string(out, value); | 197 | 6 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json17write_json_stringINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 194 | 26 | void write_json_string(Writer& out, StringRef value, const char* description) { | 195 | 26 | require_valid_json_utf8(value, description); | 196 | 26 | write_escaped_json_string(out, value); | 197 | 26 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_112StringWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 194 | 14 | void write_json_string(Writer& out, StringRef value, const char* description) { | 195 | 14 | require_valid_json_utf8(value, description); | 196 | 14 | write_escaped_json_string(out, value); | 197 | 14 | } |
_ZN5doris12variant_json17write_json_stringINS_14BufferWritableEEEvRT_NS_9StringRefEPKc Line | Count | Source | 194 | 40.6k | void write_json_string(Writer& out, StringRef value, const char* description) { | 195 | 40.6k | require_valid_json_utf8(value, description); | 196 | 40.6k | write_escaped_json_string(out, value); | 197 | 40.6k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_114CountingWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 194 | 35.8k | void write_json_string(Writer& out, StringRef value, const char* description) { | 195 | 35.8k | require_valid_json_utf8(value, description); | 196 | 35.8k | write_escaped_json_string(out, value); | 197 | 35.8k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json17write_json_stringINS_12_GLOBAL__N_111FixedWriterEEEvRT_NS_9StringRefEPKc Line | Count | Source | 194 | 56 | void write_json_string(Writer& out, StringRef value, const char* description) { | 195 | 56 | require_valid_json_utf8(value, description); | 196 | 56 | write_escaped_json_string(out, value); | 197 | 56 | } |
|
198 | | |
199 | | template <typename Writer> |
200 | 4 | void write_json_binary(Writer& out, StringRef value) { |
201 | 4 | static constexpr char BASE64[] = |
202 | 4 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
203 | 4 | write_literal(out, "\""); |
204 | 4 | std::array<char, 1024> encoded {}; |
205 | 4 | size_t encoded_size = 0; |
206 | 4 | size_t index = 0; |
207 | 4 | const auto flush = [&]() { |
208 | 4 | if (encoded_size != 0) { |
209 | 4 | out.write(encoded.data(), encoded_size); |
210 | 4 | encoded_size = 0; |
211 | 4 | } |
212 | 4 | }; 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 | 207 | 2 | const auto flush = [&]() { | 208 | 2 | if (encoded_size != 0) { | 209 | 2 | out.write(encoded.data(), encoded_size); | 210 | 2 | encoded_size = 0; | 211 | 2 | } | 212 | 2 | }; |
_ZZN5doris12variant_json17write_json_binaryINS_14BufferWritableEEEvRT_NS_9StringRefEENKUlvE_clEv Line | Count | Source | 207 | 2 | const auto flush = [&]() { | 208 | 2 | if (encoded_size != 0) { | 209 | 2 | out.write(encoded.data(), encoded_size); | 210 | 2 | encoded_size = 0; | 211 | 2 | } | 212 | 2 | }; |
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 |
213 | 6 | while (index + 3 <= value.size) { |
214 | 2 | if (encoded.size() - encoded_size < 4) { |
215 | 0 | flush(); |
216 | 0 | } |
217 | 2 | const auto first = static_cast<uint8_t>(value.data[index]); |
218 | 2 | const auto second = static_cast<uint8_t>(value.data[index + 1]); |
219 | 2 | const auto third = static_cast<uint8_t>(value.data[index + 2]); |
220 | 2 | encoded[encoded_size++] = BASE64[first >> 2]; |
221 | 2 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; |
222 | 2 | encoded[encoded_size++] = BASE64[((second & 0x0F) << 2) | (third >> 6)]; |
223 | 2 | encoded[encoded_size++] = BASE64[third & 0x3F]; |
224 | 2 | index += 3; |
225 | 2 | } |
226 | 4 | if (index != value.size) { |
227 | 4 | if (encoded.size() - encoded_size < 4) { |
228 | 0 | flush(); |
229 | 0 | } |
230 | 4 | const auto first = static_cast<uint8_t>(value.data[index]); |
231 | 4 | encoded[encoded_size++] = BASE64[first >> 2]; |
232 | 4 | if (index + 1 == value.size) { |
233 | 2 | encoded[encoded_size++] = BASE64[(first & 0x03) << 4]; |
234 | 2 | encoded[encoded_size++] = '='; |
235 | 2 | encoded[encoded_size++] = '='; |
236 | 2 | } else { |
237 | 2 | const auto second = static_cast<uint8_t>(value.data[index + 1]); |
238 | 2 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; |
239 | 2 | encoded[encoded_size++] = BASE64[(second & 0x0F) << 2]; |
240 | 2 | encoded[encoded_size++] = '='; |
241 | 2 | } |
242 | 4 | } |
243 | 4 | flush(); |
244 | 4 | write_literal(out, "\""); |
245 | 4 | } 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 | 200 | 2 | void write_json_binary(Writer& out, StringRef value) { | 201 | 2 | static constexpr char BASE64[] = | 202 | 2 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 203 | 2 | write_literal(out, "\""); | 204 | 2 | std::array<char, 1024> encoded {}; | 205 | 2 | size_t encoded_size = 0; | 206 | 2 | size_t index = 0; | 207 | 2 | const auto flush = [&]() { | 208 | 2 | if (encoded_size != 0) { | 209 | 2 | out.write(encoded.data(), encoded_size); | 210 | 2 | encoded_size = 0; | 211 | 2 | } | 212 | 2 | }; | 213 | 4 | while (index + 3 <= value.size) { | 214 | 2 | if (encoded.size() - encoded_size < 4) { | 215 | 0 | flush(); | 216 | 0 | } | 217 | 2 | const auto first = static_cast<uint8_t>(value.data[index]); | 218 | 2 | const auto second = static_cast<uint8_t>(value.data[index + 1]); | 219 | 2 | const auto third = static_cast<uint8_t>(value.data[index + 2]); | 220 | 2 | encoded[encoded_size++] = BASE64[first >> 2]; | 221 | 2 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; | 222 | 2 | encoded[encoded_size++] = BASE64[((second & 0x0F) << 2) | (third >> 6)]; | 223 | 2 | encoded[encoded_size++] = BASE64[third & 0x3F]; | 224 | 2 | index += 3; | 225 | 2 | } | 226 | 2 | if (index != value.size) { | 227 | 2 | if (encoded.size() - encoded_size < 4) { | 228 | 0 | flush(); | 229 | 0 | } | 230 | 2 | const auto first = static_cast<uint8_t>(value.data[index]); | 231 | 2 | encoded[encoded_size++] = BASE64[first >> 2]; | 232 | 2 | if (index + 1 == value.size) { | 233 | 2 | encoded[encoded_size++] = BASE64[(first & 0x03) << 4]; | 234 | 2 | encoded[encoded_size++] = '='; | 235 | 2 | encoded[encoded_size++] = '='; | 236 | 2 | } else { | 237 | 0 | const auto second = static_cast<uint8_t>(value.data[index + 1]); | 238 | 0 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; | 239 | 0 | encoded[encoded_size++] = BASE64[(second & 0x0F) << 2]; | 240 | 0 | encoded[encoded_size++] = '='; | 241 | 0 | } | 242 | 2 | } | 243 | 2 | flush(); | 244 | 2 | write_literal(out, "\""); | 245 | 2 | } |
_ZN5doris12variant_json17write_json_binaryINS_14BufferWritableEEEvRT_NS_9StringRefE Line | Count | Source | 200 | 2 | void write_json_binary(Writer& out, StringRef value) { | 201 | 2 | static constexpr char BASE64[] = | 202 | 2 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 203 | 2 | write_literal(out, "\""); | 204 | 2 | std::array<char, 1024> encoded {}; | 205 | 2 | size_t encoded_size = 0; | 206 | 2 | size_t index = 0; | 207 | 2 | const auto flush = [&]() { | 208 | 2 | if (encoded_size != 0) { | 209 | 2 | out.write(encoded.data(), encoded_size); | 210 | 2 | encoded_size = 0; | 211 | 2 | } | 212 | 2 | }; | 213 | 2 | while (index + 3 <= value.size) { | 214 | 0 | if (encoded.size() - encoded_size < 4) { | 215 | 0 | flush(); | 216 | 0 | } | 217 | 0 | const auto first = static_cast<uint8_t>(value.data[index]); | 218 | 0 | const auto second = static_cast<uint8_t>(value.data[index + 1]); | 219 | 0 | const auto third = static_cast<uint8_t>(value.data[index + 2]); | 220 | 0 | encoded[encoded_size++] = BASE64[first >> 2]; | 221 | 0 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; | 222 | 0 | encoded[encoded_size++] = BASE64[((second & 0x0F) << 2) | (third >> 6)]; | 223 | 0 | encoded[encoded_size++] = BASE64[third & 0x3F]; | 224 | 0 | index += 3; | 225 | 0 | } | 226 | 2 | if (index != value.size) { | 227 | 2 | if (encoded.size() - encoded_size < 4) { | 228 | 0 | flush(); | 229 | 0 | } | 230 | 2 | const auto first = static_cast<uint8_t>(value.data[index]); | 231 | 2 | encoded[encoded_size++] = BASE64[first >> 2]; | 232 | 2 | if (index + 1 == value.size) { | 233 | 0 | encoded[encoded_size++] = BASE64[(first & 0x03) << 4]; | 234 | 0 | encoded[encoded_size++] = '='; | 235 | 0 | encoded[encoded_size++] = '='; | 236 | 2 | } else { | 237 | 2 | const auto second = static_cast<uint8_t>(value.data[index + 1]); | 238 | 2 | encoded[encoded_size++] = BASE64[((first & 0x03) << 4) | (second >> 4)]; | 239 | 2 | encoded[encoded_size++] = BASE64[(second & 0x0F) << 2]; | 240 | 2 | encoded[encoded_size++] = '='; | 241 | 2 | } | 242 | 2 | } | 243 | 2 | flush(); | 244 | 2 | write_literal(out, "\""); | 245 | 2 | } |
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 |
246 | | |
247 | | template <typename Writer> |
248 | | class Printer { |
249 | | public: |
250 | 58.5k | 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 | 250 | 286 | 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 | 250 | 26 | 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 | 250 | 48 | 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 | 250 | 14 | 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 | 250 | 306 | 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 | 250 | 94 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEEC2ERS2_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 250 | 31.1k | 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 | 250 | 26.4k | 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 | 250 | 214 | Printer(Writer& out, const VariantJsonFormatOptions& options) : _out(out), _options(options) {} |
|
251 | | |
252 | 228k | void write(VariantRef value, uint32_t depth) { |
253 | 228k | require_json_depth(depth); |
254 | 228k | switch (value.basic_type()) { |
255 | 76.5k | case VariantBasicType::SHORT_STRING: |
256 | 76.5k | write_json_string(_out, value.get_string(), "string"); |
257 | 76.5k | return; |
258 | 95.4k | case VariantBasicType::PRIMITIVE: |
259 | 95.4k | write_primitive(value); |
260 | 95.4k | return; |
261 | 55.2k | case VariantBasicType::OBJECT: |
262 | 55.2k | write_object(value, depth); |
263 | 55.2k | return; |
264 | 806 | case VariantBasicType::ARRAY: |
265 | 806 | write_array(value, depth); |
266 | 806 | return; |
267 | 228k | } |
268 | 228k | } column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE5writeENS_10VariantRefEj Line | Count | Source | 252 | 518 | void write(VariantRef value, uint32_t depth) { | 253 | 518 | require_json_depth(depth); | 254 | 518 | switch (value.basic_type()) { | 255 | 0 | case VariantBasicType::SHORT_STRING: | 256 | 0 | write_json_string(_out, value.get_string(), "string"); | 257 | 0 | return; | 258 | 238 | case VariantBasicType::PRIMITIVE: | 259 | 238 | write_primitive(value); | 260 | 238 | return; | 261 | 242 | case VariantBasicType::OBJECT: | 262 | 242 | write_object(value, depth); | 263 | 242 | return; | 264 | 38 | case VariantBasicType::ARRAY: | 265 | 38 | write_array(value, depth); | 266 | 38 | return; | 267 | 518 | } | 268 | 518 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE5writeENS_10VariantRefEj Line | Count | Source | 252 | 44 | void write(VariantRef value, uint32_t depth) { | 253 | 44 | require_json_depth(depth); | 254 | 44 | switch (value.basic_type()) { | 255 | 2 | case VariantBasicType::SHORT_STRING: | 256 | 2 | write_json_string(_out, value.get_string(), "string"); | 257 | 2 | return; | 258 | 26 | case VariantBasicType::PRIMITIVE: | 259 | 26 | write_primitive(value); | 260 | 26 | return; | 261 | 12 | case VariantBasicType::OBJECT: | 262 | 12 | write_object(value, depth); | 263 | 12 | return; | 264 | 4 | case VariantBasicType::ARRAY: | 265 | 4 | write_array(value, depth); | 266 | 4 | return; | 267 | 44 | } | 268 | 44 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE5writeENS_10VariantRefEj Line | Count | Source | 252 | 176 | void write(VariantRef value, uint32_t depth) { | 253 | 176 | require_json_depth(depth); | 254 | 176 | switch (value.basic_type()) { | 255 | 16 | case VariantBasicType::SHORT_STRING: | 256 | 16 | write_json_string(_out, value.get_string(), "string"); | 257 | 16 | return; | 258 | 88 | case VariantBasicType::PRIMITIVE: | 259 | 88 | write_primitive(value); | 260 | 88 | return; | 261 | 64 | case VariantBasicType::OBJECT: | 262 | 64 | write_object(value, depth); | 263 | 64 | return; | 264 | 8 | case VariantBasicType::ARRAY: | 265 | 8 | write_array(value, depth); | 266 | 8 | return; | 267 | 176 | } | 268 | 176 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE5writeENS_10VariantRefEj Line | Count | Source | 252 | 24 | void write(VariantRef value, uint32_t depth) { | 253 | 24 | require_json_depth(depth); | 254 | 24 | switch (value.basic_type()) { | 255 | 6 | case VariantBasicType::SHORT_STRING: | 256 | 6 | write_json_string(_out, value.get_string(), "string"); | 257 | 6 | return; | 258 | 8 | case VariantBasicType::PRIMITIVE: | 259 | 8 | write_primitive(value); | 260 | 8 | return; | 261 | 10 | case VariantBasicType::OBJECT: | 262 | 10 | write_object(value, depth); | 263 | 10 | return; | 264 | 0 | case VariantBasicType::ARRAY: | 265 | 0 | write_array(value, depth); | 266 | 0 | return; | 267 | 24 | } | 268 | 24 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE5writeENS_10VariantRefEj Line | Count | Source | 252 | 504 | void write(VariantRef value, uint32_t depth) { | 253 | 504 | require_json_depth(depth); | 254 | 504 | switch (value.basic_type()) { | 255 | 26 | case VariantBasicType::SHORT_STRING: | 256 | 26 | write_json_string(_out, value.get_string(), "string"); | 257 | 26 | return; | 258 | 326 | case VariantBasicType::PRIMITIVE: | 259 | 326 | write_primitive(value); | 260 | 326 | return; | 261 | 112 | case VariantBasicType::OBJECT: | 262 | 112 | write_object(value, depth); | 263 | 112 | return; | 264 | 40 | case VariantBasicType::ARRAY: | 265 | 40 | write_array(value, depth); | 266 | 40 | return; | 267 | 504 | } | 268 | 504 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE5writeENS_10VariantRefEj Line | Count | Source | 252 | 696 | void write(VariantRef value, uint32_t depth) { | 253 | 696 | require_json_depth(depth); | 254 | 696 | switch (value.basic_type()) { | 255 | 12 | case VariantBasicType::SHORT_STRING: | 256 | 12 | write_json_string(_out, value.get_string(), "string"); | 257 | 12 | return; | 258 | 114 | case VariantBasicType::PRIMITIVE: | 259 | 114 | write_primitive(value); | 260 | 114 | return; | 261 | 42 | case VariantBasicType::OBJECT: | 262 | 42 | write_object(value, depth); | 263 | 42 | return; | 264 | 526 | case VariantBasicType::ARRAY: | 265 | 526 | write_array(value, depth); | 266 | 526 | return; | 267 | 696 | } | 268 | 696 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE5writeENS_10VariantRefEj Line | Count | Source | 252 | 122k | void write(VariantRef value, uint32_t depth) { | 253 | 122k | require_json_depth(depth); | 254 | 122k | switch (value.basic_type()) { | 255 | 40.6k | case VariantBasicType::SHORT_STRING: | 256 | 40.6k | write_json_string(_out, value.get_string(), "string"); | 257 | 40.6k | return; | 258 | 52.0k | case VariantBasicType::PRIMITIVE: | 259 | 52.0k | write_primitive(value); | 260 | 52.0k | return; | 261 | 29.7k | case VariantBasicType::OBJECT: | 262 | 29.7k | write_object(value, depth); | 263 | 29.7k | return; | 264 | 88 | case VariantBasicType::ARRAY: | 265 | 88 | write_array(value, depth); | 266 | 88 | return; | 267 | 122k | } | 268 | 122k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE5writeENS_10VariantRefEj Line | Count | Source | 252 | 103k | void write(VariantRef value, uint32_t depth) { | 253 | 103k | require_json_depth(depth); | 254 | 103k | switch (value.basic_type()) { | 255 | 35.8k | case VariantBasicType::SHORT_STRING: | 256 | 35.8k | write_json_string(_out, value.get_string(), "string"); | 257 | 35.8k | return; | 258 | 42.5k | case VariantBasicType::PRIMITIVE: | 259 | 42.5k | write_primitive(value); | 260 | 42.5k | return; | 261 | 24.9k | case VariantBasicType::OBJECT: | 262 | 24.9k | write_object(value, depth); | 263 | 24.9k | return; | 264 | 90 | case VariantBasicType::ARRAY: | 265 | 90 | write_array(value, depth); | 266 | 90 | return; | 267 | 103k | } | 268 | 103k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE5writeENS_10VariantRefEj Line | Count | Source | 252 | 190 | void write(VariantRef value, uint32_t depth) { | 253 | 190 | require_json_depth(depth); | 254 | 190 | switch (value.basic_type()) { | 255 | 56 | case VariantBasicType::SHORT_STRING: | 256 | 56 | write_json_string(_out, value.get_string(), "string"); | 257 | 56 | return; | 258 | 116 | case VariantBasicType::PRIMITIVE: | 259 | 116 | write_primitive(value); | 260 | 116 | return; | 261 | 6 | case VariantBasicType::OBJECT: | 262 | 6 | write_object(value, depth); | 263 | 6 | return; | 264 | 12 | case VariantBasicType::ARRAY: | 265 | 12 | write_array(value, depth); | 266 | 12 | return; | 267 | 190 | } | 268 | 190 | } |
|
269 | | |
270 | 5.00k | void write_plain_scalar(VariantRef value) { |
271 | 5.00k | require_json_depth(0); |
272 | 5.00k | if (value.basic_type() == VariantBasicType::SHORT_STRING) { |
273 | 54 | const StringRef string = value.get_string(); |
274 | 54 | require_valid_json_utf8(string, "string"); |
275 | 54 | _out.write(string.data, string.size); |
276 | 54 | return; |
277 | 54 | } |
278 | 4.95k | if (value.basic_type() != VariantBasicType::PRIMITIVE) { |
279 | 4.81k | write(value, 0); |
280 | 4.81k | return; |
281 | 4.81k | } |
282 | | |
283 | 136 | switch (value.primitive_id()) { |
284 | 0 | case VariantPrimitiveId::STRING: { |
285 | 0 | const StringRef string = value.get_string(); |
286 | 0 | require_valid_json_utf8(string, "string"); |
287 | 0 | _out.write(string.data, string.size); |
288 | 0 | return; |
289 | 0 | } |
290 | 16 | case VariantPrimitiveId::DATE: |
291 | 16 | write_scalar(_out, format_json_date(value.get_date())); |
292 | 16 | return; |
293 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: |
294 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, |
295 | 0 | _options.timezone)); |
296 | 0 | return; |
297 | 16 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: |
298 | 16 | write_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, false, |
299 | 16 | nullptr)); |
300 | 16 | return; |
301 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: |
302 | 0 | write_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); |
303 | 0 | return; |
304 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: |
305 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, |
306 | 0 | _options.timezone)); |
307 | 0 | return; |
308 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: |
309 | 0 | write_scalar(_out, |
310 | 0 | format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, false, nullptr)); |
311 | 0 | return; |
312 | 0 | case VariantPrimitiveId::UUID: |
313 | 0 | write_scalar(_out, format_json_uuid(value.get_uuid())); |
314 | 0 | return; |
315 | 104 | default: |
316 | 104 | write_primitive(value); |
317 | 104 | return; |
318 | 136 | } |
319 | 136 | } _ZN5doris12variant_json7PrinterINS_14BufferWritableEE18write_plain_scalarENS_10VariantRefE Line | Count | Source | 270 | 4.90k | void write_plain_scalar(VariantRef value) { | 271 | 4.90k | require_json_depth(0); | 272 | 4.90k | if (value.basic_type() == VariantBasicType::SHORT_STRING) { | 273 | 26 | const StringRef string = value.get_string(); | 274 | 26 | require_valid_json_utf8(string, "string"); | 275 | 26 | _out.write(string.data, string.size); | 276 | 26 | return; | 277 | 26 | } | 278 | 4.87k | if (value.basic_type() != VariantBasicType::PRIMITIVE) { | 279 | 4.80k | write(value, 0); | 280 | 4.80k | return; | 281 | 4.80k | } | 282 | | | 283 | 68 | switch (value.primitive_id()) { | 284 | 0 | case VariantPrimitiveId::STRING: { | 285 | 0 | const StringRef string = value.get_string(); | 286 | 0 | require_valid_json_utf8(string, "string"); | 287 | 0 | _out.write(string.data, string.size); | 288 | 0 | return; | 289 | 0 | } | 290 | 8 | case VariantPrimitiveId::DATE: | 291 | 8 | write_scalar(_out, format_json_date(value.get_date())); | 292 | 8 | return; | 293 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 294 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 295 | 0 | _options.timezone)); | 296 | 0 | return; | 297 | 8 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 298 | 8 | write_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, false, | 299 | 8 | nullptr)); | 300 | 8 | return; | 301 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 302 | 0 | write_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 303 | 0 | return; | 304 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 305 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 306 | 0 | _options.timezone)); | 307 | 0 | return; | 308 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 309 | 0 | write_scalar(_out, | 310 | 0 | format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, false, nullptr)); | 311 | 0 | return; | 312 | 0 | case VariantPrimitiveId::UUID: | 313 | 0 | write_scalar(_out, format_json_uuid(value.get_uuid())); | 314 | 0 | return; | 315 | 52 | default: | 316 | 52 | write_primitive(value); | 317 | 52 | return; | 318 | 68 | } | 319 | 68 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE18write_plain_scalarENS_10VariantRefE Line | Count | Source | 270 | 52 | void write_plain_scalar(VariantRef value) { | 271 | 52 | require_json_depth(0); | 272 | 52 | if (value.basic_type() == VariantBasicType::SHORT_STRING) { | 273 | 14 | const StringRef string = value.get_string(); | 274 | 14 | require_valid_json_utf8(string, "string"); | 275 | 14 | _out.write(string.data, string.size); | 276 | 14 | return; | 277 | 14 | } | 278 | 38 | if (value.basic_type() != VariantBasicType::PRIMITIVE) { | 279 | 4 | write(value, 0); | 280 | 4 | return; | 281 | 4 | } | 282 | | | 283 | 34 | switch (value.primitive_id()) { | 284 | 0 | case VariantPrimitiveId::STRING: { | 285 | 0 | const StringRef string = value.get_string(); | 286 | 0 | require_valid_json_utf8(string, "string"); | 287 | 0 | _out.write(string.data, string.size); | 288 | 0 | return; | 289 | 0 | } | 290 | 4 | case VariantPrimitiveId::DATE: | 291 | 4 | write_scalar(_out, format_json_date(value.get_date())); | 292 | 4 | return; | 293 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 294 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 295 | 0 | _options.timezone)); | 296 | 0 | return; | 297 | 4 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 298 | 4 | write_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, false, | 299 | 4 | nullptr)); | 300 | 4 | return; | 301 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 302 | 0 | write_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 303 | 0 | return; | 304 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 305 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 306 | 0 | _options.timezone)); | 307 | 0 | return; | 308 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 309 | 0 | write_scalar(_out, | 310 | 0 | format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, false, nullptr)); | 311 | 0 | return; | 312 | 0 | case VariantPrimitiveId::UUID: | 313 | 0 | write_scalar(_out, format_json_uuid(value.get_uuid())); | 314 | 0 | return; | 315 | 26 | default: | 316 | 26 | write_primitive(value); | 317 | 26 | return; | 318 | 34 | } | 319 | 34 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE18write_plain_scalarENS_10VariantRefE Line | Count | Source | 270 | 52 | void write_plain_scalar(VariantRef value) { | 271 | 52 | require_json_depth(0); | 272 | 52 | if (value.basic_type() == VariantBasicType::SHORT_STRING) { | 273 | 14 | const StringRef string = value.get_string(); | 274 | 14 | require_valid_json_utf8(string, "string"); | 275 | 14 | _out.write(string.data, string.size); | 276 | 14 | return; | 277 | 14 | } | 278 | 38 | if (value.basic_type() != VariantBasicType::PRIMITIVE) { | 279 | 4 | write(value, 0); | 280 | 4 | return; | 281 | 4 | } | 282 | | | 283 | 34 | switch (value.primitive_id()) { | 284 | 0 | case VariantPrimitiveId::STRING: { | 285 | 0 | const StringRef string = value.get_string(); | 286 | 0 | require_valid_json_utf8(string, "string"); | 287 | 0 | _out.write(string.data, string.size); | 288 | 0 | return; | 289 | 0 | } | 290 | 4 | case VariantPrimitiveId::DATE: | 291 | 4 | write_scalar(_out, format_json_date(value.get_date())); | 292 | 4 | return; | 293 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 294 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 295 | 0 | _options.timezone)); | 296 | 0 | return; | 297 | 4 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 298 | 4 | write_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, false, | 299 | 4 | nullptr)); | 300 | 4 | return; | 301 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 302 | 0 | write_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 303 | 0 | return; | 304 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 305 | 0 | write_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 306 | 0 | _options.timezone)); | 307 | 0 | return; | 308 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 309 | 0 | write_scalar(_out, | 310 | 0 | format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, false, nullptr)); | 311 | 0 | return; | 312 | 0 | case VariantPrimitiveId::UUID: | 313 | 0 | write_scalar(_out, format_json_uuid(value.get_uuid())); | 314 | 0 | return; | 315 | 26 | default: | 316 | 26 | write_primitive(value); | 317 | 26 | return; | 318 | 34 | } | 319 | 34 | } |
|
320 | | |
321 | | private: |
322 | 95.5k | void write_primitive(VariantRef value) { |
323 | 95.5k | const VariantPrimitiveId id = value.primitive_id(); |
324 | 95.5k | switch (id) { |
325 | 264 | case VariantPrimitiveId::NULL_VALUE: |
326 | 264 | write_literal(_out, "null"); |
327 | 264 | return; |
328 | 94 | case VariantPrimitiveId::TRUE_VALUE: |
329 | 94 | write_literal(_out, "true"); |
330 | 94 | return; |
331 | 6 | case VariantPrimitiveId::FALSE_VALUE: |
332 | 6 | write_literal(_out, "false"); |
333 | 6 | return; |
334 | 87.5k | case VariantPrimitiveId::INT8: |
335 | 94.6k | case VariantPrimitiveId::INT16: |
336 | 94.6k | case VariantPrimitiveId::INT32: |
337 | 94.6k | case VariantPrimitiveId::INT64: |
338 | 94.6k | write_scalar(_out, format_json_int(value.get_int())); |
339 | 94.6k | return; |
340 | 256 | case VariantPrimitiveId::DOUBLE: { |
341 | 256 | const double number = value.get_double(); |
342 | 256 | if (!std::isfinite(number)) { |
343 | 146 | write_non_finite(number); |
344 | 146 | return; |
345 | 146 | } |
346 | 110 | write_scalar(_out, format_json_double(number)); |
347 | 110 | return; |
348 | 256 | } |
349 | 6 | case VariantPrimitiveId::DECIMAL4: |
350 | 26 | case VariantPrimitiveId::DECIMAL8: |
351 | 50 | case VariantPrimitiveId::DECIMAL16: |
352 | 50 | write_scalar(_out, format_json_decimal(value.get_decimal())); |
353 | 50 | return; |
354 | 122 | case VariantPrimitiveId::DATE: |
355 | 122 | write_quoted_scalar(_out, format_json_date(value.get_date())); |
356 | 122 | return; |
357 | 10 | case VariantPrimitiveId::TIMESTAMP_MICROS: |
358 | 10 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, |
359 | 10 | _options.timezone)); |
360 | 10 | return; |
361 | 52 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: |
362 | 52 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, |
363 | 52 | false, nullptr)); |
364 | 52 | return; |
365 | 12 | case VariantPrimitiveId::FLOAT: { |
366 | 12 | const float number = value.get_float(); |
367 | 12 | if (!std::isfinite(number)) { |
368 | 4 | write_non_finite(number); |
369 | 4 | return; |
370 | 4 | } |
371 | 8 | write_scalar(_out, format_json_float(number)); |
372 | 8 | return; |
373 | 12 | } |
374 | 4 | case VariantPrimitiveId::BINARY: |
375 | 4 | write_json_binary(_out, value.get_binary()); |
376 | 4 | return; |
377 | 6 | case VariantPrimitiveId::STRING: |
378 | 6 | write_json_string(_out, value.get_string(), "string"); |
379 | 6 | return; |
380 | 4 | case VariantPrimitiveId::TIME_NTZ_MICROS: |
381 | 4 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); |
382 | 4 | return; |
383 | 6 | case VariantPrimitiveId::TIMESTAMP_NANOS: |
384 | 6 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, |
385 | 6 | _options.timezone)); |
386 | 6 | return; |
387 | 8 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: |
388 | 8 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, |
389 | 8 | false, nullptr)); |
390 | 8 | return; |
391 | 4 | case VariantPrimitiveId::UUID: |
392 | 4 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); |
393 | 4 | return; |
394 | 95.5k | } |
395 | 0 | throw_unsupported_json_primitive(id); |
396 | 0 | } column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 238 | void write_primitive(VariantRef value) { | 323 | 238 | const VariantPrimitiveId id = value.primitive_id(); | 324 | 238 | switch (id) { | 325 | 0 | case VariantPrimitiveId::NULL_VALUE: | 326 | 0 | write_literal(_out, "null"); | 327 | 0 | return; | 328 | 0 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 0 | write_literal(_out, "true"); | 330 | 0 | return; | 331 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 0 | write_literal(_out, "false"); | 333 | 0 | return; | 334 | 238 | case VariantPrimitiveId::INT8: | 335 | 238 | case VariantPrimitiveId::INT16: | 336 | 238 | case VariantPrimitiveId::INT32: | 337 | 238 | case VariantPrimitiveId::INT64: | 338 | 238 | write_scalar(_out, format_json_int(value.get_int())); | 339 | 238 | return; | 340 | 0 | case VariantPrimitiveId::DOUBLE: { | 341 | 0 | const double number = value.get_double(); | 342 | 0 | if (!std::isfinite(number)) { | 343 | 0 | write_non_finite(number); | 344 | 0 | return; | 345 | 0 | } | 346 | 0 | write_scalar(_out, format_json_double(number)); | 347 | 0 | return; | 348 | 0 | } | 349 | 0 | case VariantPrimitiveId::DECIMAL4: | 350 | 0 | case VariantPrimitiveId::DECIMAL8: | 351 | 0 | case VariantPrimitiveId::DECIMAL16: | 352 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 0 | return; | 354 | 0 | case VariantPrimitiveId::DATE: | 355 | 0 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 0 | return; | 357 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 0 | _options.timezone)); | 360 | 0 | return; | 361 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 0 | false, nullptr)); | 364 | 0 | return; | 365 | 0 | case VariantPrimitiveId::FLOAT: { | 366 | 0 | const float number = value.get_float(); | 367 | 0 | if (!std::isfinite(number)) { | 368 | 0 | write_non_finite(number); | 369 | 0 | return; | 370 | 0 | } | 371 | 0 | write_scalar(_out, format_json_float(number)); | 372 | 0 | return; | 373 | 0 | } | 374 | 0 | case VariantPrimitiveId::BINARY: | 375 | 0 | write_json_binary(_out, value.get_binary()); | 376 | 0 | return; | 377 | 0 | case VariantPrimitiveId::STRING: | 378 | 0 | write_json_string(_out, value.get_string(), "string"); | 379 | 0 | return; | 380 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 0 | return; | 383 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 0 | _options.timezone)); | 386 | 0 | return; | 387 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 0 | false, nullptr)); | 390 | 0 | return; | 391 | 0 | case VariantPrimitiveId::UUID: | 392 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 0 | return; | 394 | 238 | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 26 | void write_primitive(VariantRef value) { | 323 | 26 | const VariantPrimitiveId id = value.primitive_id(); | 324 | 26 | switch (id) { | 325 | 6 | case VariantPrimitiveId::NULL_VALUE: | 326 | 6 | write_literal(_out, "null"); | 327 | 6 | return; | 328 | 2 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 2 | write_literal(_out, "true"); | 330 | 2 | return; | 331 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 0 | write_literal(_out, "false"); | 333 | 0 | return; | 334 | 18 | case VariantPrimitiveId::INT8: | 335 | 18 | case VariantPrimitiveId::INT16: | 336 | 18 | case VariantPrimitiveId::INT32: | 337 | 18 | case VariantPrimitiveId::INT64: | 338 | 18 | write_scalar(_out, format_json_int(value.get_int())); | 339 | 18 | return; | 340 | 0 | case VariantPrimitiveId::DOUBLE: { | 341 | 0 | const double number = value.get_double(); | 342 | 0 | if (!std::isfinite(number)) { | 343 | 0 | write_non_finite(number); | 344 | 0 | return; | 345 | 0 | } | 346 | 0 | write_scalar(_out, format_json_double(number)); | 347 | 0 | return; | 348 | 0 | } | 349 | 0 | case VariantPrimitiveId::DECIMAL4: | 350 | 0 | case VariantPrimitiveId::DECIMAL8: | 351 | 0 | case VariantPrimitiveId::DECIMAL16: | 352 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 0 | return; | 354 | 0 | case VariantPrimitiveId::DATE: | 355 | 0 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 0 | return; | 357 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 0 | _options.timezone)); | 360 | 0 | return; | 361 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 0 | false, nullptr)); | 364 | 0 | return; | 365 | 0 | case VariantPrimitiveId::FLOAT: { | 366 | 0 | const float number = value.get_float(); | 367 | 0 | if (!std::isfinite(number)) { | 368 | 0 | write_non_finite(number); | 369 | 0 | return; | 370 | 0 | } | 371 | 0 | write_scalar(_out, format_json_float(number)); | 372 | 0 | return; | 373 | 0 | } | 374 | 0 | case VariantPrimitiveId::BINARY: | 375 | 0 | write_json_binary(_out, value.get_binary()); | 376 | 0 | return; | 377 | 0 | case VariantPrimitiveId::STRING: | 378 | 0 | write_json_string(_out, value.get_string(), "string"); | 379 | 0 | return; | 380 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 0 | return; | 383 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 0 | _options.timezone)); | 386 | 0 | return; | 387 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 0 | false, nullptr)); | 390 | 0 | return; | 391 | 0 | case VariantPrimitiveId::UUID: | 392 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 0 | return; | 394 | 26 | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 88 | void write_primitive(VariantRef value) { | 323 | 88 | const VariantPrimitiveId id = value.primitive_id(); | 324 | 88 | switch (id) { | 325 | 0 | case VariantPrimitiveId::NULL_VALUE: | 326 | 0 | write_literal(_out, "null"); | 327 | 0 | return; | 328 | 30 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 30 | write_literal(_out, "true"); | 330 | 30 | return; | 331 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 0 | write_literal(_out, "false"); | 333 | 0 | return; | 334 | 50 | case VariantPrimitiveId::INT8: | 335 | 50 | case VariantPrimitiveId::INT16: | 336 | 50 | case VariantPrimitiveId::INT32: | 337 | 50 | case VariantPrimitiveId::INT64: | 338 | 50 | write_scalar(_out, format_json_int(value.get_int())); | 339 | 50 | return; | 340 | 8 | case VariantPrimitiveId::DOUBLE: { | 341 | 8 | const double number = value.get_double(); | 342 | 8 | if (!std::isfinite(number)) { | 343 | 0 | write_non_finite(number); | 344 | 0 | return; | 345 | 0 | } | 346 | 8 | write_scalar(_out, format_json_double(number)); | 347 | 8 | return; | 348 | 8 | } | 349 | 0 | case VariantPrimitiveId::DECIMAL4: | 350 | 0 | case VariantPrimitiveId::DECIMAL8: | 351 | 0 | case VariantPrimitiveId::DECIMAL16: | 352 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 0 | return; | 354 | 0 | case VariantPrimitiveId::DATE: | 355 | 0 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 0 | return; | 357 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 0 | _options.timezone)); | 360 | 0 | return; | 361 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 0 | false, nullptr)); | 364 | 0 | return; | 365 | 0 | case VariantPrimitiveId::FLOAT: { | 366 | 0 | const float number = value.get_float(); | 367 | 0 | if (!std::isfinite(number)) { | 368 | 0 | write_non_finite(number); | 369 | 0 | return; | 370 | 0 | } | 371 | 0 | write_scalar(_out, format_json_float(number)); | 372 | 0 | return; | 373 | 0 | } | 374 | 0 | case VariantPrimitiveId::BINARY: | 375 | 0 | write_json_binary(_out, value.get_binary()); | 376 | 0 | return; | 377 | 0 | case VariantPrimitiveId::STRING: | 378 | 0 | write_json_string(_out, value.get_string(), "string"); | 379 | 0 | return; | 380 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 0 | return; | 383 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 0 | _options.timezone)); | 386 | 0 | return; | 387 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 0 | false, nullptr)); | 390 | 0 | return; | 391 | 0 | case VariantPrimitiveId::UUID: | 392 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 0 | return; | 394 | 88 | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 8 | void write_primitive(VariantRef value) { | 323 | 8 | const VariantPrimitiveId id = value.primitive_id(); | 324 | 8 | switch (id) { | 325 | 4 | case VariantPrimitiveId::NULL_VALUE: | 326 | 4 | write_literal(_out, "null"); | 327 | 4 | return; | 328 | 0 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 0 | write_literal(_out, "true"); | 330 | 0 | return; | 331 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 0 | write_literal(_out, "false"); | 333 | 0 | return; | 334 | 4 | case VariantPrimitiveId::INT8: | 335 | 4 | case VariantPrimitiveId::INT16: | 336 | 4 | case VariantPrimitiveId::INT32: | 337 | 4 | case VariantPrimitiveId::INT64: | 338 | 4 | write_scalar(_out, format_json_int(value.get_int())); | 339 | 4 | return; | 340 | 0 | case VariantPrimitiveId::DOUBLE: { | 341 | 0 | const double number = value.get_double(); | 342 | 0 | if (!std::isfinite(number)) { | 343 | 0 | write_non_finite(number); | 344 | 0 | return; | 345 | 0 | } | 346 | 0 | write_scalar(_out, format_json_double(number)); | 347 | 0 | return; | 348 | 0 | } | 349 | 0 | case VariantPrimitiveId::DECIMAL4: | 350 | 0 | case VariantPrimitiveId::DECIMAL8: | 351 | 0 | case VariantPrimitiveId::DECIMAL16: | 352 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 0 | return; | 354 | 0 | case VariantPrimitiveId::DATE: | 355 | 0 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 0 | return; | 357 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 0 | _options.timezone)); | 360 | 0 | return; | 361 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 0 | false, nullptr)); | 364 | 0 | return; | 365 | 0 | case VariantPrimitiveId::FLOAT: { | 366 | 0 | const float number = value.get_float(); | 367 | 0 | if (!std::isfinite(number)) { | 368 | 0 | write_non_finite(number); | 369 | 0 | return; | 370 | 0 | } | 371 | 0 | write_scalar(_out, format_json_float(number)); | 372 | 0 | return; | 373 | 0 | } | 374 | 0 | case VariantPrimitiveId::BINARY: | 375 | 0 | write_json_binary(_out, value.get_binary()); | 376 | 0 | return; | 377 | 0 | case VariantPrimitiveId::STRING: | 378 | 0 | write_json_string(_out, value.get_string(), "string"); | 379 | 0 | return; | 380 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 0 | return; | 383 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 0 | _options.timezone)); | 386 | 0 | return; | 387 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 0 | false, nullptr)); | 390 | 0 | return; | 391 | 0 | case VariantPrimitiveId::UUID: | 392 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 0 | return; | 394 | 8 | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 326 | void write_primitive(VariantRef value) { | 323 | 326 | const VariantPrimitiveId id = value.primitive_id(); | 324 | 326 | switch (id) { | 325 | 92 | case VariantPrimitiveId::NULL_VALUE: | 326 | 92 | write_literal(_out, "null"); | 327 | 92 | return; | 328 | 4 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 4 | write_literal(_out, "true"); | 330 | 4 | return; | 331 | 2 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 2 | write_literal(_out, "false"); | 333 | 2 | return; | 334 | 62 | case VariantPrimitiveId::INT8: | 335 | 64 | case VariantPrimitiveId::INT16: | 336 | 68 | case VariantPrimitiveId::INT32: | 337 | 72 | case VariantPrimitiveId::INT64: | 338 | 72 | write_scalar(_out, format_json_int(value.get_int())); | 339 | 72 | return; | 340 | 4 | case VariantPrimitiveId::DOUBLE: { | 341 | 4 | const double number = value.get_double(); | 342 | 4 | if (!std::isfinite(number)) { | 343 | 0 | write_non_finite(number); | 344 | 0 | return; | 345 | 0 | } | 346 | 4 | write_scalar(_out, format_json_double(number)); | 347 | 4 | return; | 348 | 4 | } | 349 | 4 | case VariantPrimitiveId::DECIMAL4: | 350 | 22 | case VariantPrimitiveId::DECIMAL8: | 351 | 42 | case VariantPrimitiveId::DECIMAL16: | 352 | 42 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 42 | return; | 354 | 80 | case VariantPrimitiveId::DATE: | 355 | 80 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 80 | return; | 357 | 4 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 4 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 4 | _options.timezone)); | 360 | 4 | return; | 361 | 16 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 16 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 16 | false, nullptr)); | 364 | 16 | return; | 365 | 6 | case VariantPrimitiveId::FLOAT: { | 366 | 6 | const float number = value.get_float(); | 367 | 6 | if (!std::isfinite(number)) { | 368 | 0 | write_non_finite(number); | 369 | 0 | return; | 370 | 0 | } | 371 | 6 | write_scalar(_out, format_json_float(number)); | 372 | 6 | return; | 373 | 6 | } | 374 | 0 | case VariantPrimitiveId::BINARY: | 375 | 0 | write_json_binary(_out, value.get_binary()); | 376 | 0 | return; | 377 | 0 | case VariantPrimitiveId::STRING: | 378 | 0 | write_json_string(_out, value.get_string(), "string"); | 379 | 0 | return; | 380 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 0 | return; | 383 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 0 | _options.timezone)); | 386 | 0 | return; | 387 | 4 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 4 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 4 | false, nullptr)); | 390 | 4 | return; | 391 | 0 | case VariantPrimitiveId::UUID: | 392 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 0 | return; | 394 | 326 | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 114 | void write_primitive(VariantRef value) { | 323 | 114 | const VariantPrimitiveId id = value.primitive_id(); | 324 | 114 | switch (id) { | 325 | 10 | case VariantPrimitiveId::NULL_VALUE: | 326 | 10 | write_literal(_out, "null"); | 327 | 10 | return; | 328 | 8 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 8 | write_literal(_out, "true"); | 330 | 8 | return; | 331 | 4 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 4 | write_literal(_out, "false"); | 333 | 4 | return; | 334 | 38 | case VariantPrimitiveId::INT8: | 335 | 40 | case VariantPrimitiveId::INT16: | 336 | 42 | case VariantPrimitiveId::INT32: | 337 | 44 | case VariantPrimitiveId::INT64: | 338 | 44 | write_scalar(_out, format_json_int(value.get_int())); | 339 | 44 | return; | 340 | 4 | case VariantPrimitiveId::DOUBLE: { | 341 | 4 | const double number = value.get_double(); | 342 | 4 | if (!std::isfinite(number)) { | 343 | 2 | write_non_finite(number); | 344 | 2 | return; | 345 | 2 | } | 346 | 2 | write_scalar(_out, format_json_double(number)); | 347 | 2 | return; | 348 | 4 | } | 349 | 2 | case VariantPrimitiveId::DECIMAL4: | 350 | 4 | case VariantPrimitiveId::DECIMAL8: | 351 | 8 | case VariantPrimitiveId::DECIMAL16: | 352 | 8 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 8 | return; | 354 | 2 | case VariantPrimitiveId::DATE: | 355 | 2 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 2 | return; | 357 | 6 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 6 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 6 | _options.timezone)); | 360 | 6 | return; | 361 | 4 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 4 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 4 | false, nullptr)); | 364 | 4 | return; | 365 | 6 | case VariantPrimitiveId::FLOAT: { | 366 | 6 | const float number = value.get_float(); | 367 | 6 | if (!std::isfinite(number)) { | 368 | 4 | write_non_finite(number); | 369 | 4 | return; | 370 | 4 | } | 371 | 2 | write_scalar(_out, format_json_float(number)); | 372 | 2 | return; | 373 | 6 | } | 374 | 2 | case VariantPrimitiveId::BINARY: | 375 | 2 | write_json_binary(_out, value.get_binary()); | 376 | 2 | return; | 377 | 2 | case VariantPrimitiveId::STRING: | 378 | 2 | write_json_string(_out, value.get_string(), "string"); | 379 | 2 | return; | 380 | 2 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 2 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 2 | return; | 383 | 6 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 6 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 6 | _options.timezone)); | 386 | 6 | return; | 387 | 4 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 4 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 4 | false, nullptr)); | 390 | 4 | return; | 391 | 2 | case VariantPrimitiveId::UUID: | 392 | 2 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 2 | return; | 394 | 114 | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 52.0k | void write_primitive(VariantRef value) { | 323 | 52.0k | const VariantPrimitiveId id = value.primitive_id(); | 324 | 52.0k | switch (id) { | 325 | 56 | case VariantPrimitiveId::NULL_VALUE: | 326 | 56 | write_literal(_out, "null"); | 327 | 56 | return; | 328 | 26 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 26 | write_literal(_out, "true"); | 330 | 26 | return; | 331 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 0 | write_literal(_out, "false"); | 333 | 0 | return; | 334 | 45.3k | case VariantPrimitiveId::INT8: | 335 | 51.9k | case VariantPrimitiveId::INT16: | 336 | 51.9k | case VariantPrimitiveId::INT32: | 337 | 51.9k | case VariantPrimitiveId::INT64: | 338 | 51.9k | write_scalar(_out, format_json_int(value.get_int())); | 339 | 51.9k | return; | 340 | 60 | case VariantPrimitiveId::DOUBLE: { | 341 | 60 | const double number = value.get_double(); | 342 | 60 | if (!std::isfinite(number)) { | 343 | 36 | write_non_finite(number); | 344 | 36 | return; | 345 | 36 | } | 346 | 24 | write_scalar(_out, format_json_double(number)); | 347 | 24 | return; | 348 | 60 | } | 349 | 0 | case VariantPrimitiveId::DECIMAL4: | 350 | 0 | case VariantPrimitiveId::DECIMAL8: | 351 | 0 | case VariantPrimitiveId::DECIMAL16: | 352 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 0 | return; | 354 | 4 | case VariantPrimitiveId::DATE: | 355 | 4 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 4 | return; | 357 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 0 | _options.timezone)); | 360 | 0 | return; | 361 | 4 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 4 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 4 | false, nullptr)); | 364 | 4 | return; | 365 | 0 | case VariantPrimitiveId::FLOAT: { | 366 | 0 | const float number = value.get_float(); | 367 | 0 | if (!std::isfinite(number)) { | 368 | 0 | write_non_finite(number); | 369 | 0 | return; | 370 | 0 | } | 371 | 0 | write_scalar(_out, format_json_float(number)); | 372 | 0 | return; | 373 | 0 | } | 374 | 2 | case VariantPrimitiveId::BINARY: | 375 | 2 | write_json_binary(_out, value.get_binary()); | 376 | 2 | return; | 377 | 2 | case VariantPrimitiveId::STRING: | 378 | 2 | write_json_string(_out, value.get_string(), "string"); | 379 | 2 | return; | 380 | 2 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 2 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 2 | return; | 383 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 0 | _options.timezone)); | 386 | 0 | return; | 387 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 0 | false, nullptr)); | 390 | 0 | return; | 391 | 2 | case VariantPrimitiveId::UUID: | 392 | 2 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 2 | return; | 394 | 52.0k | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 42.5k | void write_primitive(VariantRef value) { | 323 | 42.5k | const VariantPrimitiveId id = value.primitive_id(); | 324 | 42.5k | switch (id) { | 325 | 68 | case VariantPrimitiveId::NULL_VALUE: | 326 | 68 | write_literal(_out, "null"); | 327 | 68 | return; | 328 | 24 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 24 | write_literal(_out, "true"); | 330 | 24 | return; | 331 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 0 | write_literal(_out, "false"); | 333 | 0 | return; | 334 | 41.8k | case VariantPrimitiveId::INT8: | 335 | 42.3k | case VariantPrimitiveId::INT16: | 336 | 42.3k | case VariantPrimitiveId::INT32: | 337 | 42.3k | case VariantPrimitiveId::INT64: | 338 | 42.3k | write_scalar(_out, format_json_int(value.get_int())); | 339 | 42.3k | return; | 340 | 100 | case VariantPrimitiveId::DOUBLE: { | 341 | 100 | const double number = value.get_double(); | 342 | 100 | if (!std::isfinite(number)) { | 343 | 60 | write_non_finite(number); | 344 | 60 | return; | 345 | 60 | } | 346 | 40 | write_scalar(_out, format_json_double(number)); | 347 | 40 | return; | 348 | 100 | } | 349 | 0 | case VariantPrimitiveId::DECIMAL4: | 350 | 0 | case VariantPrimitiveId::DECIMAL8: | 351 | 0 | case VariantPrimitiveId::DECIMAL16: | 352 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 0 | return; | 354 | 20 | case VariantPrimitiveId::DATE: | 355 | 20 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 20 | return; | 357 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 0 | _options.timezone)); | 360 | 0 | return; | 361 | 16 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 16 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 16 | false, nullptr)); | 364 | 16 | return; | 365 | 0 | case VariantPrimitiveId::FLOAT: { | 366 | 0 | const float number = value.get_float(); | 367 | 0 | if (!std::isfinite(number)) { | 368 | 0 | write_non_finite(number); | 369 | 0 | return; | 370 | 0 | } | 371 | 0 | write_scalar(_out, format_json_float(number)); | 372 | 0 | return; | 373 | 0 | } | 374 | 0 | case VariantPrimitiveId::BINARY: | 375 | 0 | write_json_binary(_out, value.get_binary()); | 376 | 0 | return; | 377 | 2 | case VariantPrimitiveId::STRING: | 378 | 2 | write_json_string(_out, value.get_string(), "string"); | 379 | 2 | return; | 380 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 0 | return; | 383 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 0 | _options.timezone)); | 386 | 0 | return; | 387 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 0 | false, nullptr)); | 390 | 0 | return; | 391 | 0 | case VariantPrimitiveId::UUID: | 392 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 0 | return; | 394 | 42.5k | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE15write_primitiveENS_10VariantRefE Line | Count | Source | 322 | 142 | void write_primitive(VariantRef value) { | 323 | 142 | const VariantPrimitiveId id = value.primitive_id(); | 324 | 142 | switch (id) { | 325 | 28 | case VariantPrimitiveId::NULL_VALUE: | 326 | 28 | write_literal(_out, "null"); | 327 | 28 | return; | 328 | 0 | case VariantPrimitiveId::TRUE_VALUE: | 329 | 0 | write_literal(_out, "true"); | 330 | 0 | return; | 331 | 0 | case VariantPrimitiveId::FALSE_VALUE: | 332 | 0 | write_literal(_out, "false"); | 333 | 0 | return; | 334 | 6 | case VariantPrimitiveId::INT8: | 335 | 6 | case VariantPrimitiveId::INT16: | 336 | 6 | case VariantPrimitiveId::INT32: | 337 | 6 | case VariantPrimitiveId::INT64: | 338 | 6 | write_scalar(_out, format_json_int(value.get_int())); | 339 | 6 | return; | 340 | 80 | case VariantPrimitiveId::DOUBLE: { | 341 | 80 | const double number = value.get_double(); | 342 | 80 | if (!std::isfinite(number)) { | 343 | 48 | write_non_finite(number); | 344 | 48 | return; | 345 | 48 | } | 346 | 32 | write_scalar(_out, format_json_double(number)); | 347 | 32 | return; | 348 | 80 | } | 349 | 0 | case VariantPrimitiveId::DECIMAL4: | 350 | 0 | case VariantPrimitiveId::DECIMAL8: | 351 | 0 | case VariantPrimitiveId::DECIMAL16: | 352 | 0 | write_scalar(_out, format_json_decimal(value.get_decimal())); | 353 | 0 | return; | 354 | 16 | case VariantPrimitiveId::DATE: | 355 | 16 | write_quoted_scalar(_out, format_json_date(value.get_date())); | 356 | 16 | return; | 357 | 0 | case VariantPrimitiveId::TIMESTAMP_MICROS: | 358 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_micros(), 6, true, | 359 | 0 | _options.timezone)); | 360 | 0 | return; | 361 | 12 | case VariantPrimitiveId::TIMESTAMP_NTZ_MICROS: | 362 | 12 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_micros(), 6, | 363 | 12 | false, nullptr)); | 364 | 12 | return; | 365 | 0 | case VariantPrimitiveId::FLOAT: { | 366 | 0 | const float number = value.get_float(); | 367 | 0 | if (!std::isfinite(number)) { | 368 | 0 | write_non_finite(number); | 369 | 0 | return; | 370 | 0 | } | 371 | 0 | write_scalar(_out, format_json_float(number)); | 372 | 0 | return; | 373 | 0 | } | 374 | 0 | case VariantPrimitiveId::BINARY: | 375 | 0 | write_json_binary(_out, value.get_binary()); | 376 | 0 | return; | 377 | 0 | case VariantPrimitiveId::STRING: | 378 | 0 | write_json_string(_out, value.get_string(), "string"); | 379 | 0 | return; | 380 | 0 | case VariantPrimitiveId::TIME_NTZ_MICROS: | 381 | 0 | write_quoted_scalar(_out, format_json_time_micros(value.get_time_ntz_micros())); | 382 | 0 | return; | 383 | 0 | case VariantPrimitiveId::TIMESTAMP_NANOS: | 384 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_nanos(), 9, true, | 385 | 0 | _options.timezone)); | 386 | 0 | return; | 387 | 0 | case VariantPrimitiveId::TIMESTAMP_NTZ_NANOS: | 388 | 0 | write_quoted_scalar(_out, format_json_timestamp(value.get_timestamp_ntz_nanos(), 9, | 389 | 0 | false, nullptr)); | 390 | 0 | return; | 391 | 0 | case VariantPrimitiveId::UUID: | 392 | 0 | write_quoted_scalar(_out, format_json_uuid(value.get_uuid())); | 393 | 0 | return; | 394 | 142 | } | 395 | 0 | throw_unsupported_json_primitive(id); | 396 | 0 | } |
|
397 | | |
398 | | template <typename Number> |
399 | 150 | void write_non_finite(Number value) { |
400 | 150 | if (std::isnan(value)) { |
401 | 50 | write_literal(_out, "\"NaN\""); |
402 | 100 | } else if (value > 0) { |
403 | 50 | write_literal(_out, "\"Infinity\""); |
404 | 50 | } else { |
405 | 50 | write_literal(_out, "\"-Infinity\""); |
406 | 50 | } |
407 | 150 | } 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 | 399 | 2 | void write_non_finite(Number value) { | 400 | 2 | if (std::isnan(value)) { | 401 | 0 | write_literal(_out, "\"NaN\""); | 402 | 2 | } else if (value > 0) { | 403 | 0 | write_literal(_out, "\"Infinity\""); | 404 | 2 | } else { | 405 | 2 | write_literal(_out, "\"-Infinity\""); | 406 | 2 | } | 407 | 2 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE16write_non_finiteIfEEvT_ Line | Count | Source | 399 | 4 | void write_non_finite(Number value) { | 400 | 4 | if (std::isnan(value)) { | 401 | 2 | write_literal(_out, "\"NaN\""); | 402 | 2 | } else if (value > 0) { | 403 | 2 | write_literal(_out, "\"Infinity\""); | 404 | 2 | } else { | 405 | 0 | write_literal(_out, "\"-Infinity\""); | 406 | 0 | } | 407 | 4 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE16write_non_finiteIdEEvT_ Line | Count | Source | 399 | 36 | void write_non_finite(Number value) { | 400 | 36 | if (std::isnan(value)) { | 401 | 12 | write_literal(_out, "\"NaN\""); | 402 | 24 | } else if (value > 0) { | 403 | 12 | write_literal(_out, "\"Infinity\""); | 404 | 12 | } else { | 405 | 12 | write_literal(_out, "\"-Infinity\""); | 406 | 12 | } | 407 | 36 | } |
Unexecuted instantiation: _ZN5doris12variant_json7PrinterINS_14BufferWritableEE16write_non_finiteIfEEvT_ unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE16write_non_finiteIdEEvT_ Line | Count | Source | 399 | 60 | void write_non_finite(Number value) { | 400 | 60 | if (std::isnan(value)) { | 401 | 20 | write_literal(_out, "\"NaN\""); | 402 | 40 | } else if (value > 0) { | 403 | 20 | write_literal(_out, "\"Infinity\""); | 404 | 20 | } else { | 405 | 20 | write_literal(_out, "\"-Infinity\""); | 406 | 20 | } | 407 | 60 | } |
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 | 399 | 48 | void write_non_finite(Number value) { | 400 | 48 | if (std::isnan(value)) { | 401 | 16 | write_literal(_out, "\"NaN\""); | 402 | 32 | } else if (value > 0) { | 403 | 16 | write_literal(_out, "\"Infinity\""); | 404 | 16 | } else { | 405 | 16 | write_literal(_out, "\"-Infinity\""); | 406 | 16 | } | 407 | 48 | } |
Unexecuted instantiation: unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE16write_non_finiteIfEEvT_ |
408 | | |
409 | 55.2k | void write_object(VariantRef value, uint32_t depth) { |
410 | 55.2k | write_literal(_out, "{"); |
411 | 55.2k | const uint32_t count = value.num_elements(); |
412 | 55.2k | StringRef previous_key; |
413 | 224k | for (uint32_t index = 0; index < count; ++index) { |
414 | 168k | if (index != 0) { |
415 | 114k | write_literal(_out, ","); |
416 | 114k | } |
417 | 168k | uint32_t field_id = 0; |
418 | 168k | VariantRef child = value.object_value_at(index, &field_id); |
419 | 168k | const StringRef key = value.metadata.key_at(field_id); |
420 | 168k | require_json_object_key(key, previous_key, index); |
421 | 168k | write_escaped_json_string(_out, key); |
422 | 168k | write_literal(_out, ":"); |
423 | 168k | write(child, depth + 1); |
424 | 168k | previous_key = key; |
425 | 168k | } |
426 | 55.2k | write_literal(_out, "}"); |
427 | 55.2k | } column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 242 | void write_object(VariantRef value, uint32_t depth) { | 410 | 242 | write_literal(_out, "{"); | 411 | 242 | const uint32_t count = value.num_elements(); | 412 | 242 | StringRef previous_key; | 413 | 436 | for (uint32_t index = 0; index < count; ++index) { | 414 | 194 | if (index != 0) { | 415 | 0 | write_literal(_out, ","); | 416 | 0 | } | 417 | 194 | uint32_t field_id = 0; | 418 | 194 | VariantRef child = value.object_value_at(index, &field_id); | 419 | 194 | const StringRef key = value.metadata.key_at(field_id); | 420 | 194 | require_json_object_key(key, previous_key, index); | 421 | 194 | write_escaped_json_string(_out, key); | 422 | 194 | write_literal(_out, ":"); | 423 | 194 | write(child, depth + 1); | 424 | 194 | previous_key = key; | 425 | 194 | } | 426 | 242 | write_literal(_out, "}"); | 427 | 242 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 12 | void write_object(VariantRef value, uint32_t depth) { | 410 | 12 | write_literal(_out, "{"); | 411 | 12 | const uint32_t count = value.num_elements(); | 412 | 12 | StringRef previous_key; | 413 | 22 | for (uint32_t index = 0; index < count; ++index) { | 414 | 10 | if (index != 0) { | 415 | 0 | write_literal(_out, ","); | 416 | 0 | } | 417 | 10 | uint32_t field_id = 0; | 418 | 10 | VariantRef child = value.object_value_at(index, &field_id); | 419 | 10 | const StringRef key = value.metadata.key_at(field_id); | 420 | 10 | require_json_object_key(key, previous_key, index); | 421 | 10 | write_escaped_json_string(_out, key); | 422 | 10 | write_literal(_out, ":"); | 423 | 10 | write(child, depth + 1); | 424 | 10 | previous_key = key; | 425 | 10 | } | 426 | 12 | write_literal(_out, "}"); | 427 | 12 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 64 | void write_object(VariantRef value, uint32_t depth) { | 410 | 64 | write_literal(_out, "{"); | 411 | 64 | const uint32_t count = value.num_elements(); | 412 | 64 | StringRef previous_key; | 413 | 176 | for (uint32_t index = 0; index < count; ++index) { | 414 | 112 | if (index != 0) { | 415 | 48 | write_literal(_out, ","); | 416 | 48 | } | 417 | 112 | uint32_t field_id = 0; | 418 | 112 | VariantRef child = value.object_value_at(index, &field_id); | 419 | 112 | const StringRef key = value.metadata.key_at(field_id); | 420 | 112 | require_json_object_key(key, previous_key, index); | 421 | 112 | write_escaped_json_string(_out, key); | 422 | 112 | write_literal(_out, ":"); | 423 | 112 | write(child, depth + 1); | 424 | 112 | previous_key = key; | 425 | 112 | } | 426 | 64 | write_literal(_out, "}"); | 427 | 64 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_117VariantJsonWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 10 | void write_object(VariantRef value, uint32_t depth) { | 410 | 10 | write_literal(_out, "{"); | 411 | 10 | const uint32_t count = value.num_elements(); | 412 | 10 | StringRef previous_key; | 413 | 20 | for (uint32_t index = 0; index < count; ++index) { | 414 | 10 | if (index != 0) { | 415 | 0 | write_literal(_out, ","); | 416 | 0 | } | 417 | 10 | uint32_t field_id = 0; | 418 | 10 | VariantRef child = value.object_value_at(index, &field_id); | 419 | 10 | const StringRef key = value.metadata.key_at(field_id); | 420 | 10 | require_json_object_key(key, previous_key, index); | 421 | 10 | write_escaped_json_string(_out, key); | 422 | 10 | write_literal(_out, ":"); | 423 | 10 | write(child, depth + 1); | 424 | 10 | previous_key = key; | 425 | 10 | } | 426 | 10 | write_literal(_out, "}"); | 427 | 10 | } |
variant_assembler_legacy_test.cpp:_ZN5doris12variant_json7PrinterINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 112 | void write_object(VariantRef value, uint32_t depth) { | 410 | 112 | write_literal(_out, "{"); | 411 | 112 | const uint32_t count = value.num_elements(); | 412 | 112 | StringRef previous_key; | 413 | 254 | for (uint32_t index = 0; index < count; ++index) { | 414 | 142 | if (index != 0) { | 415 | 38 | write_literal(_out, ","); | 416 | 38 | } | 417 | 142 | uint32_t field_id = 0; | 418 | 142 | VariantRef child = value.object_value_at(index, &field_id); | 419 | 142 | const StringRef key = value.metadata.key_at(field_id); | 420 | 142 | require_json_object_key(key, previous_key, index); | 421 | 142 | write_escaped_json_string(_out, key); | 422 | 142 | write_literal(_out, ":"); | 423 | 142 | write(child, depth + 1); | 424 | 142 | previous_key = key; | 425 | 142 | } | 426 | 112 | write_literal(_out, "}"); | 427 | 112 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 42 | void write_object(VariantRef value, uint32_t depth) { | 410 | 42 | write_literal(_out, "{"); | 411 | 42 | const uint32_t count = value.num_elements(); | 412 | 42 | StringRef previous_key; | 413 | 98 | for (uint32_t index = 0; index < count; ++index) { | 414 | 56 | if (index != 0) { | 415 | 16 | write_literal(_out, ","); | 416 | 16 | } | 417 | 56 | uint32_t field_id = 0; | 418 | 56 | VariantRef child = value.object_value_at(index, &field_id); | 419 | 56 | const StringRef key = value.metadata.key_at(field_id); | 420 | 56 | require_json_object_key(key, previous_key, index); | 421 | 56 | write_escaped_json_string(_out, key); | 422 | 56 | write_literal(_out, ":"); | 423 | 56 | write(child, depth + 1); | 424 | 56 | previous_key = key; | 425 | 56 | } | 426 | 42 | write_literal(_out, "}"); | 427 | 42 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 29.7k | void write_object(VariantRef value, uint32_t depth) { | 410 | 29.7k | write_literal(_out, "{"); | 411 | 29.7k | const uint32_t count = value.num_elements(); | 412 | 29.7k | StringRef previous_key; | 413 | 121k | for (uint32_t index = 0; index < count; ++index) { | 414 | 91.3k | if (index != 0) { | 415 | 62.1k | write_literal(_out, ","); | 416 | 62.1k | } | 417 | 91.3k | uint32_t field_id = 0; | 418 | 91.3k | VariantRef child = value.object_value_at(index, &field_id); | 419 | 91.3k | const StringRef key = value.metadata.key_at(field_id); | 420 | 91.3k | require_json_object_key(key, previous_key, index); | 421 | 91.3k | write_escaped_json_string(_out, key); | 422 | 91.3k | write_literal(_out, ":"); | 423 | 91.3k | write(child, depth + 1); | 424 | 91.3k | previous_key = key; | 425 | 91.3k | } | 426 | 29.7k | write_literal(_out, "}"); | 427 | 29.7k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 24.9k | void write_object(VariantRef value, uint32_t depth) { | 410 | 24.9k | write_literal(_out, "{"); | 411 | 24.9k | const uint32_t count = value.num_elements(); | 412 | 24.9k | StringRef previous_key; | 413 | 101k | for (uint32_t index = 0; index < count; ++index) { | 414 | 76.9k | if (index != 0) { | 415 | 52.5k | write_literal(_out, ","); | 416 | 52.5k | } | 417 | 76.9k | uint32_t field_id = 0; | 418 | 76.9k | VariantRef child = value.object_value_at(index, &field_id); | 419 | 76.9k | const StringRef key = value.metadata.key_at(field_id); | 420 | 76.9k | require_json_object_key(key, previous_key, index); | 421 | 76.9k | write_escaped_json_string(_out, key); | 422 | 76.9k | write_literal(_out, ":"); | 423 | 76.9k | write(child, depth + 1); | 424 | 76.9k | previous_key = key; | 425 | 76.9k | } | 426 | 24.9k | write_literal(_out, "}"); | 427 | 24.9k | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE12write_objectENS_10VariantRefEj Line | Count | Source | 409 | 6 | void write_object(VariantRef value, uint32_t depth) { | 410 | 6 | write_literal(_out, "{"); | 411 | 6 | const uint32_t count = value.num_elements(); | 412 | 6 | StringRef previous_key; | 413 | 12 | for (uint32_t index = 0; index < count; ++index) { | 414 | 6 | if (index != 0) { | 415 | 0 | write_literal(_out, ","); | 416 | 0 | } | 417 | 6 | uint32_t field_id = 0; | 418 | 6 | VariantRef child = value.object_value_at(index, &field_id); | 419 | 6 | const StringRef key = value.metadata.key_at(field_id); | 420 | 6 | require_json_object_key(key, previous_key, index); | 421 | 6 | write_escaped_json_string(_out, key); | 422 | 6 | write_literal(_out, ":"); | 423 | 6 | write(child, depth + 1); | 424 | 6 | previous_key = key; | 425 | 6 | } | 426 | 6 | write_literal(_out, "}"); | 427 | 6 | } |
|
428 | | |
429 | 806 | void write_array(VariantRef value, uint32_t depth) { |
430 | 806 | write_literal(_out, "["); |
431 | 806 | const uint32_t count = value.num_elements(); |
432 | 1.77k | for (uint32_t index = 0; index < count; ++index) { |
433 | 968 | if (index != 0) { |
434 | 202 | write_literal(_out, ","); |
435 | 202 | } |
436 | 968 | write(value.array_at(index), depth + 1); |
437 | 968 | } |
438 | 806 | write_literal(_out, "]"); |
439 | 806 | } column_variant_v2_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_110JsonWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 429 | 38 | void write_array(VariantRef value, uint32_t depth) { | 430 | 38 | write_literal(_out, "["); | 431 | 38 | const uint32_t count = value.num_elements(); | 432 | 76 | for (uint32_t index = 0; index < count; ++index) { | 433 | 38 | if (index != 0) { | 434 | 0 | write_literal(_out, ","); | 435 | 0 | } | 436 | 38 | write(value.array_at(index), depth + 1); | 437 | 38 | } | 438 | 38 | write_literal(_out, "]"); | 439 | 38 | } |
function_variant_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 429 | 4 | void write_array(VariantRef value, uint32_t depth) { | 430 | 4 | write_literal(_out, "["); | 431 | 4 | const uint32_t count = value.num_elements(); | 432 | 12 | for (uint32_t index = 0; index < count; ++index) { | 433 | 8 | if (index != 0) { | 434 | 4 | write_literal(_out, ","); | 435 | 4 | } | 436 | 8 | write(value.array_at(index), depth + 1); | 437 | 8 | } | 438 | 4 | write_literal(_out, "]"); | 439 | 4 | } |
segment_flusher_format_test.cpp:_ZN5doris12variant_json7PrinterIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterE11write_arrayENS_10VariantRefEj Line | Count | Source | 429 | 8 | void write_array(VariantRef value, uint32_t depth) { | 430 | 8 | write_literal(_out, "["); | 431 | 8 | const uint32_t count = value.num_elements(); | 432 | 24 | for (uint32_t index = 0; index < count; ++index) { | 433 | 16 | if (index != 0) { | 434 | 8 | write_literal(_out, ","); | 435 | 8 | } | 436 | 16 | write(value.array_at(index), depth + 1); | 437 | 16 | } | 438 | 8 | write_literal(_out, "]"); | 439 | 8 | } |
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 | 429 | 40 | void write_array(VariantRef value, uint32_t depth) { | 430 | 40 | write_literal(_out, "["); | 431 | 40 | const uint32_t count = value.num_elements(); | 432 | 96 | for (uint32_t index = 0; index < count; ++index) { | 433 | 56 | if (index != 0) { | 434 | 20 | write_literal(_out, ","); | 435 | 20 | } | 436 | 56 | write(value.array_at(index), depth + 1); | 437 | 56 | } | 438 | 40 | write_literal(_out, "]"); | 439 | 40 | } |
variant_string_parse_test.cpp:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_112StringWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 429 | 526 | void write_array(VariantRef value, uint32_t depth) { | 430 | 526 | write_literal(_out, "["); | 431 | 526 | const uint32_t count = value.num_elements(); | 432 | 1.07k | for (uint32_t index = 0; index < count; ++index) { | 433 | 550 | if (index != 0) { | 434 | 24 | write_literal(_out, ","); | 435 | 24 | } | 436 | 550 | write(value.array_at(index), depth + 1); | 437 | 550 | } | 438 | 526 | write_literal(_out, "]"); | 439 | 526 | } |
_ZN5doris12variant_json7PrinterINS_14BufferWritableEE11write_arrayENS_10VariantRefEj Line | Count | Source | 429 | 88 | void write_array(VariantRef value, uint32_t depth) { | 430 | 88 | write_literal(_out, "["); | 431 | 88 | const uint32_t count = value.num_elements(); | 432 | 228 | for (uint32_t index = 0; index < count; ++index) { | 433 | 140 | if (index != 0) { | 434 | 66 | write_literal(_out, ","); | 435 | 66 | } | 436 | 140 | write(value.array_at(index), depth + 1); | 437 | 140 | } | 438 | 88 | write_literal(_out, "]"); | 439 | 88 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_114CountingWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 429 | 90 | void write_array(VariantRef value, uint32_t depth) { | 430 | 90 | write_literal(_out, "["); | 431 | 90 | const uint32_t count = value.num_elements(); | 432 | 232 | for (uint32_t index = 0; index < count; ++index) { | 433 | 142 | if (index != 0) { | 434 | 68 | write_literal(_out, ","); | 435 | 68 | } | 436 | 142 | write(value.array_at(index), depth + 1); | 437 | 142 | } | 438 | 90 | write_literal(_out, "]"); | 439 | 90 | } |
unity_5_cxx.cxx:_ZN5doris12variant_json7PrinterINS_12_GLOBAL__N_111FixedWriterEE11write_arrayENS_10VariantRefEj Line | Count | Source | 429 | 12 | void write_array(VariantRef value, uint32_t depth) { | 430 | 12 | write_literal(_out, "["); | 431 | 12 | const uint32_t count = value.num_elements(); | 432 | 30 | for (uint32_t index = 0; index < count; ++index) { | 433 | 18 | if (index != 0) { | 434 | 12 | write_literal(_out, ","); | 435 | 12 | } | 436 | 18 | write(value.array_at(index), depth + 1); | 437 | 18 | } | 438 | 12 | write_literal(_out, "]"); | 439 | 12 | } |
|
440 | | |
441 | | Writer& _out; |
442 | | const VariantJsonFormatOptions& _options; |
443 | | }; |
444 | | |
445 | | } // namespace variant_json |
446 | | |
447 | | // Writer is statically dispatched and only needs write(const char*, size_t). |
448 | | template <typename Writer> |
449 | | void to_json(VariantRef value, Writer& out, |
450 | 53.5k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { |
451 | 53.5k | variant_json::require_exact_json_value(value); |
452 | 53.5k | variant_json::Printer<Writer>(out, options).write(value, 0); |
453 | 53.5k | } column_variant_v2_test.cpp:_ZN5doris7to_jsonINS_12_GLOBAL__N_110JsonWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 286 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 286 | variant_json::require_exact_json_value(value); | 452 | 286 | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 286 | } |
function_variant_parse_test.cpp:_ZN5doris7to_jsonINS_12_GLOBAL__N_112StringWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 26 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 26 | variant_json::require_exact_json_value(value); | 452 | 26 | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 26 | } |
segment_flusher_format_test.cpp:_ZN5doris7to_jsonIZNS_12_GLOBAL__N_118variant_field_jsonB5cxx11ERKNS_12VariantFieldEE12StringWriterEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 48 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 48 | variant_json::require_exact_json_value(value); | 452 | 48 | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 48 | } |
hierarchical_data_iterator_test.cpp:_ZN5doris7to_jsonINS_12_GLOBAL__N_117VariantJsonWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 14 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 14 | variant_json::require_exact_json_value(value); | 452 | 14 | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 14 | } |
variant_assembler_legacy_test.cpp:_ZN5doris7to_jsonINS_10segment_v210variant_v212_GLOBAL__N_110JsonWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 306 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 306 | variant_json::require_exact_json_value(value); | 452 | 306 | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 306 | } |
variant_string_parse_test.cpp:_ZN5doris7to_jsonINS_12_GLOBAL__N_112StringWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 96 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 96 | variant_json::require_exact_json_value(value); | 452 | 96 | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 96 | } |
_ZN5doris7to_jsonINS_14BufferWritableEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 26.2k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 26.2k | variant_json::require_exact_json_value(value); | 452 | 26.2k | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 26.2k | } |
unity_5_cxx.cxx:_ZN5doris7to_jsonINS_12_GLOBAL__N_114CountingWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 26.3k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 26.3k | variant_json::require_exact_json_value(value); | 452 | 26.3k | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 26.3k | } |
unity_5_cxx.cxx:_ZN5doris7to_jsonINS_12_GLOBAL__N_111FixedWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 450 | 162 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 451 | 162 | variant_json::require_exact_json_value(value); | 452 | 162 | variant_json::Printer<Writer>(out, options).write(value, 0); | 453 | 162 | } |
|
454 | | |
455 | | // Preserve the current Variant V1 SQL result contract for top-level scalar values: JSON strings |
456 | | // such as "value" and "2" are returned as value and 2. Once V1 is removed, this compatibility |
457 | | // output will change to the uniform JSON representation ("value" and "2"). |
458 | | template <typename Writer> |
459 | | void to_sql_string(VariantRef value, Writer& out, |
460 | 5.00k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { |
461 | 5.00k | variant_json::require_exact_json_value(value); |
462 | 5.00k | variant_json::Printer<Writer>(out, options).write_plain_scalar(value); |
463 | 5.00k | } _ZN5doris13to_sql_stringINS_14BufferWritableEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 460 | 4.90k | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 461 | 4.90k | variant_json::require_exact_json_value(value); | 462 | 4.90k | variant_json::Printer<Writer>(out, options).write_plain_scalar(value); | 463 | 4.90k | } |
unity_5_cxx.cxx:_ZN5doris13to_sql_stringINS_12_GLOBAL__N_114CountingWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 460 | 52 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 461 | 52 | variant_json::require_exact_json_value(value); | 462 | 52 | variant_json::Printer<Writer>(out, options).write_plain_scalar(value); | 463 | 52 | } |
unity_5_cxx.cxx:_ZN5doris13to_sql_stringINS_12_GLOBAL__N_111FixedWriterEEEvNS_10VariantRefERT_RKNS_24VariantJsonFormatOptionsE Line | Count | Source | 460 | 52 | const VariantJsonFormatOptions& options = VariantJsonFormatOptions {}) { | 461 | 52 | variant_json::require_exact_json_value(value); | 462 | 52 | variant_json::Printer<Writer>(out, options).write_plain_scalar(value); | 463 | 52 | } |
|
464 | | |
465 | | } // namespace doris |