You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "LiuQhahah (via GitHub)" <gi...@apache.org> on 2024/08/20 15:09:21 UTC

[PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

LiuQhahah opened a new pull request, #4600:
URL: https://github.com/apache/gravitino/pull/4600

   <!--
   1. Title: [#<issue>] <type>(<scope>): <subject>
      Examples:
        - "[#123] feat(operator): support xxx"
        - "[#233] fix: check null before access result in xxx"
        - "[MINOR] refactor: fix typo in variable name"
        - "[MINOR] docs: fix typo in README"
        - "[#255] test: fix flaky test NameOfTheTest"
      Reference: https://www.conventionalcommits.org/en/v1.0.0/
   2. If the PR is unfinished, please mark this PR as draft.
   -->
   
   ### What changes were proposed in this pull request?
   
   add regex to check the style of JDBC URL instead of check not blank
   
   ### Why are the changes needed?
   
   The JDBC URL format is unique, and pre-checking the value can help prevent errors during the creation phase.
   Fix: #4591
   
   ### Does this PR introduce _any_ user-facing change?
   
   
     1. the value of jdbc-url(catalog-jdbc) will be check the JDBC URL format
   
   
   ### How was this patch tested?
   
   
     1. add the UT
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "shaofengshi (via GitHub)" <gi...@apache.org>.
shaofengshi commented on code in PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#discussion_r1864045246


##########
iceberg/iceberg-common/src/main/java/org/apache/gravitino/iceberg/common/IcebergConfig.java:
##########
@@ -64,7 +65,7 @@ public class IcebergConfig extends Config implements OverwriteDefaultConfig {
           .doc("The uri config of the Iceberg catalog")
           .version(ConfigConstants.VERSION_0_2_0)
           .stringConf()
-          .checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
+          .checkValue(TypeValidator::isJdbcURL, ConfigConstants.JDBC_URL_INVALID_ERROR_MSG)

Review Comment:
   The IcebergConfig should not be changed, because the URI here might be another style (not JDBC url)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#discussion_r1727007792


##########
common/src/main/java/org/apache/gravitino/utils/TypeValid.java:
##########
@@ -0,0 +1,13 @@
+package org.apache.gravitino.utils;
+
+public class TypeValid {

Review Comment:
   Could you rename this to `TypeValidator`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "LiuQhahah (via GitHub)" <gi...@apache.org>.
LiuQhahah commented on code in PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#discussion_r1727027118


##########
common/src/main/java/org/apache/gravitino/utils/TypeValid.java:
##########
@@ -0,0 +1,13 @@
+package org.apache.gravitino.utils;
+
+public class TypeValid {

Review Comment:
   ok , thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#issuecomment-2300280363

   @yuqi1129 @jerqi please help to review, thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#issuecomment-5408366988

   Thank you for your contribution! Since this PR has been inactive for a long time, we're closing it to keep the PR queue manageable. If you'd like to continue working on this, please feel free to reopen it (or open a new PR) — we'd welcome it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#discussion_r1726169937


##########
catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/config/JdbcConfig.java:
##########
@@ -33,7 +34,7 @@ public class JdbcConfig extends Config {
           .doc("The url of the Jdbc connection")
           .version(ConfigConstants.VERSION_0_3_0)
           .stringConf()
-          .checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
+          .checkValue(TypeValid::isJdbcURL, ConfigConstants.JDBC_URL_INVALID_ERROR_MSG)

Review Comment:
   Also, you can execute `./gradlew build -x web -x test` locally to exclude some code format problems locally to improve development efficiency. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "LiuQhahah (via GitHub)" <gi...@apache.org>.
LiuQhahah commented on PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#issuecomment-2304571212

   Hi @yuqi1129 
   I have rollbacked the check for gravitino.entity.store.relational.jdbcUrl
   due to the error "    java.lang.IllegalArgumentException: jdbc:h2 in gravitino.entity.store.relational.jdbcUrl is invalid. The value can't be blank" from the Frontend Integration Test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#discussion_r1724274752


##########
catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/config/JdbcConfig.java:
##########
@@ -33,7 +34,7 @@ public class JdbcConfig extends Config {
           .doc("The url of the Jdbc connection")
           .version(ConfigConstants.VERSION_0_3_0)
           .stringConf()
-          .checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
+          .checkValue(TypeValid::isJdbcURL, ConfigConstants.JDBC_URL_INVALID_ERROR_MSG)

Review Comment:
   Could you please also modify other places like JDBC backends in the Iceberg catalog?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "LiuQhahah (via GitHub)" <gi...@apache.org>.
LiuQhahah commented on code in PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#discussion_r1725173764


##########
catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/config/JdbcConfig.java:
##########
@@ -33,7 +34,7 @@ public class JdbcConfig extends Config {
           .doc("The url of the Jdbc connection")
           .version(ConfigConstants.VERSION_0_3_0)
           .stringConf()
-          .checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
+          .checkValue(TypeValid::isJdbcURL, ConfigConstants.JDBC_URL_INVALID_ERROR_MSG)

Review Comment:
   Hi @yuqi1129 
   I have added the uri check for IceBerg catalog and "gravitino.entity.store.relational.jdbcUrl"
   
   Thanks
   Qiang



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #4600:
URL: https://github.com/apache/gravitino/pull/4600#discussion_r1726169239


##########
catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/config/JdbcConfig.java:
##########
@@ -33,7 +34,7 @@ public class JdbcConfig extends Config {
           .doc("The url of the Jdbc connection")
           .version(ConfigConstants.VERSION_0_3_0)
           .stringConf()
-          .checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
+          .checkValue(TypeValid::isJdbcURL, ConfigConstants.JDBC_URL_INVALID_ERROR_MSG)

Review Comment:
   Please review the changes carefully. The backend for Iceberg can be Hive or JDBC, so the proposed changes may not apply to the Hive backend. Kindly double-check this. If the valid changes cannot be applied to the Iceberg backend URI, please leave it as is.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] #4591 Improvement: add regex to check the style of JDBC URL [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao closed pull request #4600: #4591 Improvement: add regex to check the style of JDBC URL
URL: https://github.com/apache/gravitino/pull/4600


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org