-
Notifications
You must be signed in to change notification settings - Fork 392
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
[#2572] feat(catalog-jdbc-doris): support table operation for Doris catalog #2875
Conversation
ef4c770
to
1c26f1e
Compare
...est/java/com/datastrato/gravitino/catalog/doris/integration/test/DorisTableOperationsIT.java
Outdated
Show resolved
Hide resolved
...doris/src/main/java/com/datastrato/gravitino/catalog/doris/converter/DorisTypeConverter.java
Show resolved
Hide resolved
} | ||
|
||
@Override | ||
protected String generatePurgeTableSql(String tableName) { | ||
throw new UnsupportedOperationException(); | ||
return String.format("TRUNCATE TABLE `%s`", tableName); |
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.
TRUNCATE TABLE
in Doris means dropping all data in the table and retaining the table itself, does it align with our definition of purgeTable
@mchades Please help to confirm 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.
Here should be: truncate + drop = purge
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.
https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/PURGE.html
https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/DROP-TABLE.html
@mchades I have a little question, what is the exact semantics : PURGE TABLE xx
or DROP TABLE xxx PURGE
Seems there is a little diffrent
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.
- dropTable removes both the metadata and the directory associated with the table from the file system if the table is not an external table. In case of an external table, only the associated metadata is removed.
- purgeTable completely removes both the metadata and the directory associated with the table and skipping trash, if the table is an external table or the catalogs don't support purge table, UnsupportedOperationException is thrown.
For more, please see: https://github.com/datastrato/gravitino/blob/9128db0d2f4bc57dbfb410b51db17887e335cba4/docs/manage-relational-metadata-using-gravitino.md?plain=1#L876C1-L881C127
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.
Got it. Thank you very much !
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 had update the code, throw a UnsupportedOperationException in purge Doris table
@zhoukangcn |
1f9a417
to
07291f7
Compare
b833b8d
to
3bbbb24
Compare
f635302
to
6f6a8a4
Compare
...ris/src/main/java/com/datastrato/gravitino/catalog/doris/operation/DorisTableOperations.java
Show resolved
Hide resolved
83de756
to
1d29b15
Compare
@FANNG1 |
...ris/src/main/java/com/datastrato/gravitino/catalog/doris/operation/DorisTableOperations.java
Show resolved
Hide resolved
preparedStatement.setString(2, tableName); | ||
|
||
try (ResultSet resultSet = preparedStatement.executeQuery()) { | ||
while (resultSet.next()) { |
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 it possible to retrive multi comments?
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.
Mostly resultSet just returns one line, but I think it's necessary to iterate through the resultSet.
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 seems a bug if geting more than one line?
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 can't temporarily construct a multi-line test case, but using a while loop here to ensure all resultSets are read seems to pose no problem.
...est/java/com/datastrato/gravitino/catalog/doris/integration/test/DorisTableOperationsIT.java
Show resolved
Hide resolved
...est/java/com/datastrato/gravitino/catalog/doris/integration/test/DorisTableOperationsIT.java
Show resolved
Hide resolved
LGTM except one minor 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, besides, about Index, distribution, partitioning, do forget to create related issues.
@zhoukangcn merged to main, thanks for your work! |
What changes were proposed in this pull request?
support doris table operation
Why are the changes needed?
Fix: #2572
Does this PR introduce any user-facing change?
N/A
How was this patch tested?
UT