Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions be/src/vec/data_types/serde/data_type_array_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ Status DataTypeArraySerDe::_write_column_to_mysql(const IColumn& column,
const auto end_arr_element = offsets[row_idx_of_col_arr];
for (int j = begin_arr_element; j < end_arr_element; ++j) {
if (j != begin_arr_element) {
if (0 != result.push_string(options.mysql_collection_delim.c_str(),
options.mysql_collection_delim.size())) {
if (0 != result.push_string(", ", 2)) {
return Status::InternalError("pack mysql buffer failed.");
}
}
Expand All @@ -346,7 +345,6 @@ Status DataTypeArraySerDe::_write_column_to_mysql(const IColumn& column,
return Status::InternalError("pack mysql buffer failed.");
}
} else {
++options.level;
if (is_nested_string && options.wrapper_len > 0) {
if (0 != result.push_string(options.nested_string_wrapper, options.wrapper_len)) {
return Status::InternalError("pack mysql buffer failed.");
Expand All @@ -360,7 +358,6 @@ Status DataTypeArraySerDe::_write_column_to_mysql(const IColumn& column,
RETURN_IF_ERROR(
nested_serde->write_column_to_mysql(data, result, j, false, options));
}
--options.level;
}
}
if (0 != result.push_string("]", 1)) {
Expand Down
7 changes: 1 addition & 6 deletions be/src/vec/data_types/serde/data_type_map_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,7 @@ Status DataTypeMapSerDe::_write_column_to_mysql(const IColumn& column,
auto& offsets = map_column.get_offsets();
for (auto j = offsets[col_index - 1]; j < offsets[col_index]; ++j) {
if (j != offsets[col_index - 1]) {
if (0 != result.push_string(options.mysql_collection_delim.c_str(),
options.mysql_collection_delim.size())) {
if (0 != result.push_string(", ", 2)) {
return Status::InternalError("pack mysql buffer failed.");
}
}
Expand All @@ -428,7 +427,6 @@ Status DataTypeMapSerDe::_write_column_to_mysql(const IColumn& column,
return Status::InternalError("pack mysql buffer failed.");
}
} else {
++options.level;
if (is_key_string && options.wrapper_len > 0) {
if (0 != result.push_string(options.nested_string_wrapper, options.wrapper_len)) {
return Status::InternalError("pack mysql buffer failed.");
Expand All @@ -442,7 +440,6 @@ Status DataTypeMapSerDe::_write_column_to_mysql(const IColumn& column,
RETURN_IF_ERROR(key_serde->write_column_to_mysql(nested_keys_column, result, j,
false, options));
}
--options.level;
}
if (0 != result.push_string(&options.map_key_delim, 1)) {
return Status::InternalError("pack mysql buffer failed.");
Expand All @@ -452,7 +449,6 @@ Status DataTypeMapSerDe::_write_column_to_mysql(const IColumn& column,
return Status::InternalError("pack mysql buffer failed.");
}
} else {
++options.level;
if (is_val_string && options.wrapper_len > 0) {
if (0 != result.push_string(options.nested_string_wrapper, options.wrapper_len)) {
return Status::InternalError("pack mysql buffer failed.");
Expand All @@ -466,7 +462,6 @@ Status DataTypeMapSerDe::_write_column_to_mysql(const IColumn& column,
RETURN_IF_ERROR(value_serde->write_column_to_mysql(nested_values_column, result, j,
false, options));
}
--options.level;
}
}
if (0 != result.push_string("}", 1)) {
Expand Down
9 changes: 1 addition & 8 deletions be/src/vec/data_types/serde/data_type_number_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,8 @@ Status DataTypeNumberSerDe<T>::_write_column_to_mysql(const IColumn& column,
int buf_ret = 0;
auto& data = assert_cast<const ColumnType&>(column).get_data();
const auto col_index = index_check_const(row_idx, col_const);
if constexpr (std::is_same_v<T, Int8>) {
if constexpr (std::is_same_v<T, Int8> || std::is_same_v<T, UInt8>) {
buf_ret = result.push_tinyint(data[col_index]);
} else if constexpr (std::is_same_v<T, UInt8>) {
if (options.level > 0 && !options.is_bool_value_num) {
std::string bool_value = data[col_index] ? "true" : "false";
result.push_string(bool_value.c_str(), bool_value.size());
} else {
buf_ret = result.push_tinyint(data[col_index]);
}
} else if constexpr (std::is_same_v<T, Int16> || std::is_same_v<T, UInt16>) {
buf_ret = result.push_smallint(data[col_index]);
} else if constexpr (std::is_same_v<T, Int32> || std::is_same_v<T, UInt32>) {
Expand Down
20 changes: 0 additions & 20 deletions be/src/vec/data_types/serde/data_type_serde.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,26 +165,6 @@ class DataTypeSerDe {
const char* nested_string_wrapper;
int wrapper_len;

/**
* mysql_collection_delim is used to separate elements in collection, such as array, map, struct
* It is used to write to mysql.
*/
std::string mysql_collection_delim = ", ";

/**
* is_bool_value_num is used to display bool value in collection, such as array, map, struct
* eg, if set to true, the array<true> will be:
* [1]
* if set to false, the array<true> will be:
* [true]
*/
bool is_bool_value_num = true;

/**
* Indicate the nested level of column. It is used to control some behavior of serde
*/
mutable int level = 0;

[[nodiscard]] char get_collection_delimiter(
int hive_text_complex_type_delimiter_level) const {
CHECK(0 <= hive_text_complex_type_delimiter_level &&
Expand Down
5 changes: 1 addition & 4 deletions be/src/vec/data_types/serde/data_type_struct_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,7 @@ Status DataTypeStructSerDe::_write_column_to_mysql(const IColumn& column,
bool begin = true;
for (size_t j = 0; j < elem_serdes_ptrs.size(); ++j) {
if (!begin) {
if (0 != result.push_string(options.mysql_collection_delim.c_str(),
options.mysql_collection_delim.size())) {
if (0 != result.push_string(", ", 2)) {
return Status::InternalError("pack mysql buffer failed.");
}
}
Expand All @@ -373,7 +372,6 @@ Status DataTypeStructSerDe::_write_column_to_mysql(const IColumn& column,
return Status::InternalError("pack mysql buffer failed.");
}
} else {
++options.level;
if (remove_nullable(col.get_column_ptr(j))->is_column_string() &&
options.wrapper_len > 0) {
if (0 != result.push_string(options.nested_string_wrapper, options.wrapper_len)) {
Expand All @@ -388,7 +386,6 @@ Status DataTypeStructSerDe::_write_column_to_mysql(const IColumn& column,
RETURN_IF_ERROR(elem_serdes_ptrs[j]->write_column_to_mysql(
col.get_column(j), result, col_index, false, options));
}
--options.level;
}
begin = false;
}
Expand Down
16 changes: 0 additions & 16 deletions be/src/vec/sink/vmysql_result_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ Status VMysqlResultWriter<is_binary_format>::_set_options(
_options.map_key_delim = ':';
_options.null_format = "null";
_options.null_len = 4;
_options.mysql_collection_delim = ", ";
_options.is_bool_value_num = true;
break;
case TSerdeDialect::PRESTO:
// eg:
Expand All @@ -135,20 +133,6 @@ Status VMysqlResultWriter<is_binary_format>::_set_options(
_options.map_key_delim = '=';
_options.null_format = "NULL";
_options.null_len = 4;
_options.mysql_collection_delim = ", ";
_options.is_bool_value_num = true;
break;
case TSerdeDialect::HIVE:
// eg:
// array: ["abc","def","",null]
// map: {"k1":null,"k2":"v3"}
_options.nested_string_wrapper = "\"";
_options.wrapper_len = 1;
_options.map_key_delim = ':';
_options.null_format = "null";
_options.null_len = 4;
_options.mysql_collection_delim = ",";
_options.is_bool_value_num = false;
break;
default:
return Status::InternalError("unknown serde dialect: {}", serde_dialect);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ private void setFormatOptions() {
statementContext.setFormatOptions(FormatOptions.getForPresto());
break;
case "doris":
case "hive":
statementContext.setFormatOptions(FormatOptions.getDefault());
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4348,11 +4348,9 @@ public void checkSerdeDialect(String serdeDialect) {
throw new UnsupportedOperationException("serdeDialect value is empty");
}

if (!serdeDialect.equalsIgnoreCase("doris")
&& !serdeDialect.equalsIgnoreCase("presto")
&& !serdeDialect.equalsIgnoreCase("trino")
&& !serdeDialect.equalsIgnoreCase("hive")) {
LOG.warn("serde dialect value is invalid, the invalid value is {}", serdeDialect);
if (!serdeDialect.equalsIgnoreCase("doris") && !serdeDialect.equalsIgnoreCase("presto")
&& !serdeDialect.equalsIgnoreCase("trino")) {
LOG.warn("serdeDialect value is invalid, the invalid value is {}", serdeDialect);
throw new UnsupportedOperationException(
"sqlDialect value is invalid, the invalid value is " + serdeDialect);
}
Expand Down Expand Up @@ -4514,8 +4512,6 @@ public TSerdeDialect getSerdeDialect() {
case "presto":
case "trino":
return TSerdeDialect.PRESTO;
case "hive":
return TSerdeDialect.HIVE;
default:
throw new IllegalArgumentException("Unknown serde dialect: " + serdeDialect);
}
Expand Down
3 changes: 1 addition & 2 deletions gensrc/thrift/PaloInternalService.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ struct TResourceLimit {

enum TSerdeDialect {
DORIS = 0,
PRESTO = 1,
HIVE = 2
PRESTO = 1
}

// Query options that correspond to PaloService.PaloQueryOptions,
Expand Down

This file was deleted.

This file was deleted.

Loading