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 8A194200D1B for ; Thu, 12 Oct 2017 10:14:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 888DB1609E8; Thu, 12 Oct 2017 08:14:28 +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 017EF1609CD for ; Thu, 12 Oct 2017 10:14:27 +0200 (CEST) Received: (qmail 30373 invoked by uid 500); 12 Oct 2017 08:14:27 -0000 Mailing-List: contact issues-help@carbondata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.apache.org Delivered-To: mailing list issues@carbondata.apache.org Received: (qmail 30364 invoked by uid 99); 12 Oct 2017 08:14:27 -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; Thu, 12 Oct 2017 08:14:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 07B32DF9AF; Thu, 12 Oct 2017 08:14:27 +0000 (UTC) From: ravipesala To: issues@carbondata.apache.org Reply-To: issues@carbondata.apache.org References: In-Reply-To: Subject: [GitHub] carbondata pull request #1402: [CARBONDATA-1539] Change data type from enum ... Content-Type: text/plain Message-Id: <20171012081427.07B32DF9AF@git1-us-west.apache.org> Date: Thu, 12 Oct 2017 08:14:27 +0000 (UTC) archived-at: Thu, 12 Oct 2017 08:14:28 -0000 Github user ravipesala commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1402#discussion_r144220468 --- Diff: core/src/main/java/org/apache/carbondata/core/scan/collector/impl/AbstractScannedResultCollector.java --- @@ -89,24 +90,23 @@ protected void fillMeasureData(Object[] msrValues, int offset, protected Object getMeasureData(ColumnPage dataChunk, int index, CarbonMeasure carbonMeasure) { if (!dataChunk.getNullBits().get(index)) { - switch (carbonMeasure.getDataType()) { - case SHORT: - return (short)dataChunk.getLong(index); - case INT: - return (int)dataChunk.getLong(index); - case LONG: - return dataChunk.getLong(index); - case DECIMAL: - BigDecimal bigDecimalMsrValue = - dataChunk.getDecimal(index); - if (null != bigDecimalMsrValue && carbonMeasure.getScale() > bigDecimalMsrValue.scale()) { - bigDecimalMsrValue = - bigDecimalMsrValue.setScale(carbonMeasure.getScale(), RoundingMode.HALF_UP); - } - // convert data type as per the computing engine - return DataTypeUtil.getDataTypeConverter().convertToDecimal(bigDecimalMsrValue); - default: - return dataChunk.getDouble(index); + DataType dataType = carbonMeasure.getDataType(); + if (dataType == DataTypes.SHORT) { --- End diff -- But I feel changes are small and looks good to use switch case instead of using if else. ---