[ https://issues.apache.org/jira/browse/DRILL-6544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16597272#comment-16597272 ]
ASF GitHub Bot commented on DRILL-6544: --------------------------------------- arina-ielchiieva commented on a change in pull request #1449: DRILL-6544: Timestamp value in Drill UI showed inconsistently with th… URL: https://github.com/apache/drill/pull/1449#discussion_r213972569 ########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/WebServerUtil.java ########## @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.drill.exec.server.rest; + +import org.apache.drill.common.types.TypeProtos; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeFormatterBuilder; +import java.time.temporal.ChronoField; + +public class WebServerUtil { + + public static String getFormattedString(Object value, TypeProtos.MinorType minorType) { + switch (minorType) { + case TIMESTAMP: + if (value instanceof LocalDateTime) { + DateTimeFormatter formatter = new DateTimeFormatterBuilder() + .appendPattern("yyyy-MM-dd HH:mm:ss") + .appendFraction(ChronoField.MILLI_OF_SECOND, 1, 3, true) + .toFormatter(); + return ((LocalDateTime) value).format(formatter); + } else { Review comment: Do you need else here? Won't it go to default if there is no break? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Timestamp value in Drill UI showed inconsistently with the same value > retrieved from sqline > ------------------------------------------------------------------------------------------- > > Key: DRILL-6544 > URL: https://issues.apache.org/jira/browse/DRILL-6544 > Project: Apache Drill > Issue Type: Bug > Affects Versions: 1.14.0 > Reporter: Anton Gozhiy > Assignee: Anton Gozhiy > Priority: Minor > > *Query:* > {code:sql} > select timestamp '2008-2-23 12:23:34' from (values(1)); > {code} > *Expected result (from sqline):* > 2008-02-23 12:23:34.0 > *Actual result (from Drill UI):* > 2008-02-23T12:23:34 -- This message was sent by Atlassian JIRA (v7.6.3#76005)