From issues-return-172449-archive-asf-public=cust-asf.ponee.io@hive.apache.org Tue Nov 19 20:41:05 2019 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 [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id E47BE180660 for ; Tue, 19 Nov 2019 21:41:04 +0100 (CET) Received: (qmail 32702 invoked by uid 500); 19 Nov 2019 20:41:03 -0000 Mailing-List: contact issues-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list issues@hive.apache.org Received: (qmail 32678 invoked by uid 99); 19 Nov 2019 20:41:03 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Nov 2019 20:41:03 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5F44CE3150 for ; Tue, 19 Nov 2019 20:41:02 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 9417D78088A for ; Tue, 19 Nov 2019 20:41:00 +0000 (UTC) Date: Tue, 19 Nov 2019 20:41:00 +0000 (UTC) From: "Hive QA (Jira)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HIVE-22513) Constant propagation of casted column in filter ops can cause incorrect results MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-22513?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1697= 7824#comment-16977824 ]=20 Hive QA commented on HIVE-22513: -------------------------------- Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12986234/HIVE-22513.0.patc= h {color:red}ERROR:{color} -1 due to no test(s) being added or modified. {color:red}ERROR:{color} -1 due to 1 failed/errored test(s), 17703 tests ex= ecuted *Failed tests:* {noformat} TestStatsReplicationScenariosACIDNoAutogather - did not produce a TEST-*.xm= l file (likely timed out) (batchId=3D256) {noformat} Test results: https://builds.apache.org/job/PreCommit-HIVE-Build/19498/test= Report Console output: https://builds.apache.org/job/PreCommit-HIVE-Build/19498/co= nsole Test logs: http://104.198.109.242/logs/PreCommit-HIVE-Build-19498/ Messages: {noformat} Executing org.apache.hive.ptest.execution.TestCheckPhase Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.YetusPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 1 tests failed {noformat} This message is automatically generated. ATTACHMENT ID: 12986234 - PreCommit-HIVE-Build > Constant propagation of casted column in filter ops can cause incorrect r= esults > -------------------------------------------------------------------------= ------ > > Key: HIVE-22513 > URL: https://issues.apache.org/jira/browse/HIVE-22513 > Project: Hive > Issue Type: Bug > Reporter: =C3=81d=C3=A1m Szita > Assignee: =C3=81d=C3=A1m Szita > Priority: Major > Attachments: HIVE-22513.0.patch > > > This issue happens if CBO is disabled. > We should not be propagating constants if the corresponding=C2=A0ExprNode= ColumnDesc instance is wrapped inside a CAST operator as casting might trun= cate information from the original column. > This can happen if we're using CAST in a WHERE clause, which will cause t= he projected columns to be replaced in a SELECT operator. Their new value w= ill be the result of casting which could be a different value compared to t= hat in the original column: > {code:java} > set hive.cbo.enable=3Dfalse; > set hive.fetch.task.conversion=3Dmore; --just for testing convenience > create table testtb (id string); > insert into testtb values('2019-11-05 01:01:11'); > select id, CAST(id AS VARCHAR(10)) from testtb where CAST(id AS VARCHAR(9= )) =3D '2019-11-0'; > +------------+------------+ > | =C2=A0 =C2=A0 id =C2=A0 =C2=A0 |=C2=A0 =C2=A0 _c1 =C2=A0 =C2=A0 | > +------------+------------+ > | 2019-11-0=C2=A0 | 2019-11-0=C2=A0 | > +------------+------------+ > 1 row selected (0.168 seconds) > -- VS expected: 2019-11-05 01:01:11=C2=A0| 2019-11-05=C2=A0{code} > As to what types of casting (from and where types) cause information loss= it's hard to properly keep track of, and I don't think it should be taken = into consideration when deciding whether or not to propagate a constant. Ra= ther than adding a big and potentially convoluted and fragile check for thi= s, I propose to prevent constant mappings to be spawned out of CASTed colum= ns. -- This message was sent by Atlassian Jira (v8.3.4#803005)