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 1FF4C200CF3 for ; Tue, 29 Aug 2017 20:23:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1E56B1674E1; Tue, 29 Aug 2017 18:23:07 +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 45FB61674E3 for ; Tue, 29 Aug 2017 20:23:06 +0200 (CEST) Received: (qmail 84353 invoked by uid 500); 29 Aug 2017 18:23:05 -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 84340 invoked by uid 99); 29 Aug 2017 18:23:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Aug 2017 18:23:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 5433AC2AEA for ; Tue, 29 Aug 2017 18:23:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id GtsX9kBTNCgJ for ; Tue, 29 Aug 2017 18:23:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id C6CAD61254 for ; Tue, 29 Aug 2017 18:23:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8230EE0ED2 for ; Tue, 29 Aug 2017 18:23:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 86C062416C for ; Tue, 29 Aug 2017 18:23:00 +0000 (UTC) Date: Tue, 29 Aug 2017 18:23:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-4264) Allow field names to include dots MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 29 Aug 2017 18:23:07 -0000 [ https://issues.apache.org/jira/browse/DRILL-4264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16145834#comment-16145834 ] ASF GitHub Bot commented on DRILL-4264: --------------------------------------- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/909#discussion_r135868684 --- Diff: contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/binary/CompareFunctionsProcessor.java --- @@ -82,466 +45,37 @@ public static CompareFunctionsProcessor process(FunctionCall call, boolean nullC LogicalExpression swapArg = valueArg; valueArg = nameArg; nameArg = swapArg; - evaluator.functionName = COMPARE_FUNCTIONS_TRANSPOSE_MAP.get(functionName); + evaluator.setFunctionName(COMPARE_FUNCTIONS_TRANSPOSE_MAP.get(functionName)); } - evaluator.success = nameArg.accept(evaluator, valueArg); + evaluator.setSuccess(nameArg.accept(evaluator, valueArg)); } else if (nullComparatorSupported && call.args.get(0) instanceof SchemaPath) { - evaluator.success = true; - evaluator.path = (SchemaPath) nameArg; + evaluator.setSuccess(true); + evaluator.setPath((SchemaPath) nameArg); } return evaluator; } - public CompareFunctionsProcessor(String functionName) { - this.success = false; - this.functionName = functionName; - this.isEqualityFn = COMPARE_FUNCTIONS_TRANSPOSE_MAP.containsKey(functionName) - && COMPARE_FUNCTIONS_TRANSPOSE_MAP.get(functionName).equals(functionName); - this.isRowKeyPrefixComparison = false; - this.sortOrderAscending = true; - } - - public byte[] getValue() { - return value; - } - - public boolean isSuccess() { - return success; - } - - public SchemaPath getPath() { - return path; - } - - public String getFunctionName() { - return functionName; - } - - public boolean isRowKeyPrefixComparison() { - return isRowKeyPrefixComparison; - } - - public byte[] getRowKeyPrefixStartRow() { - return rowKeyPrefixStartRow; - } - - public byte[] getRowKeyPrefixStopRow() { - return rowKeyPrefixStopRow; - } - - public Filter getRowKeyPrefixFilter() { - return rowKeyPrefixFilter; - } - - public boolean isSortOrderAscending() { - return sortOrderAscending; - } - @Override - public Boolean visitCastExpression(CastExpression e, LogicalExpression valueArg) throws RuntimeException { - if (e.getInput() instanceof CastExpression || e.getInput() instanceof SchemaPath) { - return e.getInput().accept(this, valueArg); - } - return false; - } - - @Override - public Boolean visitConvertExpression(ConvertExpression e, LogicalExpression valueArg) throws RuntimeException { - if (e.getConvertFunction() == ConvertExpression.CONVERT_FROM) { - - String encodingType = e.getEncodingType(); - int prefixLength = 0; - - // Handle scan pruning in the following scenario: - // The row-key is a composite key and the CONVERT_FROM() function has byte_substr() as input function which is - // querying for the first few bytes of the row-key(start-offset 1) - // Example WHERE clause: - // CONVERT_FROM(BYTE_SUBSTR(row_key, 1, 8), 'DATE_EPOCH_BE') < DATE '2015-06-17' - if (e.getInput() instanceof FunctionCall) { - - // We can prune scan range only for big-endian encoded data - if (encodingType.endsWith("_BE") == false) { - return false; - } - - FunctionCall call = (FunctionCall)e.getInput(); - String functionName = call.getName(); - if (!functionName.equalsIgnoreCase("byte_substr")) { - return false; - } - - LogicalExpression nameArg = call.args.get(0); - LogicalExpression valueArg1 = call.args.size() >= 2 ? call.args.get(1) : null; - LogicalExpression valueArg2 = call.args.size() >= 3 ? call.args.get(2) : null; - - if (((nameArg instanceof SchemaPath) == false) || - (valueArg1 == null) || ((valueArg1 instanceof IntExpression) == false) || - (valueArg2 == null) || ((valueArg2 instanceof IntExpression) == false)) { - return false; - } - - boolean isRowKey = ((SchemaPath)nameArg).getAsUnescapedPath().equals(DrillHBaseConstants.ROW_KEY); - int offset = ((IntExpression)valueArg1).getInt(); - - if (!isRowKey || (offset != 1)) { - return false; - } - - this.path = (SchemaPath)nameArg; - prefixLength = ((IntExpression)valueArg2).getInt(); - this.isRowKeyPrefixComparison = true; - return visitRowKeyPrefixConvertExpression(e, prefixLength, valueArg); - } - - if (e.getInput() instanceof SchemaPath) { - ByteBuf bb = null; - - switch (encodingType) { - case "INT_BE": - case "INT": - case "UINT_BE": - case "UINT": - case "UINT4_BE": - case "UINT4": - if (valueArg instanceof IntExpression - && (isEqualityFn || encodingType.startsWith("U"))) { - bb = newByteBuf(4, encodingType.endsWith("_BE")); - bb.writeInt(((IntExpression)valueArg).getInt()); - } - break; - case "BIGINT_BE": - case "BIGINT": - case "UINT8_BE": - case "UINT8": - if (valueArg instanceof LongExpression - && (isEqualityFn || encodingType.startsWith("U"))) { - bb = newByteBuf(8, encodingType.endsWith("_BE")); - bb.writeLong(((LongExpression)valueArg).getLong()); - } - break; - case "FLOAT": - if (valueArg instanceof FloatExpression && isEqualityFn) { - bb = newByteBuf(4, true); - bb.writeFloat(((FloatExpression)valueArg).getFloat()); - } - break; - case "DOUBLE": - if (valueArg instanceof DoubleExpression && isEqualityFn) { - bb = newByteBuf(8, true); - bb.writeDouble(((DoubleExpression)valueArg).getDouble()); - } - break; - case "TIME_EPOCH": - case "TIME_EPOCH_BE": - if (valueArg instanceof TimeExpression) { - bb = newByteBuf(8, encodingType.endsWith("_BE")); - bb.writeLong(((TimeExpression)valueArg).getTime()); - } - break; - case "DATE_EPOCH": - case "DATE_EPOCH_BE": - if (valueArg instanceof DateExpression) { - bb = newByteBuf(8, encodingType.endsWith("_BE")); - bb.writeLong(((DateExpression)valueArg).getDate()); - } - break; - case "BOOLEAN_BYTE": - if (valueArg instanceof BooleanExpression) { - bb = newByteBuf(1, false /* does not matter */); - bb.writeByte(((BooleanExpression)valueArg).getBoolean() ? 1 : 0); - } - break; - case "DOUBLE_OB": - case "DOUBLE_OBD": - if (valueArg instanceof DoubleExpression) { - bb = newByteBuf(9, true); - PositionedByteRange br = new SimplePositionedMutableByteRange(bb.array(), 0, 9); - if (encodingType.endsWith("_OBD")) { - org.apache.hadoop.hbase.util.OrderedBytes.encodeFloat64(br, - ((DoubleExpression)valueArg).getDouble(), Order.DESCENDING); - this.sortOrderAscending = false; - } else { - org.apache.hadoop.hbase.util.OrderedBytes.encodeFloat64(br, - ((DoubleExpression)valueArg).getDouble(), Order.ASCENDING); - } + protected ByteBuf getByteBuf(LogicalExpression valueArg, String encodingType) { --- End diff -- Thanks! > Allow field names to include dots > --------------------------------- > > Key: DRILL-4264 > URL: https://issues.apache.org/jira/browse/DRILL-4264 > Project: Apache Drill > Issue Type: Improvement > Components: Execution - Codegen > Reporter: Alex > Assignee: Volodymyr Vysotskyi > Labels: doc-impacting > Fix For: 1.12.0 > > > If you have some json data like this... > {code:javascript} > { > "0.0.1":{ > "version":"0.0.1", > "date_created":"2014-03-15" > }, > "0.1.2":{ > "version":"0.1.2", > "date_created":"2014-05-21" > } > } > {code} > ... there is no way to select any of the rows since their identifiers contain dots and when trying to select them, Drill throws the following error: > Error: SYSTEM ERROR: UnsupportedOperationException: Unhandled field reference "0.0.1"; a field reference identifier must not have the form of a qualified name > This must be fixed since there are many json data files containing dots in some of the keys (e.g. when specifying version numbers etc) -- This message was sent by Atlassian JIRA (v6.4.14#64029)