MCPcopy Create free account
hub / github.com/cwida/FastLanes / TypedCast

Function TypedCast

src/table/attribute.cpp:63–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 static constexpr u64_pt U64_NULL = 0;
62 static constexpr bol_pt BOOL_NULL = false;
63 static constexpr flt_pt FLOAT_NULL = 0.0;
64 static constexpr dbl_pt DBL_NULL = 0.0;
65 static constexpr char STR_NULL[] = "NULL";
66
67 if constexpr (std::is_same_v<PT, i08_pt>) {
68 return I08_NULL;
69 } else if constexpr (std::is_same_v<PT, i16_pt>) {
70 return I16_NULL;
71 } else if constexpr (std::is_same_v<PT, i32_pt>) {
72 return I32_NULL;
73 } else if constexpr (std::is_same_v<PT, i64_pt>) {
74 return I64_NULL;
75 } else if constexpr (std::is_same_v<PT, u08_pt>) {
76 return U08_NULL;
77 } else if constexpr (std::is_same_v<PT, u16_pt>) {
78 return U16_NULL;
79 } else if constexpr (std::is_same_v<PT, u32_pt>) {
80 return U32_NULL;
81 } else if constexpr (std::is_same_v<PT, u64_pt>) {
82 return U64_NULL;
83 } else if constexpr (std::is_same_v<PT, str_pt>) {
84 return STR_NULL;
85 } else if constexpr (std::is_same_v<PT, bol_pt>) {
86 return BOOL_NULL;
87 } else if constexpr (std::is_same_v<PT, flt_pt>) {
88 return FLOAT_NULL;
89 } else if constexpr (std::is_same_v<PT, dbl_pt>) {
90 return DBL_NULL;
91 }
92
93 FLS_UNREACHABLE();
94 return {};
95}
96
97template <typename PT>
98void Attribute<PT>::Ingest(TypedCol<PT>& typed_column, const string& val_str) {
99 // init
100 auto& n_null = typed_column.m_stats.n_null;
101 auto& is_constant = typed_column.m_stats.is_constant;
102 auto& n_run = typed_column.m_stats.n_run;
103 auto& min = typed_column.m_stats.min;
104 auto& max = typed_column.m_stats.max;
105 auto& dictionary = typed_column.m_stats.dict;
106 // check if it NULL
107 const bool is_null = IsNull(val_str);
108
109 // ingest
110 typed_column.null_map_arr.push_back(is_null);
111 if (is_null) {
112 n_null = n_null + 1;
113 typed_column.data.push_back(Null());
114 } else {
115 typed_column.data.push_back(Cast(val_str));
116 }
117
118 const n_t current_pos = typed_column.data.size() - 1;
119
120 // into the dictionary

Callers

nothing calls this directly

Calls 5

parse_dateFunction · 0.85
parse_timestampFunction · 0.85
parse_boolFunction · 0.85
stringFunction · 0.85
whatMethod · 0.45

Tested by

no test coverage detected