[ 
https://issues.apache.org/jira/browse/CALCITE-5146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

itxiangkui updated CALCITE-5146:
--------------------------------
    Description: 
I have defined several UDFs:
{code:java}
// code placeholder
public static String from_unixtime(long unixTimestamp, String format) {
    try {
        if (String.valueOf(unixTimestamp).length() == 10) {
            unixTimestamp = 1000 * 
Long.parseLong(String.valueOf(unixTimestamp));
        }
        return DateFormatUtils.format(unixTimestamp, format);
    } catch (Exception e) {
        return null;
    }
} {code}
 
{code:java}
//unix_timestamp
public long unix_timestamp(String dateStr) {
    long ts = parseToTimeMillis(dateStr, DEFAULT_BEIJING_TIME_ZONE);
    return ts / 1000;
}{code}
 

> Udf-Timestamp Function Rel get a weird value
> --------------------------------------------
>
>                 Key: CALCITE-5146
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5146
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.30.0
>            Reporter: itxiangkui
>            Priority: Major
>
> I have defined several UDFs:
> {code:java}
> // code placeholder
> public static String from_unixtime(long unixTimestamp, String format) {
>     try {
>         if (String.valueOf(unixTimestamp).length() == 10) {
>             unixTimestamp = 1000 * 
> Long.parseLong(String.valueOf(unixTimestamp));
>         }
>         return DateFormatUtils.format(unixTimestamp, format);
>     } catch (Exception e) {
>         return null;
>     }
> } {code}
>  
> {code:java}
> //unix_timestamp
> public long unix_timestamp(String dateStr) {
>     long ts = parseToTimeMillis(dateStr, DEFAULT_BEIJING_TIME_ZONE);
>     return ts / 1000;
> }{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to