You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/01/26 15:54:57 UTC

[GitHub] [incubator-seatunnel] asdf2014 opened a new pull request #1172: [Improve] Use the correct init size for StringTemplate

asdf2014 opened a new pull request #1172:
URL: https://github.com/apache/incubator-seatunnel/pull/1172


   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[SeaTunnel #XXXX] [component] Title of the pull request", where *SeaTunnel #XXXX* should be replaced by the actual issue number.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   This is a minor improvement that using the correct init size instead for `StringTemplate`.
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [x] If any new Jar binary package adding in you PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/developement/NewLicenseGuide.md)
   * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
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@seatunnel.apache.org

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



[GitHub] [incubator-seatunnel] leo65535 commented on a change in pull request #1172: [Improve] Use the correct init size for StringTemplate

Posted by GitBox <gi...@apache.org>.
leo65535 commented on a change in pull request #1172:
URL: https://github.com/apache/incubator-seatunnel/pull/1172#discussion_r793185367



##########
File path: seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/StringTemplate.java
##########
@@ -37,7 +37,7 @@ public static String substitute(String str, String timeFormat) {
         final SimpleDateFormat sdf = new SimpleDateFormat(timeFormat);
         final String formattedDate = sdf.format(new Date());
 
-        final Map<String, String> valuesMap = new HashMap(5);
+        final Map<String, String> valuesMap = new HashMap(3);

Review comment:
       hi @asdf2014, it seems not necessary to modify 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@seatunnel.apache.org

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



[GitHub] [incubator-seatunnel] CalvinKirs closed pull request #1172: [Improve] Use the correct init size for StringTemplate

Posted by GitBox <gi...@apache.org>.
CalvinKirs closed pull request #1172:
URL: https://github.com/apache/incubator-seatunnel/pull/1172


   


-- 
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@seatunnel.apache.org

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



[GitHub] [incubator-seatunnel] CalvinKirs merged pull request #1172: [Improve] Use the correct init size for StringTemplate

Posted by GitBox <gi...@apache.org>.
CalvinKirs merged pull request #1172:
URL: https://github.com/apache/incubator-seatunnel/pull/1172


   


-- 
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@seatunnel.apache.org

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



[GitHub] [incubator-seatunnel] CalvinKirs commented on a change in pull request #1172: [Improve] Use the correct init size for StringTemplate

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on a change in pull request #1172:
URL: https://github.com/apache/incubator-seatunnel/pull/1172#discussion_r793222928



##########
File path: seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/StringTemplate.java
##########
@@ -37,7 +37,7 @@ public static String substitute(String str, String timeFormat) {
         final SimpleDateFormat sdf = new SimpleDateFormat(timeFormat);
         final String formattedDate = sdf.format(new Date());
 
-        final Map<String, String> valuesMap = new HashMap(5);
+        final Map<String, String> valuesMap = new HashMap(3);

Review comment:
       Sorry,ignore me, i remember wrong, the resize is only when the fourth element is added




-- 
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@seatunnel.apache.org

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



[GitHub] [incubator-seatunnel] CalvinKirs commented on a change in pull request #1172: [Improve] Use the correct init size for StringTemplate

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on a change in pull request #1172:
URL: https://github.com/apache/incubator-seatunnel/pull/1172#discussion_r793196720



##########
File path: seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/StringTemplate.java
##########
@@ -37,7 +37,7 @@ public static String substitute(String str, String timeFormat) {
         final SimpleDateFormat sdf = new SimpleDateFormat(timeFormat);
         final String formattedDate = sdf.format(new Date());
 
-        final Map<String, String> valuesMap = new HashMap(5);
+        final Map<String, String> valuesMap = new HashMap(3);

Review comment:
       Yes, there will be resize




-- 
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@seatunnel.apache.org

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



[GitHub] [incubator-seatunnel] asdf2014 commented on a change in pull request #1172: [Improve] Use the correct init size for StringTemplate

Posted by GitBox <gi...@apache.org>.
asdf2014 commented on a change in pull request #1172:
URL: https://github.com/apache/incubator-seatunnel/pull/1172#discussion_r793229062



##########
File path: seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/StringTemplate.java
##########
@@ -37,7 +37,7 @@ public static String substitute(String str, String timeFormat) {
         final SimpleDateFormat sdf = new SimpleDateFormat(timeFormat);
         final String formattedDate = sdf.format(new Date());
 
-        final Map<String, String> valuesMap = new HashMap(5);
+        final Map<String, String> valuesMap = new HashMap(3);

Review comment:
       @CalvinKirs No worries 😄




-- 
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@seatunnel.apache.org

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



[GitHub] [incubator-seatunnel] asdf2014 commented on a change in pull request #1172: [Improve] Use the correct init size for StringTemplate

Posted by GitBox <gi...@apache.org>.
asdf2014 commented on a change in pull request #1172:
URL: https://github.com/apache/incubator-seatunnel/pull/1172#discussion_r793220432



##########
File path: seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/StringTemplate.java
##########
@@ -37,7 +37,7 @@ public static String substitute(String str, String timeFormat) {
         final SimpleDateFormat sdf = new SimpleDateFormat(timeFormat);
         final String formattedDate = sdf.format(new Date());
 
-        final Map<String, String> valuesMap = new HashMap(5);
+        final Map<String, String> valuesMap = new HashMap(3);

Review comment:
       Hi @leo65535 @CalvinKirs, thanks for your comment, I agree with you, but if we use 5, it will resize to 8, which is unsuitable. If we use 3, it will resize to 4, which is quit enough here. So, I believe this improvement is necessary, right




-- 
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@seatunnel.apache.org

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