wu-sheng closed pull request #10: Timebucket value overwrite bug.
URL: https://github.com/apache/incubator-skywalking-oal-tool/pull/10
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl 
b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
index 0e2db23..6569f4f 100644
--- a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
+++ b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
@@ -177,10 +177,14 @@ public class ${metricName}Indicator extends 
${indicatorClassName} implements Ala
         ${metricName}Indicator indicator = new ${metricName}Indicator();
         indicator.setTimeBucket(toTimeBucketInHour());
 <#list fieldsFromSource as field>
+    <#if field.columnName != "time_bucket">
         indicator.${field.fieldSetter}(this.${field.fieldGetter}());
+    </#if>
 </#list>
 <#list persistentFields as field>
+    <#if field.columnName != "time_bucket">
         indicator.${field.fieldSetter}(this.${field.fieldGetter}());
+    </#if>
 </#list>
         return indicator;
     }
@@ -190,10 +194,14 @@ public class ${metricName}Indicator extends 
${indicatorClassName} implements Ala
         ${metricName}Indicator indicator = new ${metricName}Indicator();
         indicator.setTimeBucket(toTimeBucketInDay());
 <#list fieldsFromSource as field>
+    <#if field.columnName != "time_bucket">
         indicator.${field.fieldSetter}(this.${field.fieldGetter}());
+    </#if>
 </#list>
 <#list persistentFields as field>
+    <#if field.columnName != "time_bucket">
         indicator.${field.fieldSetter}(this.${field.fieldGetter}());
+    </#if>
 </#list>
         return indicator;
     }
@@ -203,10 +211,14 @@ public class ${metricName}Indicator extends 
${indicatorClassName} implements Ala
         ${metricName}Indicator indicator = new ${metricName}Indicator();
         indicator.setTimeBucket(toTimeBucketInMonth());
 <#list fieldsFromSource as field>
+    <#if field.columnName != "time_bucket">
         indicator.${field.fieldSetter}(this.${field.fieldGetter}());
+    </#if>
 </#list>
 <#list persistentFields as field>
+    <#if field.columnName != "time_bucket">
         indicator.${field.fieldSetter}(this.${field.fieldGetter}());
+    </#if>
 </#list>
         return indicator;
     }
diff --git 
a/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java 
b/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
index a7a4574..be2e5f2 100644
--- 
a/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
+++ 
b/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
@@ -122,7 +122,6 @@ public Indicator toHour() {
         indicator.setSummation(this.getSummation());
         indicator.setCount(this.getCount());
         indicator.setValue(this.getValue());
-        indicator.setTimeBucket(this.getTimeBucket());
         indicator.setStringField(this.getStringField());
         return indicator;
     }
@@ -135,7 +134,6 @@ public Indicator toDay() {
         indicator.setSummation(this.getSummation());
         indicator.setCount(this.getCount());
         indicator.setValue(this.getValue());
-        indicator.setTimeBucket(this.getTimeBucket());
         indicator.setStringField(this.getStringField());
         return indicator;
     }
@@ -148,7 +146,6 @@ public Indicator toMonth() {
         indicator.setSummation(this.getSummation());
         indicator.setCount(this.getCount());
         indicator.setValue(this.getValue());
-        indicator.setTimeBucket(this.getTimeBucket());
         indicator.setStringField(this.getStringField());
         return indicator;
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to