Skip to content

Conversation

liunaijie
Copy link
Member

@liunaijie liunaijie commented Jul 16, 2025

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

@liunaijie liunaijie force-pushed the feature/catalog_sr branch from 1e348dc to 7dd5eff Compare July 21, 2025 09:28
@liunaijie liunaijie changed the title [WIP] [3302] Feature: Supports StarRocks catalog [#3302] Feature: Supports StarRocks catalog Jul 21, 2025
@liunaijie liunaijie marked this pull request as ready for review July 21, 2025 09:28
@liunaijie liunaijie force-pushed the feature/catalog_sr branch from 7dd5eff to 66179d7 Compare July 21, 2025 09:29
@liunaijie
Copy link
Member Author

Hi @yuqi1129 I finished the first version and has tested it in my local desktop. PTAL when you have time.
looking forward to your feedback.

@yuqi1129
Copy link
Contributor

Hi @yuqi1129 I finished the first version and has tested it in my local desktop. PTAL when you have time. looking forward to your feedback.

I see, and we will take the time to review it, Thanks.

@yuqi1129
Copy link
Contributor

@liunaijie
The PR for StarRocks catalog skeleton has been merged. Please update the code.

}

@Override
protected boolean supportSchemaComment() {
return true;
return false;
Copy link
Contributor

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

Copy link
Member Author

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))?");
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Member Author

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)
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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))?");
Copy link
Contributor

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 = "";
Copy link
Member Author

Choose a reason for hiding this comment

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

fault change, will revert

Comment on lines 41 to 49
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;
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Member Author

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 =
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, will update

@yuqi1129
Copy link
Contributor

@liunaijie
Could you split this PR into several small ones, it hard to review such a big PR. You can split it into

  • table/data operation and UT
  • partition operations and UT
  • ITs

@liunaijie
Copy link
Member Author

@liunaijie Could you split this PR into several small ones, it hard to review such a big PR. You can split it into

  • table/data operation and UT
  • partition operations and UT
  • ITs

sure

@liunaijie liunaijie force-pushed the feature/catalog_sr branch from 6ecd2c4 to a1846e0 Compare July 24, 2025 03:04
@liunaijie liunaijie changed the title [#3302] Feature: Supports StarRocks catalog [#3302][Sub-Task] StarRocks catalog Table/DB ops Jul 24, 2025
@liunaijie
Copy link
Member Author

@liunaijie Could you split this PR into several small ones, it hard to review such a big PR. You can split it into

  • table/data operation and UT
  • partition operations and UT
  • ITs

Done. In this PR, I've only included code changes related to table/database operations. I'll submit separate PRs for the remaining commits.

@yuqi1129
Copy link
Contributor

@liunaijie Could you split this PR into several small ones, it hard to review such a big PR. You can split it into

  • table/data operation and UT
  • partition operations and UT
  • ITs

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.

Comment on lines +47 to +55
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";
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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) {
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Member Author

@liunaijie liunaijie Jul 24, 2025

Choose a reason for hiding this comment

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

image StarRocks only support alert those properties, and it recommand only update 1 properties by 1 time.

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

Copy link
Contributor

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.

@liunaijie liunaijie force-pushed the feature/catalog_sr branch from a1846e0 to d9a2e72 Compare July 25, 2025 02:36
@yuqi1129
Copy link
Contributor

It's generally LGTM, @taylor12805
Do you have any further comments?

@taylor12805
Copy link
Contributor

It's generally LGTM, @taylor12805 Do you have any further comments?

LGTM

@yuqi1129
Copy link
Contributor

@mchades
Would you like to take a look?

@mchades
Copy link
Contributor

mchades commented Jul 28, 2025

@mchades Would you like to take a look?

you guys can go ahead

@yuqi1129 yuqi1129 merged commit 71936c8 into apache:main Jul 28, 2025
30 checks passed
@yuqi1129 yuqi1129 added the 1.0.0 Release v1.0.0 label Jul 28, 2025
@yuqi1129
Copy link
Contributor

@liunaijie
Thanks for you contribuiton. You are welcome to proceed. I believe the rest of the work would be

  • Partition operations
  • ITs
  • Related docs

It seems that there is a lack of PR regarding the documents.

jerqi pushed a commit to qqqttt123/gravitino that referenced this pull request Jul 30, 2025
### 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
tsungchih pushed a commit to tsungchih/gravitino that referenced this pull request Aug 2, 2025
### 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
yuqi1129 pushed a commit to yuqi1129/gravitino that referenced this pull request Aug 15, 2025
### 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
yuqi1129 pushed a commit to yuqi1129/gravitino that referenced this pull request Aug 18, 2025
### 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
jerryshao pushed a commit that referenced this pull request Aug 18, 2025
### 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0.0 Release v1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants