-
Notifications
You must be signed in to change notification settings - Fork 601
[#3302][Sub-Task] StarRocks catalog Table/DB ops #7738
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
1e348dc
to
7dd5eff
Compare
7dd5eff
to
66179d7
Compare
Hi @yuqi1129 I finished the first version and has tested it in my local desktop. PTAL when you have time. |
I see, and we will take the time to review it, Thanks. |
@liunaijie |
b0cc82f
to
ebceb59
Compare
} | ||
|
||
@Override | ||
protected boolean supportSchemaComment() { | ||
return true; | ||
return false; |
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.
Why not support schema comment since it can be added to PROPERTIES as in Doris
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.
it can be added, but the SHOW CREATE DATABASE xxx
can't return the properties. So I am set it to false
|
||
private static final Pattern DISTRIBUTION_INFO_PATTERN = | ||
Pattern.compile( | ||
"DISTRIBUTED BY\\s+(HASH|RANDOM)\\s*(\\(([^)]+)\\))?\\s*(BUCKETS\\s+(\\d+|AUTO))?"); |
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.
StarRocks don't have auto keyword
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.
+1, but it seems that he has modified it in StarRocksUtils#extractBucketNum
.
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.
StarRocks don't have auto keyword
Done, has deleted
@@ -65,7 +66,7 @@ public class JdbcConfig extends Config { | |||
.doc("The password of the Jdbc connection") | |||
.version(ConfigConstants.VERSION_0_3_0) | |||
.stringConf() | |||
.checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG) | |||
.checkValue(Objects::nonNull, ConfigConstants.NOT_BLANK_ERROR_MSG) |
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.
Why do you change it?
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.
This is because the StarRocks jdbc password is empty string. When I set the password to empty string in StarRocksContainer
. This Config check is fail due to it's blank.
Due to this I am also update here [Config.java](https://github.com/apache/gravitino/pull/7738/files#diff-8918f298792aac4b08036dbde485791e97628dd67d399cb1d2dc0b7a6e7f4a55)
In here it will filter the empty config value. but retaining empty values may be necessary for some use cases.
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.
When I set the password to empty string in StarRocksContainer. This Config check is fail due to it's blank.
Why do you set the password to an empty string? I believe an empty string is not common used in production environment.
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.
By default the StarRocks root user's password is empty string.
I think this empty value check is not necessary, For example if I want use gravitino to connect my dev mysql. the password is empty string, Then it can't be connect.
|
||
private static final Pattern DISTRIBUTION_INFO_PATTERN = | ||
Pattern.compile( | ||
"DISTRIBUTED BY\\s+(HASH|RANDOM)\\s*(\\(([^)]+)\\))?\\s*(BUCKETS\\s+(\\d+|AUTO))?"); |
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.
+1, but it seems that he has modified it in StarRocksUtils#extractBucketNum
.
@@ -33,7 +33,7 @@ public class TestDorisDatabaseOperations extends TestDoris { | |||
@Test | |||
public void testBaseOperationDatabase() { | |||
String databaseName = RandomNameUtils.genRandomName("it_db"); | |||
String comment = "comment"; | |||
String 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.
fault change, will revert
static final int CODE_TABLE_EXISTS = 1050; | ||
static final int CODE_DATABASE_NOT_EXISTS = 1008; | ||
static final int CODE_UNKNOWN_DATABASE = 1049; | ||
static final int CODE_UNKNOWN_DATABASE_2 = 5501; | ||
static final int CODE_NO_SUCH_TABLE = 1051; | ||
static final int CODE_NO_SUCH_TABLE_2 = 5502; | ||
static final int CODE_UNAUTHORIZED = 1045; | ||
static final int CODE_NO_SUCH_COLUMN = 1054; | ||
static final int CODE_OTHER = 1105; | ||
static final int CODE_DELETE_NON_EXISTING_PARTITION = 1507; | ||
static final int CODE_PARTITION_ALREADY_EXISTS = 1517; |
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.
Please check the error code carefully; there are some differences.
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.
For example, CODE_NO_SUCH_TABLE_2
does not exist in StarRocks
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.
The CODE_UNKNOWN_DATABASE_2
, CODE_NO_SUCH_TABLE_2
is added when I run E2E test.
Because I find the error is not match with offical document.
private static final Pattern DATABASE_NOT_EXISTS_PATTERN = | ||
Pattern.compile(DATABASE_NOT_EXISTS_PATTERN_STRING); | ||
|
||
private static final String UNKNOWN_DATABASE_PATTERN_STRING = |
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.
Please code check the error template.
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.
Sorry, I didn't quite get that - could you rephrase?
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.
I mean the error message may not be .*?detailMessage = Unknown database '.*?'
if the database does not exists. I have briefly reviewed the message and noticed some minor differences between these two databases.
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.
I see, will update
@liunaijie
|
sure |
6ecd2c4
to
a1846e0
Compare
Done. In this PR, I've only included code changes related to table/database operations. I'll submit separate PRs for the remaining commits. |
Great work!!!, I'm going to review it today. |
static final String ARRAY = "array"; | ||
static final String JSON = "json"; | ||
static final String MAP = "map"; | ||
static final String STRUCT = "struct"; | ||
|
||
static final String BITMAP = "bitmap"; | ||
static final String HLL = "hll"; | ||
|
||
static final String BIT = "BIT"; |
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 these types not yet supported?
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.
Yes, those type are not supported for now.
Because JdbcTypeBean
doesn't have element type
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.
I see.
List<TableChange.SetProperty> setProperties = new ArrayList<>(); | ||
for (int i = 0; i < changes.length; i++) { | ||
TableChange change = changes[i]; | ||
if (change instanceof TableChange.AddColumn) { |
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.
Is SetProperty
not supported for StarRocks?
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.
It have limited support. I miss some code.
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.
Do we need check by gravitino or just send to starrocks and let starrocks throw exception.
If we implement either a whitelist or property size validation here, the code will require corresponding updates with each StarRocks release
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.
If we implement either a whitelist or property size validation here, the code will require corresponding updates with each StarRocks release
We can only support 3.3.x here and add some comments about limited support for other versions.
do we need check by gravitino or just send to starrocks and let starrocks throw exception
I believe this is reasonable, and that is the point where it differs from Doris.
a1846e0
to
d9a2e72
Compare
It's generally LGTM, @taylor12805 |
LGTM |
@mchades |
you guys can go ahead |
@liunaijie
It seems that there is a lack of PR regarding the documents. |
### What changes were proposed in this pull request? add StarRocks Catalog Implement ### Why are the changes needed? To support StarRocks Catalog. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? By E2E test, the test is in another pr apache#7792
### What changes were proposed in this pull request? add StarRocks Catalog Implement ### Why are the changes needed? To support StarRocks Catalog. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? By E2E test, the test is in another pr apache#7792
### What changes were proposed in this pull request? add StarRocks Catalog Implement ### Why are the changes needed? To support StarRocks Catalog. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? By E2E test, the test is in another pr apache#7792
### What changes were proposed in this pull request? add StarRocks Catalog Implement ### Why are the changes needed? To support StarRocks Catalog. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? By E2E test, the test is in another pr apache#7792
### What changes were proposed in this pull request? add StarRocks Catalog Implement ### Why are the changes needed? To support StarRocks Catalog. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? By E2E test, the test is in another pr #7792
What changes were proposed in this pull request?
add StarRocks Catalog Implement
Why are the changes needed?
To support StarRocks Catalog.
Does this PR introduce any user-facing change?
No
How was this patch tested?
By E2E test, the test is in another pr
#7792