Return-Path: X-Original-To: apmail-hive-user-archive@www.apache.org Delivered-To: apmail-hive-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E311310F04 for ; Sun, 3 May 2015 21:26:34 +0000 (UTC) Received: (qmail 68758 invoked by uid 500); 3 May 2015 21:26:32 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 68691 invoked by uid 500); 3 May 2015 21:26:32 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 68681 invoked by uid 99); 3 May 2015 21:26:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 May 2015 21:26:32 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: message received from 54.76.25.247 which is an MX secondary for user@hive.apache.org) Received: from [54.76.25.247] (HELO mx1-eu-west.apache.org) (54.76.25.247) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 May 2015 21:26:04 +0000 Received: from sulu.netzoomi.net (sulu.netzoomi.net [83.138.144.103]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 76F8520522 for ; Sun, 3 May 2015 21:25:54 +0000 (UTC) Received: from vulcan.netzoomi.net (unknown [212.100.249.54]) by sulu.netzoomi.net (Postfix) with ESMTP id 49D756A45F5 for ; Sun, 3 May 2015 22:25:05 +0100 (BST) X-Envelope-From: Received: from vista (cpc7-seve18-2-0-cust228.13-3.cable.virginm.net [86.19.240.229]) by vulcan.netzoomi.net (Postfix) with ESMTPA id 0BB9A1248083 for ; Sun, 3 May 2015 22:25:05 +0100 (BST) From: "Mich Talebzadeh" To: Subject: comparing timestamp columns in Hive Date: Sun, 3 May 2015 22:23:37 +0100 Message-ID: <04be01d085e7$6afefde0$40fcf9a0$@co.uk> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_04BF_01D085EF.CCC365E0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdCF52qkAMxphbY8SOWJ4Dd+h9y9Aw== Content-Language: en-gb X-domainnameshop-MailScanner-Information: Please contact the ISP for more information X-domainnameshop-MailScanner-ID: 49D756A45F5.A2DE0 X-domainnameshop-MailScanner: Found to be clean X-domainnameshop-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=1.275, required 5, autolearn=disabled, HTML_MESSAGE 0.00, RDNS_NONE 1.27) X-domainnameshop-MailScanner-SpamScore: 1 X-domainnameshop-MailScanner-From: mich@peridale.co.uk X-domainnameshop-MailScanner-Watermark: 1431293105.92217@8hVz0aHrYEgGv2d15ZEdlQ X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No This is a multi-part message in MIME format. ------=_NextPart_000_04BF_01D085EF.CCC365E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, Just wanted to raise this one. Sounds like equating two columns of timestamp does not work in Hive. In the following both t.op_time and tmp maxDDLTime columns are defined as timestamp. When I do the following select t.object_id, t.op_type, t.op_time, tmp.maxDDLTime from t, tmp where t.object_id = tmp.object_id and t.op_time = tmp.maxDDLTime; it returns zero rows and does not work! However, when I cast timestamp columns to bigint it works select t.object_id, t.op_type, t.op_time, cast(t.op_time as bigint), tmp.maxDDLTime, cast(tmp.maxDDLTime as bigint) from t, tmp where t.object_id = tmp.object_id and cast(t.op_time as bigint) = cast(tmp.maxDDLTime as bigint); +--------------+------------+------------------------+-------------+-------- ----------------+-------------+--+ | t.object_id | t.op_type | t.op_time | _c3 | tmp.maxddltime | _c5 | +--------------+------------+------------------------+-------------+-------- ----------------+-------------+--+ | 3644834 | 2 | 2015-05-01 12:42:51.0 | 1430480571 | 2015-05-01 12:42:51.0 | 1430480571 | | 3636987 | 2 | 2015-05-01 12:42:51.0 | 1430480571 | 2015-05-01 12:42:51.0 | 1430480571 | +--------------+------------+------------------------+-------------+-------- ----------------+-------------+--+ Is this expected? In other words to equate timestamp columns do we need to cast them to bigint or numeric? Thanks, Mich Talebzadeh http://talebzadehmich.wordpress.com Author of the books "A Practitioner's Guide to Upgrading to Sybase ASE 15", ISBN 978-0-9563693-0-7. co-author "Sybase Transact SQL Guidelines Best Practices", ISBN 978-0-9759693-0-4 Publications due shortly: Creating in-memory Data Grid for Trading Systems with Oracle TimesTen and Coherence Cache Oracle and Sybase, Concepts and Contrasts, ISBN: 978-0-9563693-1-4, volume one out shortly NOTE: The information in this email is proprietary and confidential. This message is for the designated recipient only, if you are not the intended recipient, you should destroy it immediately. Any information in this message shall not be understood as given or endorsed by Peridale Ltd, its subsidiaries or their employees, unless expressly so stated. It is the responsibility of the recipient to ensure that this email is virus free, therefore neither Peridale Ltd, its subsidiaries nor their employees accept any responsibility. ------=_NextPart_000_04BF_01D085EF.CCC365E0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 

Just wanted = to raise this one.

 

Sounds like = equating two columns of timestamp does not work in Hive. In the = following both t.op_time and tmp maxDDLTime columns are = defined as timestamp. When I do the following

 

select = t.object_id, t.op_type, t.op_time, = tmp.maxDDLTime

from t, = tmp

where = t.object_id =3D tmp.object_id and t.op_time = =3D tmp.maxDDLTime;

 

it returns = zero rows and does not work!

 

However, = when I cast timestamp columns to bigint it works

 

select = t.object_id, t.op_type, t.op_time, cast(t.op_time as bigint), = tmp.maxDDLTime, cast(tmp.maxDDLTime as bigint)

from t, tmp

where t.object_id =3D tmp.object_id and cast(t.op_time as bigint) =3D cast(tmp.maxDDLTime as = bigint);

 

+--------------+------------+------------------------+--= -----------+------------------------+-------------+--+<= /p>

| = t.object_id  | t.op_type  = |       = t.op_time        = |     _c3     = |     tmp.maxddltime     = |     _c5   =   |

+--------------+------------+------------------------+--= -----------+------------------------+-------------+--+<= /p>

| = 3644834      | = 2          | 2015-05-01 = 12:42:51.0  | 1430480571  | 2015-05-01 12:42:51.0  | = 1430480571  |

| = 3636987      | = 2          | 2015-05-01 = 12:42:51.0  | 1430480571  | 2015-05-01 12:42:51.0  | = 1430480571  |

+--------------+------------+------------------------+--= -----------+------------------------+-------------+--+

 

Is this = expected? In other words to equate timestamp columns do we need to cast = them to bigint or numeric?

 

Thanks,<= /o:p>

 

Mich = Talebzadeh

 <= /span>

h= ttp://talebzadehmich.wordpress.com

 

Author of the = books "A Practitioner’s Guide to Upgrading to = Sybase ASE = 15", ISBN = 978-0-9563693-0-7. =

co-author = "Sybase Transact SQL Guidelines Best Practices", ISBN = 978-0-9759693-0-4

Publications due shortly:

Cr= eating in-memory Data Grid for Trading Systems with Oracle TimesTen and = Coherence Cache

Oracle and = Sybase, Concepts and Contrasts, = ISBN: = 978-0-9563693-1-4, volume one out = shortly

<= o:p> 

NO= TE: The information in this email is proprietary and confidential. This = message is for the designated recipient only, if you are not the = intended recipient, you should destroy it immediately. Any information = in this message shall not be understood as given or endorsed by Peridale = Ltd, its subsidiaries or their employees, unless expressly so stated. It = is the responsibility of the recipient to ensure that this email is = virus free, therefore neither Peridale Ltd, its subsidiaries nor their = employees accept any responsibility.

 

------=_NextPart_000_04BF_01D085EF.CCC365E0--