github-actions[bot] commented on code in PR #33058: URL: https://github.com/apache/doris/pull/33058#discussion_r1544635818
########## be/src/exec/schema_scanner/schema_helper.h: ########## @@ -82,6 +84,8 @@ class SchemaHelper { static Status show_process_list(const std::string& ip, const int32_t port, const TShowProcessListRequest& request, TShowProcessListResult* result); + static Status show_user(const std::string& ip, const int32_t port, Review Comment: warning: parameter 'port' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls] ```suggestion static Status show_user(const std::string& ip, int32_t port, ``` ########## be/src/exec/schema_scanner/schema_user_scanner.cpp: ########## @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include "exec/schema_scanner/schema_user_scanner.h" + +#include <gen_cpp/FrontendService_types.h> + +#include <vector> + +#include "exec/schema_scanner/schema_helper.h" +#include "runtime/runtime_state.h" +#include "vec/common/string_ref.h" +#include "vec/core/block.h" +#include "vec/data_types/data_type_factory.hpp" + +namespace doris { + +std::vector<SchemaScanner::ColumnDesc> SchemaUserScanner::_s_user_columns = { + {"Host", TYPE_CHAR, sizeof(StringRef), false}, + {"User", TYPE_CHAR, sizeof(StringRef), false}, + {"Node_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Admin_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Grant_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Select_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Load_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Alter_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Create_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Drop_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Usage_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Show_view_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Cluster_usage_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Stage_usage_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"ssl_type", TYPE_CHAR, sizeof(StringRef), false}, + {"ssl_cipher", TYPE_VARCHAR, sizeof(StringRef), false}, + {"x509_issuer", TYPE_VARCHAR, sizeof(StringRef), false}, + {"x509_subject", TYPE_VARCHAR, sizeof(StringRef), false}, + {"max_user_connections", TYPE_BIGINT, sizeof(int64_t), false}, + {"password_policy.expiration_seconds", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.password_creation_time", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.history_num", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.history_passwords", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.num_failed_login", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.password_lock_seconds", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.failed_login_counter", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.lock_time", TYPE_VARCHAR, sizeof(StringRef), false}}; + +SchemaUserScanner::SchemaUserScanner() + : SchemaScanner(_s_user_columns, TSchemaTableType::SCH_USER) {} + +SchemaUserScanner::~SchemaUserScanner() = default; + +Status SchemaUserScanner::start(RuntimeState* state) { + TShowUserRequest request; + RETURN_IF_ERROR(SchemaHelper::show_user(*(_param->common_param->ip), _param->common_param->port, + request, &_user_result)); + + return Status::OK(); +} + +Status SchemaUserScanner::get_next_block(vectorized::Block* block, bool* eos) { + if (!_is_init) { + return Status::InternalError("call this before initial."); + } + if (block == nullptr || eos == nullptr) { + return Status::InternalError("invalid parameter."); + } + + *eos = true; + if (_user_result.userinfo_list.empty()) { + return Status::OK(); + } + + return _fill_block_impl(block); +} + +Status SchemaUserScanner::_fill_block_impl(vectorized::Block* block) { Review Comment: warning: method '_fill_block_impl' can be made static [readability-convert-member-functions-to-static] be/src/exec/schema_scanner/schema_user_scanner.h:47: ```diff - Status _fill_block_impl(vectorized::Block* block); + static Status _fill_block_impl(vectorized::Block* block); ``` ########## be/src/exec/schema_scanner/schema_user_scanner.cpp: ########## @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include "exec/schema_scanner/schema_user_scanner.h" + +#include <gen_cpp/FrontendService_types.h> + +#include <vector> + +#include "exec/schema_scanner/schema_helper.h" +#include "runtime/runtime_state.h" +#include "vec/common/string_ref.h" +#include "vec/core/block.h" +#include "vec/data_types/data_type_factory.hpp" + +namespace doris { + +std::vector<SchemaScanner::ColumnDesc> SchemaUserScanner::_s_user_columns = { + {"Host", TYPE_CHAR, sizeof(StringRef), false}, + {"User", TYPE_CHAR, sizeof(StringRef), false}, + {"Node_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Admin_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Grant_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Select_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Load_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Alter_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Create_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Drop_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Usage_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Show_view_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Cluster_usage_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"Stage_usage_priv", TYPE_CHAR, sizeof(StringRef), false}, + {"ssl_type", TYPE_CHAR, sizeof(StringRef), false}, + {"ssl_cipher", TYPE_VARCHAR, sizeof(StringRef), false}, + {"x509_issuer", TYPE_VARCHAR, sizeof(StringRef), false}, + {"x509_subject", TYPE_VARCHAR, sizeof(StringRef), false}, + {"max_user_connections", TYPE_BIGINT, sizeof(int64_t), false}, + {"password_policy.expiration_seconds", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.password_creation_time", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.history_num", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.history_passwords", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.num_failed_login", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.password_lock_seconds", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.failed_login_counter", TYPE_VARCHAR, sizeof(StringRef), false}, + {"password_policy.lock_time", TYPE_VARCHAR, sizeof(StringRef), false}}; + +SchemaUserScanner::SchemaUserScanner() Review Comment: warning: use '= default' to define a trivial default constructor [modernize-use-equals-default] be/src/exec/schema_scanner/schema_user_scanner.cpp:61: ```diff - : SchemaScanner(_s_user_columns, TSchemaTableType::SCH_USER) {} + : SchemaScanner(_s_user_columns, TSchemaTableType::SCH_USER) = default; ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org