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

Method SetToMin

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

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

Source from the content-addressed store, hash-verified

114
115 /// Sets the value for type to min and returns a pointer to the data
116 void* SetToMin(const ColumnType& type) {
117 switch (type.type) {
118 case TYPE_NULL:
119 return NULL;
120 case TYPE_BOOLEAN:
121 bool_val = false;
122 return &bool_val;
123 case TYPE_TINYINT:
124 tinyint_val = std::numeric_limits<int8_t>::min();
125 return &tinyint_val;
126 case TYPE_SMALLINT:
127 smallint_val = std::numeric_limits<int16_t>::min();
128 return &smallint_val;
129 case TYPE_INT:
130 int_val = std::numeric_limits<int32_t>::min();
131 return &int_val;
132 case TYPE_BIGINT:
133 bigint_val = std::numeric_limits<int64_t>::min();
134 return &bigint_val;
135 case TYPE_DECIMAL:
136 switch (type.GetByteSize()) {
137 case 4:
138 decimal4_val = -MAX_UNSCALED_DECIMAL4;
139 return &decimal4_val;
140 case 8:
141 decimal8_val = -MAX_UNSCALED_DECIMAL8;
142 return &decimal8_val;
143 case 16:
144 decimal16_val = -MAX_UNSCALED_DECIMAL16;
145 return &decimal16_val;
146 }
147 case TYPE_FLOAT:
148 // For floats and doubles, numeric_limits::min() is the smallest positive
149 // representable value.
150 float_val = -std::numeric_limits<float>::infinity();
151 return &float_val;
152 case TYPE_DOUBLE:
153 double_val = -std::numeric_limits<double>::infinity();
154 return &double_val;
155 case TYPE_DATE:
156 date_val = DateValue::MIN_DATE;
157 return &date_val;
158 default:
159 DCHECK(false);
160 return NULL;
161 }
162 }
163
164 /// Sets the value for type to max and returns a pointer to the data
165 void* SetToMax(const ColumnType& type) {

Callers 1

InitAggSlotsMethod · 0.80

Calls 2

minFunction · 0.85
GetByteSizeMethod · 0.80

Tested by

no test coverage detected