You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@skywalking.apache.org by GitBox <gi...@apache.org> on 2018/09/16 02:25:26 UTC

[GitHub] wu-sheng closed pull request #8: A new data type for complex data type.

wu-sheng closed pull request #8: A new data type for complex data type.
URL: https://github.com/apache/incubator-skywalking-oal-tool/pull/8
 
 
   

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/java/org/apache/skywalking/oal/tool/parser/AnalysisResult.java b/oal-parser/src/main/java/org/apache/skywalking/oal/tool/parser/AnalysisResult.java
index 2b68f5d..b9b7aa4 100644
--- a/oal-parser/src/main/java/org/apache/skywalking/oal/tool/parser/AnalysisResult.java
+++ b/oal-parser/src/main/java/org/apache/skywalking/oal/tool/parser/AnalysisResult.java
@@ -137,7 +137,7 @@ public void generateSerializeFields() {
                 case "long":
                     serializeFields.addLongField(column.getFieldName());
                     break;
-                case "List":
+                case "IntKeyLongValueArray":
                     serializeFields.addIntLongValuePairelistField(column.getFieldName());
                     break;
                 default:
diff --git a/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/IntKeyLongValueArray.java b/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/IntKeyLongValueArray.java
new file mode 100644
index 0000000..30a957b
--- /dev/null
+++ b/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/IntKeyLongValueArray.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.core.analysis.indicator;
+
+import java.util.ArrayList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class IntKeyLongValueArray extends ArrayList<IntKeyLongValue> {
+
+    public IntKeyLongValueArray(int initialCapacity) {
+        super(initialCapacity);
+    }
+
+    public IntKeyLongValueArray() {
+        super();
+    }
+}
diff --git a/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/PxxIndicator.java b/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/PxxIndicator.java
index b4ac4c8..033194c 100644
--- a/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/PxxIndicator.java
+++ b/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/PxxIndicator.java
@@ -48,14 +48,14 @@
 
     @Getter @Setter @Column(columnName = VALUE) private int value;
     @Getter @Setter @Column(columnName = PRECISION) private int precision;
-    @Getter @Setter @Column(columnName = DETAIL_GROUP) private List<IntKeyLongValue> detailGroup;
+    @Getter @Setter @Column(columnName = DETAIL_GROUP) private IntKeyLongValueArray detailGroup;
 
     private final int percentileRank;
     private Map<Integer, IntKeyLongValue> detailIndex;
 
     public PxxIndicator(int percentileRank) {
         this.percentileRank = percentileRank;
-        detailGroup = new ArrayList<>(30);
+        detailGroup = new IntKeyLongValueArray(30);
     }
 
     @Entrance
@@ -105,7 +105,7 @@ public final void calculate() {
         for (IntKeyLongValue element : detailGroup) {
             count += element.getValue();
             if (count >= roof) {
-                value = element.getKey();
+                value = element.getKey() * precision;
                 return;
             }
         }
diff --git a/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/ThermodynamicIndicator.java b/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/ThermodynamicIndicator.java
index d5a0a0f..6d440aa 100644
--- a/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/ThermodynamicIndicator.java
+++ b/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/ThermodynamicIndicator.java
@@ -18,9 +18,7 @@
 
 package org.apache.skywalking.oap.server.core.analysis.indicator;
 
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import lombok.Getter;
 import lombok.Setter;
@@ -48,7 +46,7 @@
 
     @Getter @Setter @Column(columnName = STEP) private int step = 0;
     @Getter @Setter @Column(columnName = NUM_OF_STEPS) private int numOfSteps = 0;
-    @Getter @Setter @Column(columnName = DETAIL_GROUP) private List<IntKeyLongValue> detailGroup = new ArrayList<>(30);
+    @Getter @Setter @Column(columnName = DETAIL_GROUP) private IntKeyLongValueArray detailGroup = new IntKeyLongValueArray(30);
 
     private Map<Integer, IntKeyLongValue> detailIndex;
 


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services