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 7A6F0200D46 for ; Sun, 26 Nov 2017 22:24:51 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 79010160BFF; Sun, 26 Nov 2017 21:24:51 +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 C1A2B160BEE for ; Sun, 26 Nov 2017 22:24:50 +0100 (CET) Received: (qmail 72173 invoked by uid 500); 26 Nov 2017 21:24:50 -0000 Mailing-List: contact reviews-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@spark.apache.org Received: (qmail 72162 invoked by uid 99); 26 Nov 2017 21:24:49 -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; Sun, 26 Nov 2017 21:24:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A1069DFA09; Sun, 26 Nov 2017 21:24:49 +0000 (UTC) From: hvanhovell To: reviews@spark.apache.org Reply-To: reviews@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request #19815: [SPARK-22602][SQL] remove ColumnVector#loadBytes Content-Type: text/plain Message-Id: <20171126212449.A1069DFA09@git1-us-west.apache.org> Date: Sun, 26 Nov 2017 21:24:49 +0000 (UTC) archived-at: Sun, 26 Nov 2017 21:24:51 -0000 Github user hvanhovell commented on a diff in the pull request: https://github.com/apache/spark/pull/19815#discussion_r153082266 --- Diff: sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java --- @@ -324,24 +315,27 @@ public void putDecimal(int rowId, Decimal value, int precision) { @Override public UTF8String getUTF8String(int rowId) { if (dictionary == null) { - ColumnarArray a = getByteArray(rowId); - return UTF8String.fromBytes(a.byteArray, a.byteArrayOffset, a.length); + return childColumns[0].getUTF8String0(getArrayOffset(rowId), getArrayLength(rowId)); } else { byte[] bytes = dictionary.decodeToBinary(dictionaryIds.getDictId(rowId)); return UTF8String.fromBytes(bytes); } } + /** + * Returns a UTF8String whose data comes from [rowId, rowId + count] of this vector. + * This method is similar to {@link ColumnVector#getBytes(int, int)}, but can save data copy as + * UTF8String is used as a pointer. + */ + protected abstract UTF8String getUTF8String0(int rowId, int count); + /** * Returns the byte array for rowId. */ @Override public byte[] getBinary(int rowId) { if (dictionary == null) { - ColumnarArray array = getByteArray(rowId); - byte[] bytes = new byte[array.length]; - System.arraycopy(array.byteArray, array.byteArrayOffset, bytes, 0, bytes.length); - return bytes; + return childColumns[0].getBytes(getArrayOffset(rowId), getArrayLength(rowId)); --- End diff -- Same here, use `arrayData()`. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org For additional commands, e-mail: reviews-help@spark.apache.org