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 875AC200B41 for ; Thu, 23 Jun 2016 00:36:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 86305160A64; Wed, 22 Jun 2016 22:36:16 +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 C9B5D160A36 for ; Thu, 23 Jun 2016 00:36:15 +0200 (CEST) Received: (qmail 53936 invoked by uid 500); 22 Jun 2016 22:36:15 -0000 Mailing-List: contact dev-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 dev@drill.apache.org Received: (qmail 53924 invoked by uid 99); 22 Jun 2016 22:36:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2016 22:36:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4E093DFEDA; Wed, 22 Jun 2016 22:36:14 +0000 (UTC) From: jinfengni To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #521: DRILL-4715: Fix java compilation error in run-time ... Content-Type: text/plain Message-Id: <20160622223614.4E093DFEDA@git1-us-west.apache.org> Date: Wed, 22 Jun 2016 22:36:14 +0000 (UTC) archived-at: Wed, 22 Jun 2016 22:36:16 -0000 Github user jinfengni commented on a diff in the pull request: https://github.com/apache/drill/pull/521#discussion_r68147991 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/ClassGenerator.java --- @@ -215,22 +218,47 @@ public JVar declareVectorValueSetupAndMember(DirectExpression batchName, TypedFi return vv; } + public enum BlkCreateMode { + TRUE, // Create new block + FALSE, // Do not create block; put into existing block. + TRUE_IF_BOUND // Create new block only if # of expressions added hit upper-bound (ExecConstants.CODE_GEN_EXP_IN_METHOD_SIZE) + } + public HoldingContainer addExpr(LogicalExpression ex) { - return addExpr(ex, true); + // default behavior is always to put expression into new block. + return addExpr(ex, BlkCreateMode.TRUE); } - public HoldingContainer addExpr(LogicalExpression ex, boolean rotate) { -// logger.debug("Adding next write {}", ex); - if (rotate) { - rotateBlock(); + public HoldingContainer addExpr(LogicalExpression ex, BlkCreateMode mode) { + if (mode == BlkCreateMode.TRUE || mode == BlkCreateMode.TRUE_IF_BOUND) { + rotateBlock(mode); } + + for (LinkedList b : blocks) { + b.getLast().incCounter(); + } + return evaluationVisitor.addExpr(ex, this); } public void rotateBlock() { - evaluationVisitor.previousExpressions.clear(); - for (LinkedList b : blocks) { - b.add(new JBlock(true, true)); + // default behavior is always to create new block. + rotateBlock(BlkCreateMode.TRUE); + } + + private void rotateBlock(BlkCreateMode mode) { + boolean blockRotated = false; + for (LinkedList b : blocks) { + if (mode == BlkCreateMode.TRUE || + (mode == BlkCreateMode.TRUE_IF_BOUND && + optionManager != null && + b.getLast().getCount() > optionManager.getOption(ExecConstants.CODE_GEN_EXP_IN_METHOD_SIZE).num_val)) { --- End diff -- Done. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---