Skip to content

Conversation

@pengxiangyu
Copy link
Contributor

Proposed changes

Fix bug #4777:Error happened when open a view in DBeaver

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] Documentation Update (if none of the other choices apply)
  • [] Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in 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.

  • I have create an issue on (Fix Error happened when open a view in DBeaver  #4777), and have described the bug/feature there in detail
  • [] Compiling and unit tests pass locally with my changes
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] If this change need a document change, I have updated the document
  • [] Any dependent changes have been merged

Further comments

Fix bug #4777

@imay
Copy link
Contributor

imay commented Oct 22, 2020

It is best to talk about the cause of the problem and the idea of PR change.
This will allow others to better review the code

// table(view)'s comment
protected String comment = "";

protected String ddlSql = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment for this new field

if (NULL == str_slot->ptr) {
return Status::InternalError("Allocate memcpy failed.");
}
memcpy(str_slot->ptr, definer.c_str(), str_slot->len);
Copy link
Member

@yangzhg yangzhg Oct 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

length always 6 and definer always "root@%" ? why ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is column for table views in mysql, palo has no this information, we can only set a default one

.column("CHECK_OPTION", ScalarType.createVarchar(8))
.column("IS_UPDATABLE", ScalarType.createVarchar(3))
.column("DEFINER", ScalarType.createVarchar(77))
.column("SECURITY_TYPE", ScalarType.createVarchar(7))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this column length is 77, you should add a comment, this column in mysql is 288

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you get another version of mysql. the sql I got is like this.

.column("DEFINER", ScalarType.createVarchar(77))
.column("SECURITY_TYPE", ScalarType.createVarchar(7))
.column("CHARACTER_SET_CLIENT", ScalarType.createVarchar(32))
.column("COLLATION_CONNECTION", ScalarType.createVarchar(32))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 32

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the sql I got is like this.

default:
tables = db.getTables();
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
List<Table> tables = db.getTables();
if (params.isSetType() && "VIEW".equals(params.getType())) {
tables = db. getViews();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If type is view, this will call getTables() which is not required. When the count of tables in this db is too many, this will take more time.

yangzhg
yangzhg previously approved these changes Oct 27, 2020
Copy link
Member

@yangzhg yangzhg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@morningman morningman added area/mysql-compatibility Issues or PRs related to the mysql compatibility kind/improvement labels Oct 28, 2020
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman merged commit 44498a1 into apache:master Oct 30, 2020
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
@pengxiangyu pengxiangyu deleted the dbeaver branch July 6, 2021 02:54
w41ter pushed a commit to w41ter/incubator-doris that referenced this pull request Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/mysql-compatibility Issues or PRs related to the mysql compatibility good first issue kind/improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error happened when open a view in DBeaver

4 participants