MCPcopy Create free account
hub / github.com/apache/impala / SetToMax

Method SetToMax

be/src/exprs/expr-value.h:165–209  ·  view source on GitHub ↗

Sets the value for type to max and returns a pointer to the data

Source from the content-addressed store, hash-verified

163
164 /// Sets the value for type to max and returns a pointer to the data
165 void* SetToMax(const ColumnType& type) {
166 switch (type.type) {
167 case TYPE_NULL:
168 return NULL;
169 case TYPE_BOOLEAN:
170 bool_val = true;
171 return &bool_val;
172 case TYPE_TINYINT:
173 tinyint_val = std::numeric_limits<int8_t>::max();
174 return &tinyint_val;
175 case TYPE_SMALLINT:
176 smallint_val = std::numeric_limits<int16_t>::max();
177 return &smallint_val;
178 case TYPE_INT:
179 int_val = std::numeric_limits<int32_t>::max();
180 return &int_val;
181 case TYPE_BIGINT:
182 bigint_val = std::numeric_limits<int64_t>::max();
183 return &bigint_val;
184 case TYPE_DECIMAL:
185 switch (type.GetByteSize()) {
186 case 4:
187 decimal4_val = MAX_UNSCALED_DECIMAL4;
188 return &decimal4_val;
189 case 8:
190 decimal8_val = MAX_UNSCALED_DECIMAL8;
191 return &decimal8_val;
192 case 16:
193 decimal16_val = MAX_UNSCALED_DECIMAL16;
194 return &decimal16_val;
195 }
196 case TYPE_FLOAT:
197 float_val = std::numeric_limits<float>::infinity();
198 return &float_val;
199 case TYPE_DOUBLE:
200 double_val = std::numeric_limits<double>::infinity();
201 return &double_val;
202 case TYPE_DATE:
203 date_val = DateValue::MAX_DATE;
204 return &date_val;
205 default:
206 DCHECK(false);
207 return NULL;
208 }
209 }
210
211 void* SetToAnyVal(impala_udf::AnyVal* v, const ColumnType& type) {
212 if (v->is_null) return nullptr;

Callers 1

InitAggSlotsMethod · 0.80

Calls 2

maxFunction · 0.85
GetByteSizeMethod · 0.80

Tested by

no test coverage detected