asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mb...@apache.org
Subject asterixdb git commit: ASTERIXDB-1459: Enable Debugging for Generated Functions
Date Fri, 29 Jul 2016 17:07:15 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 3f83b2c5c -> 018ec4a1d


ASTERIXDB-1459: Enable Debugging for Generated Functions

Generate classes as nested classes of original class (including
package) to enable debugging.

Change-Id: I0e7816864b91b2ce0e474137b20c9fee2e35c25c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1030
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/018ec4a1
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/018ec4a1
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/018ec4a1

Branch: refs/heads/master
Commit: 018ec4a1d45d7cbd922d31f7a4e2c531e43e6cf1
Parents: 3f83b2c
Author: Michael Blow <mblow@apache.org>
Authored: Wed Jul 27 19:01:40 2016 -0400
Committer: Michael Blow <mblow@apache.org>
Committed: Fri Jul 29 10:06:47 2016 -0700

----------------------------------------------------------------------
 .../evaluators/staticcodegen/CodeGenUtil.java   | 32 ++++++++------------
 1 file changed, 12 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/018ec4a1/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/CodeGenUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/CodeGenUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/CodeGenUtil.java
index 1da88a1..87a9a84 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/CodeGenUtil.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/CodeGenUtil.java
@@ -43,11 +43,8 @@ public class CodeGenUtil {
     private final static String EVALUATOR_FACTORY = "EvaluatorFactory";
     private final static String EVALUATOR = "Evaluator";
     private final static String INNER = "Inner";
-    private final static String DESCRIPTOR = "Descriptor";
-    private final static String ACCESSOR = "Accessor";
     private final static String DOLLAR = "$";
-    private final static String PKG_SUFFIX = "/generated";
-    private final static String ASTERIXDB_PREFIX = "org/apache/asterix";
+    private final static String NESTED_CLASSNAME_PREFIX = "_";
 
     /**
      * The callback interface for a caller to determine what it needs to do for
@@ -165,7 +162,9 @@ public class CodeGenUtil {
         int index = nameMappings.size() - 1;
         for (; index >= 0; --index) {
             Pair<String, String> entry = nameMappings.get(index);
-            result = result.replace(entry.getLeft(), entry.getRight());
+            if (result.contains(entry.getLeft())) {
+                return result.replace(entry.getLeft(), entry.getRight());
+            }
         }
         return result;
     }
@@ -179,7 +178,7 @@ public class CodeGenUtil {
      *            the original evaluator factory class name.
      * @param suffixForGeneratedClass,
      *            the suffix for the generated class.
-     * @param factoryIndex,
+     * @param factoryCounter,
      *            the counter for the generated class.
      * @param nameMappings,
      *            class names that needs to be rewritten in the generated byte code.
@@ -235,7 +234,7 @@ public class CodeGenUtil {
      *            the name of the original evaluator class.
      * @param suffixForGeneratedClass,
      *            the suffix for the generated class.
-     * @param evalIndex,
+     * @param evalCounter,
      *            the counter for the generated class.
      * @param nameMappings,
      *            class names that needs to be rewritten in the generated byte code.
@@ -368,30 +367,23 @@ public class CodeGenUtil {
      *            the original class, i.e., the source of the generated class.
      * @param suffix,
      *            the suffix for the generated class.
-     * @param evalCounter,
+     * @param counter,
      *            a counter that appearing at the end of the name of the generated class.
      * @return the name of the generated class.
      */
     private static String getGeneratedClassName(String originalClassName, String suffix,
int counter) {
         StringBuilder sb = new StringBuilder();
-        int end = originalClassName.indexOf(DESCRIPTOR);
-        if (end < 0) {
-            end = originalClassName.indexOf(ACCESSOR);
-        }
-        if (end < 0) {
-            end = originalClassName.indexOf(DOLLAR);
-        }
+        int end = originalClassName.indexOf(DOLLAR);
         if (end < 0) {
             end = originalClassName.length();
         }
 
         String name = originalClassName.substring(0, end);
-        String lastName = name.substring(ASTERIXDB_PREFIX.length());
-
-        sb.append(ASTERIXDB_PREFIX);
-        sb.append(PKG_SUFFIX);
-        sb.append(lastName);
+        sb.append(name);
+        sb.append(DOLLAR);
+        sb.append(NESTED_CLASSNAME_PREFIX);
         sb.append(suffix);
+
         if (counter > 0) {
             sb.append(counter);
         }


Mime
View raw message