Skip to content

Commit 06807b6

Browse files
authored
[chore](Mysql) remove unused code in MysqlResultWriter (#58699)
### What problem does this PR solve? ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [x] No need to test or manual test. Explain why: - [x] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [x] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [x] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
1 parent 3e804d1 commit 06807b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+74
-259
lines changed

be/src/pipeline/exec/result_sink_operator.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,8 @@ Status ResultSinkLocalState::open(RuntimeState* state) {
7777
// create writer based on sink type
7878
switch (p._sink_type) {
7979
case TResultSinkType::MYSQL_PROTOCOL: {
80-
if (state->mysql_row_binary_format()) {
81-
_writer.reset(new (std::nothrow) vectorized::VMysqlResultWriter<true>(
82-
_sender, _output_vexpr_ctxs, custom_profile()));
83-
} else {
84-
_writer.reset(new (std::nothrow) vectorized::VMysqlResultWriter<false>(
85-
_sender, _output_vexpr_ctxs, custom_profile()));
86-
}
80+
_writer.reset(new (std::nothrow) vectorized::VMysqlResultWriter(
81+
_sender, _output_vexpr_ctxs, custom_profile(), state->mysql_row_binary_format()));
8782
break;
8883
}
8984
case TResultSinkType::ARROW_FLIGHT_PROTOCOL: {

be/src/service/point_query_executor.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -590,21 +590,12 @@ Status PointQueryExecutor::_output_data() {
590590
RuntimeState state;
591591
auto buffer = std::make_shared<PointQueryResultBlockBuffer>(&state);
592592
// TODO reuse mysql_writer
593-
if (_binary_row_format) {
594-
vectorized::VMysqlResultWriter<true> mysql_writer(buffer, _reusable->output_exprs(),
595-
nullptr);
596-
RETURN_IF_ERROR(mysql_writer.init(_reusable->runtime_state()));
597-
_result_block->clear_names();
598-
RETURN_IF_ERROR(mysql_writer.write(_reusable->runtime_state(), *_result_block));
599-
RETURN_IF_ERROR(serialize_block(buffer->get_block(), _response));
600-
} else {
601-
vectorized::VMysqlResultWriter<false> mysql_writer(buffer, _reusable->output_exprs(),
602-
nullptr);
603-
RETURN_IF_ERROR(mysql_writer.init(_reusable->runtime_state()));
604-
_result_block->clear_names();
605-
RETURN_IF_ERROR(mysql_writer.write(_reusable->runtime_state(), *_result_block));
606-
RETURN_IF_ERROR(serialize_block(buffer->get_block(), _response));
607-
}
593+
vectorized::VMysqlResultWriter mysql_writer(buffer, _reusable->output_exprs(), nullptr,
594+
_binary_row_format);
595+
RETURN_IF_ERROR(mysql_writer.init(_reusable->runtime_state()));
596+
_result_block->clear_names();
597+
RETURN_IF_ERROR(mysql_writer.write(_reusable->runtime_state(), *_result_block));
598+
RETURN_IF_ERROR(serialize_block(buffer->get_block(), _response));
608599
VLOG_DEBUG << "dump block " << _result_block->dump_data();
609600
} else {
610601
_response->set_empty_batch(true);

be/src/vec/data_types/serde/data_type_array_serde.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ Status DataTypeArraySerDe::read_column_from_arrow(IColumn& column, const arrow::
349349

350350
Status DataTypeArraySerDe::write_column_to_mysql_binary(const IColumn& column,
351351
MysqlRowBinaryBuffer& result,
352-
int64_t row_idx_of_mysql, bool col_const,
353-
const FormatOptions& options) const {
352+
int64_t row_idx_of_mysql,
353+
bool col_const) const {
354354
return Status::NotSupported("Array type does not support write to mysql binary format");
355355
}
356356

be/src/vec/data_types/serde/data_type_array_serde.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ class DataTypeArraySerDe : public DataTypeSerDe {
9191
int64_t end, const cctz::time_zone& ctz) const override;
9292

9393
Status write_column_to_mysql_binary(const IColumn& column, MysqlRowBinaryBuffer& row_buffer,
94-
int64_t row_idx, bool col_const,
95-
const FormatOptions& options) const override;
94+
int64_t row_idx, bool col_const) const override;
9695
bool write_column_to_presto_text(const IColumn& column, BufferWritable& bw,
9796
int64_t row_idx) const override;
9897

be/src/vec/data_types/serde/data_type_bitmap_serde.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ void DataTypeBitMapSerDe::read_one_cell_from_jsonb(IColumn& column, const JsonbV
152152

153153
Status DataTypeBitMapSerDe::write_column_to_mysql_binary(const IColumn& column,
154154
MysqlRowBinaryBuffer& result,
155-
int64_t row_idx, bool col_const,
156-
const FormatOptions& options) const {
155+
int64_t row_idx, bool col_const) const {
157156
return Status::NotSupported("Bitmap type does not support write to mysql binary format");
158157
}
159158

be/src/vec/data_types/serde/data_type_bitmap_serde.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ class DataTypeBitMapSerDe : public DataTypeSerDe {
7272
}
7373

7474
Status write_column_to_mysql_binary(const IColumn& column, MysqlRowBinaryBuffer& row_buffer,
75-
int64_t row_idx, bool col_const,
76-
const FormatOptions& options) const override;
75+
int64_t row_idx, bool col_const) const override;
7776

7877
bool write_column_to_mysql_text(const IColumn& column, BufferWritable& bw,
7978
int64_t row_idx) const override;

be/src/vec/data_types/serde/data_type_date_or_datetime_serde.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -251,28 +251,16 @@ Status DataTypeDateSerDe<T>::read_column_from_arrow(IColumn& column,
251251
}
252252

253253
template <PrimitiveType T>
254-
Status DataTypeDateSerDe<T>::write_column_to_mysql_binary(
255-
const IColumn& column, MysqlRowBinaryBuffer& result, int64_t row_idx, bool col_const,
256-
const typename DataTypeNumberSerDe<T>::FormatOptions& options) const {
254+
Status DataTypeDateSerDe<T>::write_column_to_mysql_binary(const IColumn& column,
255+
MysqlRowBinaryBuffer& result,
256+
int64_t row_idx, bool col_const) const {
257257
const auto& data = assert_cast<const ColumnVector<T>&>(column).get_data();
258258
const auto col_index = index_check_const(row_idx, col_const);
259259
auto time_num = data[col_index];
260260
VecDateTimeValue time_val = binary_cast<Int64, VecDateTimeValue>(time_num);
261-
// _nesting_level >= 2 means this datetimev2 is in complex type
262-
// and we should add double quotes
263-
if (DataTypeNumberSerDe<T>::_nesting_level >= 2 && options.wrapper_len > 0) {
264-
if (UNLIKELY(0 != result.push_string(options.nested_string_wrapper, options.wrapper_len))) {
265-
return Status::InternalError("pack mysql buffer failed.");
266-
}
267-
}
268261
if (UNLIKELY(0 != result.push_vec_datetime(time_val))) {
269262
return Status::InternalError("pack mysql buffer failed.");
270263
}
271-
if (DataTypeNumberSerDe<T>::_nesting_level >= 2 && options.wrapper_len > 0) {
272-
if (UNLIKELY(0 != result.push_string(options.nested_string_wrapper, options.wrapper_len))) {
273-
return Status::InternalError("pack mysql buffer failed.");
274-
}
275-
}
276264
return Status::OK();
277265
}
278266

be/src/vec/data_types/serde/data_type_date_or_datetime_serde.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,8 @@ class DataTypeDateSerDe : public DataTypeNumberSerDe<T> {
104104
const cctz::time_zone& ctz) const override;
105105
Status read_column_from_arrow(IColumn& column, const arrow::Array* arrow_array, int64_t start,
106106
int64_t end, const cctz::time_zone& ctz) const override;
107-
Status write_column_to_mysql_binary(
108-
const IColumn& column, MysqlRowBinaryBuffer& row_buffer, int64_t row_idx,
109-
bool col_const,
110-
const typename DataTypeNumberSerDe<T>::FormatOptions& options) const override;
107+
Status write_column_to_mysql_binary(const IColumn& column, MysqlRowBinaryBuffer& row_buffer,
108+
int64_t row_idx, bool col_const) const override;
111109

112110
Status write_column_to_orc(const std::string& timezone, const IColumn& column,
113111
const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch,

be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -426,27 +426,15 @@ Status DataTypeDateTimeV2SerDe::read_column_from_arrow(IColumn& column,
426426

427427
Status DataTypeDateTimeV2SerDe::write_column_to_mysql_binary(const IColumn& column,
428428
MysqlRowBinaryBuffer& result,
429-
int64_t row_idx, bool col_const,
430-
const FormatOptions& options) const {
429+
int64_t row_idx,
430+
bool col_const) const {
431431
const auto& data = assert_cast<const ColumnDateTimeV2&>(column).get_data();
432432
const auto col_index = index_check_const(row_idx, col_const);
433433
DateV2Value<DateTimeV2ValueType> date_val =
434434
binary_cast<UInt64, DateV2Value<DateTimeV2ValueType>>(data[col_index]);
435-
// _nesting_level >= 2 means this datetimev2 is in complex type
436-
// and we should add double quotes
437-
if (_nesting_level >= 2 && options.wrapper_len > 0) {
438-
if (UNLIKELY(0 != result.push_string(options.nested_string_wrapper, options.wrapper_len))) {
439-
return Status::InternalError("pack mysql buffer failed.");
440-
}
441-
}
442435
if (UNLIKELY(0 != result.push_vec_datetime(date_val, _scale))) {
443436
return Status::InternalError("pack mysql buffer failed.");
444437
}
445-
if (_nesting_level >= 2 && options.wrapper_len > 0) {
446-
if (UNLIKELY(0 != result.push_string(options.nested_string_wrapper, options.wrapper_len))) {
447-
return Status::InternalError("pack mysql buffer failed.");
448-
}
449-
}
450438
return Status::OK();
451439
}
452440

be/src/vec/data_types/serde/data_type_datetimev2_serde.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ class DataTypeDateTimeV2SerDe : public DataTypeNumberSerDe<PrimitiveType::TYPE_D
9090
int64_t end, const cctz::time_zone& ctz) const override;
9191

9292
Status write_column_to_mysql_binary(const IColumn& column, MysqlRowBinaryBuffer& row_buffer,
93-
int64_t row_idx, bool col_const,
94-
const FormatOptions& options) const override;
93+
int64_t row_idx, bool col_const) const override;
9594

9695
Status write_column_to_orc(const std::string& timezone, const IColumn& column,
9796
const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch,

0 commit comments

Comments
 (0)