Skip to content

Commit fe10bfd

Browse files
stdpainHappenLee
authored andcommitted
remove unused code, format some code (apache#92)
1 parent 0ecfd24 commit fe10bfd

29 files changed

Lines changed: 162 additions & 360 deletions

‎be/src/vec/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set(VEC_FILES
2929
aggregate_functions/aggregate_function_uniq.cpp
3030
aggregate_functions/aggregate_function_hll_union_agg.cpp
3131
aggregate_functions/aggregate_function_bitmap.cpp
32+
aggregate_functions/aggregate_function_simple_factory.cpp
3233
columns/collator.cpp
3334
columns/column.cpp
3435
columns/column_const.cpp

‎be/src/vec/aggregate_functions/aggregate_function_count.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#include <vec/aggregate_functions/aggregate_function_count.h>
19-
#include <vec/aggregate_functions/factory_helpers.h>
18+
#include "vec/aggregate_functions/aggregate_function_count.h"
2019

2120
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
21+
#include "vec/aggregate_functions/factory_helpers.h"
2222

2323
namespace doris::vectorized {
2424

‎be/src/vec/aggregate_functions/aggregate_function_count.h‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,18 @@
2020
#include <array>
2121

2222
#include "common/logging.h"
23-
#include <vec/aggregate_functions/aggregate_function.h>
24-
#include <vec/columns/column_nullable.h>
25-
#include <vec/common/assert_cast.h>
26-
#include <vec/data_types/data_type_number.h>
27-
#include <vec/io/io_helper.h>
23+
#include "vec/aggregate_functions/aggregate_function.h"
24+
#include "vec/columns/column_nullable.h"
25+
#include "vec/common/assert_cast.h"
26+
#include "vec/data_types/data_type_number.h"
27+
#include "vec/io/io_helper.h"
2828

2929
namespace doris::vectorized {
3030

3131
struct AggregateFunctionCountData {
3232
UInt64 count = 0;
3333
};
3434

35-
namespace ErrorCodes {
36-
extern const int LOGICAL_ERROR;
37-
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
38-
} // namespace ErrorCodes
39-
4035
/// Simply count number of calls.
4136
class AggregateFunctionCount final
4237
: public IAggregateFunctionDataHelper<AggregateFunctionCountData, AggregateFunctionCount> {
@@ -80,7 +75,8 @@ class AggregateFunctionCountNotNullUnary final
8075
: IAggregateFunctionDataHelper<AggregateFunctionCountData,
8176
AggregateFunctionCountNotNullUnary>({argument}, params) {
8277
if (!argument->is_nullable()) {
83-
LOG(FATAL) << "Logical error: not Nullable data type passed to AggregateFunctionCountNotNullUnary";
78+
LOG(FATAL) << "Logical error: not Nullable data type passed to "
79+
"AggregateFunctionCountNotNullUnary";
8480
}
8581
}
8682

‎be/src/vec/aggregate_functions/aggregate_function_distinct.cpp‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
#include "vec/data_types/data_type_nullable.h"
2727

2828
namespace doris::vectorized {
29-
namespace ErrorCodes {
30-
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
31-
}
3229

3330
class AggregateFunctionCombinatorDistinct final : public IAggregateFunctionCombinator {
3431
public:

‎be/src/vec/aggregate_functions/aggregate_function_distinct.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class AggregateFunctionDistinct
187187
// nested_func->insert_result_into(get_nested_place(place), to, arena);
188188

189189
nested_func->add_batch_single_place(arguments[0]->size(), get_nested_place(place),
190-
arguments_raw.data(), nullptr);
190+
arguments_raw.data(), nullptr);
191191
nested_func->insert_result_into(get_nested_place(place), to);
192192
}
193193

‎be/src/vec/aggregate_functions/aggregate_function_hll_union_agg.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#include <vec/aggregate_functions/aggregate_function_hll_union_agg.h>
19-
#include <vec/aggregate_functions/factory_helpers.h>
18+
#include "vec/aggregate_functions/aggregate_function_hll_union_agg.h"
2019

2120
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
21+
#include "vec/aggregate_functions/factory_helpers.h"
2222

2323
namespace doris::vectorized {
2424

‎be/src/vec/aggregate_functions/aggregate_function_min_max.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717

1818
#include "vec/aggregate_functions/aggregate_function_min_max.h"
1919

20-
#include <vec/aggregate_functions/factory_helpers.h>
21-
#include <vec/aggregate_functions/helpers.h>
22-
2320
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
21+
#include "vec/aggregate_functions/factory_helpers.h"
22+
#include "vec/aggregate_functions/helpers.h"
2423

2524
namespace doris::vectorized {
2625

‎be/src/vec/aggregate_functions/aggregate_function_min_max.h‎

Lines changed: 9 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -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
};

‎be/src/vec/aggregate_functions/aggregate_function_nothing.h‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
#pragma once
1919

20-
#include <vec/aggregate_functions/aggregate_function.h>
21-
#include <vec/columns/column.h>
22-
#include <vec/data_types/data_type_nothing.h>
23-
#include <vec/data_types/data_type_nullable.h>
24-
#include <vec/io/io_helper.h>
20+
#include "vec/aggregate_functions/aggregate_function.h"
21+
#include "vec/columns/column.h"
22+
#include "vec/data_types/data_type_nothing.h"
23+
#include "vec/data_types/data_type_nullable.h"
24+
#include "vec/io/io_helper.h"
2525

2626
namespace doris::vectorized {
2727

@@ -56,7 +56,9 @@ class AggregateFunctionNothing final : public IAggregateFunctionHelper<Aggregate
5656

5757
void deserialize(AggregateDataPtr, std::istream&, Arena*) const override {}
5858

59-
void insert_result_into(ConstAggregateDataPtr, IColumn& to) const override { to.insert_default(); }
59+
void insert_result_into(ConstAggregateDataPtr, IColumn& to) const override {
60+
to.insert_default();
61+
}
6062

6163
const char* get_header_file_path() const override { return __FILE__; }
6264
};

‎be/src/vec/aggregate_functions/aggregate_function_null.cpp‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#include <vec/aggregate_functions/aggregate_function.h>
19-
#include <vec/aggregate_functions/aggregate_function_combinator.h>
20-
#include <vec/aggregate_functions/aggregate_function_count.h>
21-
#include <vec/aggregate_functions/aggregate_function_nothing.h>
22-
#include <vec/aggregate_functions/aggregate_function_null.h>
23-
#include <vec/aggregate_functions/aggregate_function_simple_factory.h>
24-
#include <vec/data_types/data_type_nullable.h>
18+
#include "vec/aggregate_functions/aggregate_function_null.h"
2519

2620
#include "common/logging.h"
21+
#include "vec/aggregate_functions/aggregate_function.h"
22+
#include "vec/aggregate_functions/aggregate_function_combinator.h"
23+
#include "vec/aggregate_functions/aggregate_function_count.h"
24+
#include "vec/aggregate_functions/aggregate_function_nothing.h"
25+
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
26+
#include "vec/data_types/data_type_nullable.h"
2727

2828
namespace doris::vectorized {
2929

0 commit comments

Comments
 (0)