@@ -160,86 +160,10 @@ struct SingleValueDataString {
160160
161161 StringRef get_string_ref () const { return StringRef (get_data (), size); }
162162
163- // void insert_result_into(IColumn & to) const
164- // {
165- // if (has())
166- // assert_cast<ColumnString &>(to).insert_data_with_terminating_zero(get_data(), size);
167- // else
168- // assert_cast<ColumnString &>(to).insert_default();
169- // }
170-
171- // void write(WriteBuffer & buf, const IDataType & /*data_type*/) const
172- // {
173- // write_binary(size, buf);
174- // if (has())
175- // buf.write(get_data(), size);
176- // }
177-
178- // void read(ReadBuffer & buf, const IDataType & /*data_type*/, Arena * arena)
179- // {
180- // Int32 rhs_size;
181- // read_binary(rhs_size, buf);
182-
183- // if (rhs_size >= 0)
184- // {
185- // if (rhs_size <= MAX_SMALL_STRING_SIZE)
186- // {
187- // /// Don't free large_data here.
188-
189- // size = rhs_size;
190-
191- // if (size > 0)
192- // buf.read(small_data, size);
193- // }
194- // else
195- // {
196- // if (capacity < rhs_size)
197- // {
198- // capacity = static_cast<UInt32>(round_up_to_power_of_two_or_zero(rhs_size));
199- // /// Don't free large_data here.
200- // large_data = arena->alloc(capacity);
201- // }
202-
203- // size = rhs_size;
204- // buf.read(large_data, size);
205- // }
206- // }
207- // else
208- // {
209- // /// Don't free large_data here.
210- // size = rhs_size;
211- // }
212- // }
213-
214163 // / Assuming to.has()
215- void change_impl (StringRef value, Arena* arena) {
216- // Int32 value_size = value.size;
217-
218- // if (value_size <= MAX_SMALL_STRING_SIZE)
219- // {
220- // /// Don't free large_data here.
221- // size = value_size;
222-
223- // if (size > 0)
224- // memcpy(small_data, value.data, size);
225- // }
226- // else
227- // {
228- // if (capacity < value_size)
229- // {
230- // /// Don't free large_data here.
231- // capacity = round_up_to_power_of_two_or_zero(value_size);
232- // large_data = arena->alloc(capacity);
233- // }
234-
235- // size = value_size;
236- // memcpy(large_data, value.data, size);
237- // }
238- }
164+ void change_impl (StringRef value, Arena* arena) {}
239165
240- void change (const IColumn& column, size_t row_num, Arena* arena) {
241- // change_impl(assert_cast<const ColumnString &>(column).get_data_at_with_terminating_zero(row_num), arena);
242- }
166+ void change (const IColumn& column, size_t row_num, Arena* arena) {}
243167
244168 void change (const Self& to, Arena* arena) { change_impl (to.get_string_ref (), arena); }
245169
@@ -272,17 +196,6 @@ struct SingleValueDataString {
272196 return false ;
273197 }
274198
275- // bool change_if_less(const IColumn & column, size_t row_num, Arena * arena)
276- // {
277- // if (!has() || assert_cast<const ColumnString &>(column).get_data_at_with_terminating_zero(row_num) < get_string_ref())
278- // {
279- // change(column, row_num, arena);
280- // return true;
281- // }
282- // else
283- // return false;
284- // }
285-
286199 bool change_if_less (const Self& to, Arena* arena) {
287200 if (to.has () && (!has () || to.get_string_ref () < get_string_ref ())) {
288201 change (to, arena);
@@ -291,17 +204,6 @@ struct SingleValueDataString {
291204 return false ;
292205 }
293206
294- // bool change_if_greater(const IColumn & column, size_t row_num, Arena * arena)
295- // {
296- // if (!has() || assert_cast<const ColumnString &>(column).get_data_at_with_terminating_zero(row_num) > get_string_ref())
297- // {
298- // change(column, row_num, arena);
299- // return true;
300- // }
301- // else
302- // return false;
303- // }
304-
305207 bool change_if_greater (const Self& to, Arena* arena) {
306208 if (to.has () && (!has () || to.get_string_ref () > get_string_ref ())) {
307209 change (to, arena);
@@ -310,12 +212,11 @@ struct SingleValueDataString {
310212 return false ;
311213 }
312214
313- bool is_equal_to (const Self& to) const { return has () && to.get_string_ref () == get_string_ref (); }
314-
315- bool is_equal_to (const IColumn& column, size_t row_num) const {
316- // return has() && assert_cast<const ColumnString &>(column).get_data_at_with_terminating_zero(row_num) == get_string_ref();
317- return false ;
215+ bool is_equal_to (const Self& to) const {
216+ return has () && to.get_string_ref () == get_string_ref ();
318217 }
218+
219+ bool is_equal_to (const IColumn& column, size_t row_num) const { return false ; }
319220};
320221
321222// / For any other value types.
@@ -335,26 +236,6 @@ struct SingleValueDataGeneric {
335236 to.insert_default ();
336237 }
337238
338- // void write(WriteBuffer & buf, const IDataType & data_type) const
339- // {
340- // if (!value.is_null())
341- // {
342- // write_binary(true, buf);
343- // data_type.serializeBinary(value, buf);
344- // }
345- // else
346- // write_binary(false, buf);
347- // }
348-
349- // void read(ReadBuffer & buf, const IDataType & data_type, Arena *)
350- // {
351- // bool is_not_null;
352- // read_binary(is_not_null, buf);
353-
354- // if (is_not_null)
355- // data_type.deserializeBinary(value, buf);
356- // }
357-
358239 void change (const IColumn& column, size_t row_num, Arena*) { column.get (row_num, value); }
359240
360241 void change (const Self& to, Arena*) { value = to.value ; }
@@ -448,7 +329,9 @@ struct AggregateFunctionMaxData : Data {
448329 bool change_if_better (const IColumn& column, size_t row_num, Arena* arena) {
449330 return this ->change_if_greater (column, row_num, arena);
450331 }
451- bool change_if_better (const Self& to, Arena* arena) { return this ->change_if_greater (to, arena); }
332+ bool change_if_better (const Self& to, Arena* arena) {
333+ return this ->change_if_greater (to, arena);
334+ }
452335
453336 static const char * name () { return " max" ; }
454337};
0 commit comments