mdayakar commented on code in PR #5182: URL: https://github.com/apache/hive/pull/5182#discussion_r1600530827
########## hplsql/src/main/java/org/apache/hive/hplsql/functions/FunctionDatetime.java: ########## @@ -162,6 +174,35 @@ void toTimestamp(HplsqlParser.Expr_func_paramsContext ctx) { } } + /** + * FROM_UNIXTIME() function (convert seconds since 1970-01-01 00:00:00 to timestamp) + */ + void fromUnixtime(HplsqlParser.Expr_func_paramsContext ctx) { + int cnt = BuiltinFunctions.getParamCount(ctx); + if (cnt == 0) { + evalNull(); + return; + } + Var value = evalPop(ctx.func_param(0).expr()); + if (value.type != Var.Type.BIGINT) { + Var newVar = new Var(Var.Type.BIGINT); + value = newVar.cast(value); + } + long epoch = value.longValue(); + String format = "yyyy-MM-dd HH:mm:ss"; + if (cnt > 1) { + format = Utils.unquoteString(evalPop(ctx.func_param(1).expr()).toString()); + } + evalString(Utils.quoteString(new SimpleDateFormat(format).format(new Date(epoch * 1000)))); Review Comment: Fixed. Now using all java.time.* APIs. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org