From dev-return-2719-archive-asf-public=cust-asf.ponee.io@orc.apache.org Mon Dec 24 20:27:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C9F50180660 for ; Mon, 24 Dec 2018 20:27:03 +0100 (CET) Received: (qmail 58979 invoked by uid 500); 24 Dec 2018 19:27:02 -0000 Mailing-List: contact dev-help@orc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@orc.apache.org Delivered-To: mailing list dev@orc.apache.org Received: (qmail 58968 invoked by uid 99); 24 Dec 2018 19:27:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Dec 2018 19:27:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 642FE180965 for ; Mon, 24 Dec 2018 19:27:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id JedUKhPcUvty for ; Mon, 24 Dec 2018 19:27:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 05B7E5FE03 for ; Mon, 24 Dec 2018 19:27:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8C76EE00CB for ; Mon, 24 Dec 2018 19:27:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 06E3525344 for ; Mon, 24 Dec 2018 19:27:00 +0000 (UTC) Date: Mon, 24 Dec 2018 19:27:00 +0000 (UTC) From: "Rei Mai (JIRA)" To: dev@orc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (ORC-451) Timestamp statistics is wrong if read with useUTCTimestamp=true MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Rei Mai created ORC-451: --------------------------- Summary: Timestamp statistics is wrong if read with useUTCTime= stamp=3Dtrue Key: ORC-451 URL: https://issues.apache.org/jira/browse/ORC-451 Project: ORC Issue Type: Bug Affects Versions: 1.5.0 Environment: timezone for both client and server "Europe/Moscow" (= UTC+3) hive version 3.1.0.3.0.1.0-187 Reporter: Rei Mai Attachments: 000000_0 We're using external orc tables and a timezone "Europe/Moscow" (UTC+3) for = both client and server. After switching to hive 3 which uses orc 1.5.x we'v= e got an issue with predicate push down filtering out matching stripes by t= imestamp. E.g. consider a table (it's orc data is in the attachment): {quote}{{create external table test_ts (ts timestamp) stored as orc;}} {{insert into test_ts values ("2018-12-24 18:30:00");}} {{// No rows selected}} {{select * from test_ts where ts < "2018-12-24 19:00:00";}} // the lowest filter to return the value {{select * from test_ts where ts <=3D "2018-12-24 21:30:00";}} {quote} The issue only affect external orc tables statistics. Turning ppd off with = _set hive.optimize.index.filter=3Dfalse;_ helps. We believe it was the https://jira.apache.org/jira/browse/ORC-341, which in= troduced it. org.apache.orc.impl.SerializationUtils utc convertion is rather strange: {quote}public static long convertToUtc(TimeZone local, long time) { =C2=A0=C2=A0 int offset =3D local.getOffset(time); =C2=A0=C2=A0 return time + offset; } {quote} This adds a 3 hour offset to our timestamp in UTC+3 timezone (shouldn't it = substract 3 hours, btw?). If org.apache.orc.impl.TimestampStatisticsImpl is used with useUTCTimestamp= =3Dfalse, the timestamp is converted back in a compatible way via Serializa= tionUtils.convertFromUtc. But hive seems to override default org.apache.orc= .OrcFile.ReaderOptions with org.apache.hadoop.hive.ql.io.orc.ReaderOptions = which have useUTCTimestamp(true) in it's constructor. With useUTCTimestamp= =3Dtrue evaluatePredicateProto predictate is using=C2=A0 TimestampStatistic= sImpl.getMaximumUTC(), which returns the timestamp as is, i.e. in the examp= le it's "{{2018-12-24 21:30:00 }}UTC+3".=20 At the same time the predicate is not shifted (the value in this tez log is= in UTC+3): {quote}2018-12-24 22:12:16,205 [INFO] [InputInitializer \{Map 1} #0] |orc.O= rcInputFormat|: ORC pushdown predicate: leaf-0 =3D (LESS_THAN ts 2018-12-24= 19:30:00.0), expr =3D leaf-0 {quote} -- This message was sent by Atlassian JIRA (v7.6.3#76005)