Skip to content

Commit

Permalink
[Refactor] Remove unused AnyValUtils (StarRocks#51680)
Browse files Browse the repository at this point in the history
Signed-off-by: stdpain <[email protected]>
  • Loading branch information
stdpain authored Oct 10, 2024
1 parent 8a8687e commit 4720bb1
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 314 deletions.
21 changes: 0 additions & 21 deletions be/src/column/column_for_each.h

This file was deleted.

1 change: 0 additions & 1 deletion be/src/exec/aggregate/aggregate_base_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "exec/aggregate/aggregate_base_node.h"

#include "exprs/anyval_util.h"
#include "gutil/strings/substitute.h"

namespace starrocks {
Expand Down
5 changes: 2 additions & 3 deletions be/src/exec/aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "exprs/agg/agg_state_merge.h"
#include "exprs/agg/agg_state_union.h"
#include "exprs/agg/aggregate_state_allocator.h"
#include "exprs/anyval_util.h"
#include "gen_cpp/PlanNodes_types.h"
#include "runtime/current_thread.h"
#include "runtime/descriptors.h"
Expand Down Expand Up @@ -171,7 +170,7 @@ void AggregatorParams::init() {
// collect arg_typedescs for aggregate function.
std::vector<FunctionContext::TypeDesc> arg_typedescs;
for (auto& type : fn.arg_types) {
arg_typedescs.push_back(AnyValUtil::column_type_to_type_desc(TypeDescriptor::from_thrift(type)));
arg_typedescs.push_back(TypeDescriptor::from_thrift(type));
}
TypeDescriptor return_type = TypeDescriptor::from_thrift(fn.ret_type);
TypeDescriptor serde_type = TypeDescriptor::from_thrift(fn.aggregate_fn.intermediate_type);
Expand Down Expand Up @@ -451,7 +450,7 @@ Status Aggregator::prepare(RuntimeState* state, ObjectPool* pool, RuntimeProfile
for (int i = 0; i < _agg_fn_ctxs.size(); ++i) {
auto& agg_fn_type = _agg_fn_types[i];
auto& agg_func = _agg_functions[i];
TypeDescriptor return_type = AnyValUtil::column_type_to_type_desc(agg_fn_type.result_type);
TypeDescriptor return_type = agg_fn_type.result_type;
std::vector<TypeDescriptor> arg_types = agg_fn_type.arg_typedescs;

const AggStateDesc* agg_state_desc = nullptr;
Expand Down
6 changes: 2 additions & 4 deletions be/src/exec/analytor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "exprs/agg/aggregate_state_allocator.h"
#include "exprs/agg/count.h"
#include "exprs/agg/window.h"
#include "exprs/anyval_util.h"
#include "exprs/expr.h"
#include "exprs/expr_context.h"
#include "exprs/function_context.h"
Expand Down Expand Up @@ -192,14 +191,13 @@ Status Analytor::prepare(RuntimeState* state, ObjectPool* pool, RuntimeProfile*
const TypeDescriptor return_type = TypeDescriptor::from_thrift(fn.ret_type);
const TypeDescriptor arg_type = TypeDescriptor::from_thrift(fn.arg_types[0]);

auto return_typedesc = AnyValUtil::column_type_to_type_desc(return_type);
// Collect arg_typedescs for aggregate function.
std::vector<FunctionContext::TypeDesc> arg_typedescs;
for (auto& type : fn.arg_types) {
arg_typedescs.push_back(AnyValUtil::column_type_to_type_desc(TypeDescriptor::from_thrift(type)));
arg_typedescs.push_back(TypeDescriptor::from_thrift(type));
}

_agg_fn_ctxs[i] = FunctionContext::create_context(state, _mem_pool.get(), return_typedesc, arg_typedescs);
_agg_fn_ctxs[i] = FunctionContext::create_context(state, _mem_pool.get(), return_type, arg_typedescs);
state->obj_pool()->add(_agg_fn_ctxs[i]);

// For nullable aggregate function(sum, max, min, avg),
Expand Down
25 changes: 0 additions & 25 deletions be/src/exec/hash_map.h

This file was deleted.

1 change: 0 additions & 1 deletion be/src/exprs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ set(EXPR_FILES
agg/factory/aggregate_resolver_utility.cpp
agg/factory/aggregate_resolver_variance.cpp
agg/factory/aggregate_resolver_window.cpp
anyval_util.cpp
base64.cpp
binary_functions.cpp
expr_context.cpp
Expand Down
166 changes: 0 additions & 166 deletions be/src/exprs/anyval_util.cpp

This file was deleted.

1 change: 0 additions & 1 deletion be/src/exprs/array_map_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "column/vectorized_fwd.h"
#include "common/constexpr.h"
#include "common/statusor.h"
#include "exprs/anyval_util.h"
#include "exprs/expr_context.h"
#include "exprs/function_helper.h"
#include "exprs/lambda_function.h"
Expand Down
5 changes: 2 additions & 3 deletions be/src/exprs/arrow_function_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "column/column.h"
#include "column/column_helper.h"
#include "column/vectorized_fwd.h"
#include "exprs/anyval_util.h"
#include "exprs/function_context.h"
#include "gen_cpp/Types_types.h"
#include "runtime/current_thread.h"
Expand Down Expand Up @@ -71,11 +70,11 @@ Status ArrowFunctionCallExpr::prepare(RuntimeState* state, ExprContext* context)
RETURN_IF_ERROR(Expr::prepare(state, context));
DCHECK(_fn.__isset.fid);

FunctionContext::TypeDesc return_type = AnyValUtil::column_type_to_type_desc(_type);
FunctionContext::TypeDesc return_type = _type;
std::vector<FunctionContext::TypeDesc> args_types;

for (Expr* child : _children) {
args_types.push_back(AnyValUtil::column_type_to_type_desc(child->type()));
args_types.push_back(child->type());
}

_fn_context_index = context->register_func(state, return_type, args_types);
Expand Down
1 change: 0 additions & 1 deletion be/src/exprs/expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "common/object_pool.h"
#include "common/status.h"
#include "common/statusor.h"
#include "exprs/anyval_util.h"
#include "exprs/arithmetic_expr.h"
#include "exprs/array_element_expr.h"
#include "exprs/array_expr.h"
Expand Down
5 changes: 2 additions & 3 deletions be/src/exprs/function_call_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "column/column_helper.h"
#include "column/const_column.h"
#include "column/vectorized_fwd.h"
#include "exprs/anyval_util.h"
#include "exprs/builtin_functions.h"
#include "exprs/expr_context.h"
#include "gutil/strings/substitute.h"
Expand Down Expand Up @@ -81,15 +80,15 @@ Status VectorizedFunctionCallExpr::prepare(starrocks::RuntimeState* state, starr
RETURN_IF_ERROR(Expr::prepare(state, context));

// parpare result type and arg types
FunctionContext::TypeDesc return_type = AnyValUtil::column_type_to_type_desc(_type);
FunctionContext::TypeDesc return_type = _type;
if (!_fn.__isset.fid && !_fn.__isset.agg_state_desc) {
return Status::InternalError("Vectorized engine doesn't implement agg state function " +
_fn.name.function_name);
}
std::vector<FunctionContext::TypeDesc> args_types;
std::vector<bool> arg_nullblaes;
for (Expr* child : _children) {
args_types.push_back(AnyValUtil::column_type_to_type_desc(child->type()));
args_types.push_back(child->type());
arg_nullblaes.emplace_back(child->is_nullable());
}

Expand Down
5 changes: 2 additions & 3 deletions be/src/exprs/java_function_call_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "column/vectorized_fwd.h"
#include "common/status.h"
#include "common/statusor.h"
#include "exprs/anyval_util.h"
#include "exprs/function_context.h"
#include "gutil/casts.h"
#include "jni.h"
Expand Down Expand Up @@ -133,11 +132,11 @@ Status JavaFunctionCallExpr::prepare(RuntimeState* state, ExprContext* context)
return Status::InternalError("Not Found function id for " + _fn.name.function_name);
}

FunctionContext::TypeDesc return_type = AnyValUtil::column_type_to_type_desc(_type);
FunctionContext::TypeDesc return_type = _type;
std::vector<FunctionContext::TypeDesc> args_types;

for (Expr* child : _children) {
args_types.push_back(AnyValUtil::column_type_to_type_desc(child->type()));
args_types.push_back(child->type());
}

// todo: varargs use for allocate slice memory, need compute buffer size
Expand Down
1 change: 0 additions & 1 deletion be/src/exprs/jit/jit_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "common/compiler_util.h"
#include "common/status.h"
#include "exec/pipeline/fragment_context.h"
#include "exprs/anyval_util.h"
#include "exprs/expr.h"
#include "exprs/function_context.h"
#include "exprs/jit/jit_engine.h"
Expand Down
1 change: 0 additions & 1 deletion be/src/exprs/map_apply_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "column/fixed_length_column.h"
#include "column/map_column.h"
#include "column/vectorized_fwd.h"
#include "exprs/anyval_util.h"
#include "exprs/expr_context.h"
#include "exprs/function_helper.h"
#include "exprs/lambda_function.h"
Expand Down
1 change: 0 additions & 1 deletion be/src/util/bitmap_intersect.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#pragma once

#include "exprs/anyval_util.h"
#include "runtime/datetime_value.h"
#include "runtime/string_value.h"
#include "types/bitmap_value.h"
Expand Down
Loading

0 comments on commit 4720bb1

Please sign in to comment.