-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Added #4897: Add table_privileges, schema_privileges and user_privile… #4899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| .column("GRANTEE", ScalarType.createVarchar(NAME_CHAR_LEN)) | ||
| .column("TABLE_CATALOG", ScalarType.createVarchar(FN_REFLEN)) | ||
| .column("TABLE_SCHEMA", ScalarType.createVarchar(NAME_CHAR_LEN)) | ||
| .column("PRIVILEGE_TYPE", ScalarType.createVarchar(64)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a constant variables like 'PRIVILEGE_TYPE_LEN' is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
|
|
||
| String grantee = new String("\'").concat(ClusterNamespace.getNameFromFullName(tblPrivEntry.getOrigUser())) | ||
| .concat("\'@\'").concat(tblPrivEntry.getOrigHost()).concat("\'"); | ||
| String isGrantable = tblPrivEntry.getPrivSet().get(2) ? "yes" : "no"; //Grant_priv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are word of yes or no case sensitive ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use uppercase, I will modify it.
| } | ||
| TPrivilegeStatus status = new TPrivilegeStatus(); | ||
| status.setTableName(tblName); | ||
| status.setPrivilegeType(privilegesInMysql[paloPriv.getIdx()]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a map is better? such as <PaloPrivilege, String> ?
|
Could you please add some description about this pr? |
…rivileges table in information_schema database.
…r_privileges to the information_schema database (apache#4897) to improve compatibility with the mysql
| // set all bit to not null | ||
| memset((void *)tuple, 0, _tuple_desc->num_null_bytes()); | ||
| const TPrivilegeStatus& tbl_priv_status = _priv_result.privileges[_priv_index]; | ||
| // grantee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
void *slot = tuple->get_slot(_tuple_desc->slots()[0]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
const std::string* src = &tbl_priv_status.grantee;
str_slot->len = src->length();
str_slot->ptr = (char *)pool->allocate(str_slot->len);
if (NULL == str_slot->ptr) {
return Status::InternalError("Allocate memcpy failed.");
}
memcpy(str_slot->ptr, src->c_str(), str_slot->len);
}
This kind of code block is used everywhere, I think we can extract a common method for it.
EmmyMiao87
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…r_privileges to the information_schema database (apache#4897) to improve compatibility with the mysql
morningman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ges table in information_schema database.
Proposed changes
Add table_privileges, schema_privileges and user_privileges table in information_schema database.
Types of changes
What types of changes does your code introduce to Doris?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...