Sergey Soldatov created PHOENIX-4747:
----------------------------------------

             Summary: UDF's integer parameter doens't accept negative constant.
                 Key: PHOENIX-4747
                 URL: https://issues.apache.org/jira/browse/PHOENIX-4747
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.14.0
            Reporter: Sergey Soldatov


If UDF has an integer parameter and we provide a negative constant it fails 
with 
{noformat}
org.apache.phoenix.schema.ArgumentTypeMismatchException: ERROR 203 (22005): 
Type mismatch. expected: [INTEGER] but was: BIGINT at ADDTIME argument 2
        at 
org.apache.phoenix.parse.FunctionParseNode.validateFunctionArguement(FunctionParseNode.java:214)
        at 
org.apache.phoenix.parse.FunctionParseNode.validate(FunctionParseNode.java:193)
        at 
org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:331)
        at 
org.apache.phoenix.compile.ProjectionCompiler$SelectClauseVisitor.visitLeave(ProjectionCompiler.java:700)
        at 
org.apache.phoenix.compile.ProjectionCompiler$SelectClauseVisitor.visitLeave(ProjectionCompiler.java:585)
        at 
org.apache.phoenix.parse.FunctionParseNode.accept(FunctionParseNode.java:86)
        at 
org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:412)
        at 
org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:561)
        at 
org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:507)
        at 
org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
        at 
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:153)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:490)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:456)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:302)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
        at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1830)
        at sqlline.Commands.execute(Commands.java:822)
        at sqlline.Commands.sql(Commands.java:732)
        at sqlline.SqlLine.dispatch(SqlLine.java:813)
        at sqlline.SqlLine.begin(SqlLine.java:686)
        at sqlline.SqlLine.start(SqlLine.java:398)
        at sqlline.SqlLine.main(SqlLine.java:291)
{noformat}
That happens because negative constants are parsed as integer value * -1L, so 
the result is long. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to