You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2018/09/16 02:25:29 UTC

[incubator-skywalking-oal-tool] branch master updated: A new data type for complex data type. (#8)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking-oal-tool.git


The following commit(s) were added to refs/heads/master by this push:
     new 3ae7481  A new data type for complex data type. (#8)
3ae7481 is described below

commit 3ae7481cb274613d82fa7f3d7d4eeefe85a9fe3d
Author: 彭勇升 pengys <80...@qq.com>
AuthorDate: Sun Sep 16 10:25:25 2018 +0800

    A new data type for complex data type. (#8)
---
 .../skywalking/oal/tool/parser/AnalysisResult.java |  2 +-
 .../analysis/indicator/IntKeyLongValueArray.java   | 35 ++++++++++++++++++++++
 .../core/analysis/indicator/PxxIndicator.java      |  6 ++--
 .../analysis/indicator/ThermodynamicIndicator.java |  4 +--
 4 files changed, 40 insertions(+), 7 deletions(-)

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 class AnalysisResult {
                 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 @@ public abstract class PxxIndicator extends Indicator {
 
     @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 abstract class PxxIndicator extends Indicator {
         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 @@ public abstract class ThermodynamicIndicator extends Indicator {
 
     @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;