You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2021/03/02 18:44:00 UTC

[jira] [Comment Edited] (CALCITE-4518) org.codehaus.commons.compiler.CompileException

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

Julian Hyde edited comment on CALCITE-4518 at 3/2/21, 6:43 PM:
---------------------------------------------------------------

Thanks for logging the Janino issue. We would potentially work-around by generating "new Object[]\{(a < b),1,2}" rather than "new Object[]\{a < b,1,2}" but it's better to wait for a Janino fix.


was (Author: julianhyde):
Thanks for logging the Janino issue. We would potentially work-around by generating "new Object[]{(a < b),1,2}" rather than "new Object[]{a < b,1,2}" but it's better to wait for a Janino fix.

> org.codehaus.commons.compiler.CompileException
> ----------------------------------------------
>
>                 Key: CALCITE-4518
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4518
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: feng.huang
>            Priority: Major
>
> calcite call janino to compile javacode in some case such as ReduceExpressionsRule#reduceExpressions, but there is something wrong with janino handling "<" operator.
>  
> {code:java}
> public static void main(String[] args) throws IOException, CompileException {
>     String code = "public Object[] apply(Object root0) {\n" +
>             "int a=1;int b=2 ; " +
>             "return new Object[]{a < b,1,2};\n" +
>             "}\n";
>     final ClassBodyEvaluator cbe = new ClassBodyEvaluator();
>     cbe.setClassName("Test");
>     cbe.setExtendedClass(Utilities.class);
>     cbe.setImplementedInterfaces(new Class[]{Function1.class, Serializable.class});
>     cbe.setParentClassLoader(RexExecutable.class.getClassLoader());
>     cbe.cook(new Scanner(null, new StringReader(code)));
> }{code}
>  
> when janino read "a < b , " , it regard this as the instance of rule : ShiftExpression<TypeArgument,TypeArgument...>, and then throw "CompileException: Line 2, Column 45: IDENTIFIER expected instead of '1'.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)