Sergey Nuyanzin created FLINK-24648: ---------------------------------------
Summary: Ceil, floor for some timeunit return wrong results or fail with CompileException Key: FLINK-24648 URL: https://issues.apache.org/jira/browse/FLINK-24648 Project: Flink Issue Type: Bug Reporter: Sergey Nuyanzin There are issues 1. for {{TIMESTAMP WITHOUT TIMEZONE}} and {{DATE}} it returns wrong result for queries {code:sql} select ceil(timstamp'2020-26-10 12:12:12' to decade); select ceil(timstamp'2020-26-10 12:12:12' to century); select ceil(timstamp'2020-26-10 12:12:12' to , millennium); {code} same for {{FLOOR}} and {{DATE}} 2. for {{TIMESTAMP WITH TIMEZONE}} it throws exception {noformat} [ERROR] Could not execute SQL statement. Reason: org.codehaus.commons.compiler.CompileException: Line 57, Column 0: No applicable constructor/method found for actual parameters "org.apache.flink.table.data.TimestampData, org.apache.flink.table.data.TimestampData"; candidates are: "public static int org.apache.calcite.runtime.SqlFunctions.ceil(int, java.math.BigDecimal)", "public static java.math.BigDecimal org.apache.calcite.runtime.SqlFunctions.ceil(java.math.BigDecimal, int)", "public static java.math.BigDecimal org.apache.calcite.runtime.SqlFunctions.ceil(java.math.BigDecimal, java.math.BigDecimal)", "public static short org.apache.calcite.runtime.SqlFunctions.ceil(short, short)", "public static java.math.BigDecimal org.apache.calcite.runtime.SqlFunctions.ceil(java.math.BigDecimal)", "public static double org.apache.calcite.runtime.SqlFunctions.ceil(double)", "public static float org.apache.calcite.runtime.SqlFunctions.ceil(float)", "public static byte org.apache.calcite.runtime.SqlFunctions.ceil(byte, byte)", "public static long org.apache.calcite.runtime.SqlFunctions.ceil(long, long)", "public static int org.apache.calcite.runtime.SqlFunctions.ceil(int, int)" at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211) at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:9263) at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:9123) at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:9025) at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5062) at org.codehaus.janino.UnitCompiler.access$9100(UnitCompiler.java:215) at org.codehaus.janino.UnitCompiler$16.visitMethodInvocation(UnitCompiler.java:4423) at org.codehaus.janino.UnitCompiler$16.visitMethodInvocation(UnitCompiler.java:4396) at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:5073) at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4396) at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5662) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3792) at org.codehaus.janino.UnitCompiler.access$6100(UnitCompiler.java:215) at org.codehaus.janino.UnitCompiler$13.visitAssignment(UnitCompiler.java:3754) at org.codehaus.janino.UnitCompiler$13.visitAssignment(UnitCompiler.java:3734) at org.codehaus.janino.Java$Assignment.accept(Java.java:4477) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3734) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2360) at org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:215) at org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1494) at org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1487) at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:2874) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487) at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1567) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1553) at org.codehaus.janino.UnitCompiler.access$1700(UnitCompiler.java:215) at org.codehaus.janino.UnitCompiler$6.visitBlock(UnitCompiler.java:1493) at org.codehaus.janino.UnitCompiler$6.visitBlock(UnitCompiler.java:1487) at org.codehaus.janino.Java$Block.accept(Java.java:2779) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2476) at org.codehaus.janino.UnitCompiler.access$1900(UnitCompiler.java:215) at org.codehaus.janino.UnitCompiler$6.visitIfStatement(UnitCompiler.java:1495) at org.codehaus.janino.UnitCompiler$6.visitIfStatement(UnitCompiler.java:1487) at org.codehaus.janino.Java$IfStatement.accept(Java.java:2950) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487) at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1567) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3388) at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1357) at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1330) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:822) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:432) at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:215) at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:411) at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:406) at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1414) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:406) at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:378) at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:237) at org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java:465) at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:216) at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:207) at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:80) at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:75) at org.apache.flink.table.runtime.generated.CompileUtils.doCompile(CompileUtils.java:86) at org.apache.flink.table.runtime.generated.CompileUtils.lambda$compile$1(CompileUtils.java:74) at org.apache.flink.shaded.guava30.com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4864) at org.apache.flink.shaded.guava30.com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529) at org.apache.flink.shaded.guava30.com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278) at org.apache.flink.shaded.guava30.com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155) at org.apache.flink.shaded.guava30.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045) at org.apache.flink.shaded.guava30.com.google.common.cache.LocalCache.get(LocalCache.java:3962) at org.apache.flink.shaded.guava30.com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4859) at org.apache.flink.table.runtime.generated.CompileUtils.compile(CompileUtils.java:74) at org.apache.flink.table.runtime.generated.GeneratedClass.compile(GeneratedClass.java:102) at org.apache.flink.table.runtime.generated.GeneratedClass.newInstance(GeneratedClass.java:83) at org.apache.flink.table.runtime.operators.CodeGenOperatorFactory.createStreamOperator(CodeGenOperatorFactory.java:40) at org.apache.flink.streaming.api.operators.StreamOperatorFactoryUtil.createOperator(StreamOperatorFactoryUtil.java:81) at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOperator(OperatorChain.java:712) at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOperatorChain(OperatorChain.java:686) at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOutputCollector(OperatorChain.java:626) at org.apache.flink.streaming.runtime.tasks.OperatorChain.<init>(OperatorChain.java:187) at org.apache.flink.streaming.runtime.tasks.RegularOperatorChain.<init>(RegularOperatorChain.java:63) at org.apache.flink.streaming.runtime.tasks.StreamTask.restoreInternal(StreamTask.java:675) at org.apache.flink.streaming.runtime.tasks.StreamTask.restore(StreamTask.java:661) at org.apache.flink.runtime.taskmanager.Task.runWithSystemExitMonitoring(Task.java:960) at org.apache.flink.runtime.taskmanager.Task.restoreAndInvoke(Task.java:929) at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:753) at org.apache.flink.runtime.taskmanager.Task.run(Task.java:574) at java.base/java.lang.Thread.run(Thread.java:834) {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)