apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (APEXMALHAR-2010) Add transform operator
Date Mon, 21 Mar 2016 06:30:25 GMT

    [ https://issues.apache.org/jira/browse/APEXMALHAR-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15203804#comment-15203804
] 

ASF GitHub Bot commented on APEXMALHAR-2010:
--------------------------------------------

Github user chinmaykolhatkar commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-malhar/pull/209#discussion_r56785681
  
    --- Diff: library/src/main/java/com/datatorrent/lib/util/PojoUtils.java ---
    @@ -572,41 +573,13 @@ private static String getSingleFieldGetterExpression(final Class<?>
pojoClass, f
       @SuppressWarnings("StringEquality")
       private static Object createGetter(Class<?> pojoClass, String getterExpr, String
exprObjectPlaceholder, Class<?> exprClass, Class<?> getterClass)
       {
    -    if (getterExpr.startsWith(".")) {
    -      getterExpr = getterExpr.substring(1);
    -    }
    -
    -    if (getterExpr.isEmpty()) {
    -      throw new IllegalArgumentException("The getter expression: \"" + getterExpr + "\"
is invalid.");
    -    }
    -
         logger.debug("{} {} {} {}", pojoClass, getterExpr, exprClass, getterClass);
     
    -    IScriptEvaluator se;
    -
    -    try {
    -      se = CompilerFactoryFactory.getDefaultCompilerFactory().newScriptEvaluator();
    -    } catch (Exception ex) {
    -      throw new RuntimeException(ex);
    -    }
    -
    -    String code = StringUtils.replaceEach(getterExpr, new String[]{exprObjectPlaceholder},
    -            new String[]{new JavaStatement(pojoClass.getName().length() + OBJECT.length()
+ 4).appendCastToTypeExpr(pojoClass, OBJECT).toString()});
    -    if (code != getterExpr) {
    -      code = new JavaReturnStatement(exprClass.getName().length() + code.length() + 12,
exprClass).append(code).getStatement();
    -      logger.debug("Original expression {} is a complex expression. Replacing it with
{}.", getterExpr, code);
    -    }
    -    else {
    -      code = getSingleFieldGetterExpression(pojoClass, getterExpr, exprClass);
    -    }
    -
    -    logger.debug("code: {}", code);
    +    JavaExpressionParser javaExpressionParser = new JavaExpressionParser();
    +    javaExpressionParser.setInputObjectPlaceholder("$", PojoUtils.OBJECT);
    --- End diff --
    
    Done.


> Add transform operator
> ----------------------
>
>                 Key: APEXMALHAR-2010
>                 URL: https://issues.apache.org/jira/browse/APEXMALHAR-2010
>             Project: Apache Apex Malhar
>          Issue Type: New Feature
>          Components: algorithms
>    Affects Versions: 3.4.0
>            Reporter: Chinmay Kolhatkar
>            Assignee: Chinmay Kolhatkar
>
> Add transform operator
> Details to be added soon once the mailing thread reaching conclusion:
> http://mail-archives.apache.org/mod_mbox/incubator-apex-dev/201603.mbox/%3CCABAipVZUdRGx5dS35bYPN46koLQU5gSLgbCeRH8aM_y9ANRU2w%40mail.gmail.com%3E



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message