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 04502200BD1 for ; Mon, 28 Nov 2016 16:25:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 02FF6160B22; Mon, 28 Nov 2016 15:25:00 +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 57476160B06 for ; Mon, 28 Nov 2016 16:24:59 +0100 (CET) Received: (qmail 78019 invoked by uid 500); 28 Nov 2016 15:24:58 -0000 Mailing-List: contact issues-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list issues@drill.apache.org Received: (qmail 77995 invoked by uid 99); 28 Nov 2016 15:24:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Nov 2016 15:24:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 5112E2C0079 for ; Mon, 28 Nov 2016 15:24:58 +0000 (UTC) Date: Mon, 28 Nov 2016 15:24:58 +0000 (UTC) From: "Paul Rogers (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DRILL-5070) Code gen: create methods in fixed order to allow test verification MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 28 Nov 2016 15:25:00 -0000 [ https://issues.apache.org/jira/browse/DRILL-5070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul Rogers updated DRILL-5070: ------------------------------- Summary: Code gen: create methods in fixed order to allow test verification (was: Code cache compares sources, but method order varies) > Code gen: create methods in fixed order to allow test verification > ------------------------------------------------------------------ > > Key: DRILL-5070 > URL: https://issues.apache.org/jira/browse/DRILL-5070 > Project: Apache Drill > Issue Type: Bug > Affects Versions: 1.8.0 > Reporter: Paul Rogers > Priority: Minor > > The Drill generated code cache compares the sources from two different generation events to detect duplicate code. Unfortunately, the code generator emits methods in the order returned by {{Class.getDeclaredMethods}}, but this method makes no guarantee about the order of the methods. > This issue appeared when attempting to modify tests to capture generated code for comparison to future results. Even a simple generated case from {{ExpressionTest.testBasicExpression()}} that generates {{if(true) then 1 else 0 end}} (all constants) produced methods in different orders on each test run. > The fix is simple, in the {{SignatureHolder}} constructor, sort methods by name after retrieving them from the class. The sort ensures that method order is deterministic. Fortunately, the number of methods is small, so the sort step adds little cost. > Without this fix, it is likely that the code cache holds many "copies" of the same code: equivalent code but with different method orders. After this fix, the cache should hold only one copy of each bit of equivalent code. -- This message was sent by Atlassian JIRA (v6.3.4#6332)