asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Blow (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: ASTERIXDB-1459: Enable Debugging for Generated Functions
Date Fri, 29 Jul 2016 17:06:50 GMT
Michael Blow has submitted this change and it was merged.

Change subject: ASTERIXDB-1459: Enable Debugging for Generated Functions
......................................................................


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>
---
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/CodeGenUtil.java
1 file changed, 12 insertions(+), 20 deletions(-)

Approvals:
  abdullah alamoudi: Looks good to me, approved
  Jenkins: Verified; No violations found; Verified



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 @@
     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 @@
         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 @@
      *            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 @@
      *            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 @@
      *            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);
         }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1030
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0e7816864b91b2ce0e474137b20c9fee2e35c25c
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mblow@apache.org>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mblow@apache.org>
Gerrit-Reviewer: Taewoo Kim <wangsaeu@yahoo.com>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message