Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 20C99200B79 for ; Wed, 24 Aug 2016 03:43:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1F85C160AC4; Wed, 24 Aug 2016 01:43:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6FD0B160AAD for ; Wed, 24 Aug 2016 03:43:21 +0200 (CEST) Received: (qmail 12001 invoked by uid 500); 24 Aug 2016 01:43:20 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 11985 invoked by uid 99); 24 Aug 2016 01:43:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Aug 2016 01:43:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 8A5C42C0153 for ; Wed, 24 Aug 2016 01:43:20 +0000 (UTC) Date: Wed, 24 Aug 2016 01:43:20 +0000 (UTC) From: "Apache Spark (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SPARK-17174) Provide support for Timestamp type Column in add_months function to return HH:mm:ss MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 24 Aug 2016 01:43:22 -0000 [ https://issues.apache.org/jira/browse/SPARK-17174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15434038#comment-15434038 ] Apache Spark commented on SPARK-17174: -------------------------------------- User 'HyukjinKwon' has created a pull request for this issue: https://github.com/apache/spark/pull/14778 > Provide support for Timestamp type Column in add_months function to return HH:mm:ss > ----------------------------------------------------------------------------------- > > Key: SPARK-17174 > URL: https://issues.apache.org/jira/browse/SPARK-17174 > Project: Spark > Issue Type: Improvement > Components: Spark Core, SQL > Affects Versions: 2.0.0 > Reporter: Amit Baghel > Priority: Minor > > add_months function currently supports Date types. If Column is Timestamp type then it adds month to date but it doesn't return timestamp part (HH:mm:ss). See the code below. > {code} > import java.util.Calendar > val now = Calendar.getInstance().getTime() > val df = sc.parallelize((0 to 3).map(i => {now.setMonth(i); (i, new java.sql.Timestamp(now.getTime))}).toSeq).toDF("ID", "DateWithTS") > df.withColumn("NewDateWithTS", add_months(df("DateWithTS"),1)).show > {code} > Above code gives following response. See the HH:mm:ss is missing from NewDateWithTS column. > {code} > +---+--------------------+-------------+ > | ID| DateWithTS|NewDateWithTS| > +---+--------------------+-------------+ > | 0|2016-01-21 09:38:...| 2016-02-21| > | 1|2016-02-21 09:38:...| 2016-03-21| > | 2|2016-03-21 09:38:...| 2016-04-21| > | 3|2016-04-21 09:38:...| 2016-05-21| > +---+--------------------+-------------+ > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org