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 E6D89200BA0 for ; Fri, 30 Sep 2016 06:07:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E4FCB160AE4; Fri, 30 Sep 2016 04:07:59 +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 3019F160AE3 for ; Fri, 30 Sep 2016 06:07:59 +0200 (CEST) Received: (qmail 44211 invoked by uid 500); 30 Sep 2016 04:07:58 -0000 Mailing-List: contact reviews-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@impala.incubator.apache.org Received: (qmail 44196 invoked by uid 99); 30 Sep 2016 04:07:57 -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; Fri, 30 Sep 2016 04:07:57 +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 8F8F7C680F for ; Fri, 30 Sep 2016 04:07:57 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.362 X-Spam-Level: X-Spam-Status: No, score=0.362 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id yjKt3dUrWjkd for ; Fri, 30 Sep 2016 04:07:55 +0000 (UTC) Received: from ip-10-146-233-104.ec2.internal (ec2-75-101-130-251.compute-1.amazonaws.com [75.101.130.251]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 636FA5FB5E for ; Fri, 30 Sep 2016 04:07:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ip-10-146-233-104.ec2.internal (8.14.4/8.14.4) with ESMTP id u8U47qRT023543; Fri, 30 Sep 2016 04:07:52 GMT Message-Id: <201609300407.u8U47qRT023543@ip-10-146-233-104.ec2.internal> Date: Fri, 30 Sep 2016 04:07:52 +0000 From: "Youwei Wang (Code Review)" To: Youwei Wang , impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Jim Apple , Mostafa Mokhtar , Alex Behm Reply-To: youwei.a.wang@intel.com X-Gerrit-MessageType: newpatchset Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-889=3A_Add_support_for_an_ISO-SQL_compliant_trim=28=29_function=2E=0A?= X-Gerrit-Change-Id: I4753c608b0b00569bf8c5e95b132df6df358e602 X-Gerrit-ChangeURL: X-Gerrit-Commit: f71822ecddc8024043fc049b83ad9892d04934f4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.12.2 archived-at: Fri, 30 Sep 2016 04:08:00 -0000 Youwei Wang has uploaded a new patch set (#4). Change subject: IMPALA-889: Add support for an ISO-SQL compliant trim() function. ...................................................................... IMPALA-889: Add support for an ISO-SQL compliant trim() function. Purpose: Removes all instances of one or more characters from the specified direction(s) of a STRING value. Syntax #1 TRIM(where FROM string_to_be_trimmed); Syntax #2 TRIM(trim_char_set FROM string_to_be_trimmed); Syntax #3 TRIM(where trim_char_set FROM string_to_be_trimmed); Syntax #3 confirms the standard SQL syntax (Core SQL feature ID E021-09). "where": Case-insensitive trim direction. Valid options are: leading|trailing|both. leading means trimming characters from the start; trailing means trimming characters from the end; both means trimming characters from both sides. These options should be provided without single/double quotation marks since they are not string literals but identifiers. NULL or empty argument implies "both" option. If an invalid option is specified, returns target untouched. "trim_char_set": Case-sensitive characters to be removed. This argument is regarded as a character set going to be removed. So the occurrence order of each character doesn't matter and duplicated instance of same character will be ignored. NULL argument implies " "(space) by default. Empty argument return string_to_be_trimmed untouched. "target": Case-sensitive target string to trim. This argument can be NULL. Blank argument causes parsing error. Note: For Syntax #1, since no "characters" is specified, it trims " "(space) by default. For Syntax #2, since no "where" is specified, the option both is implied by default. Return type: string Examples: Syntax #1: trim(both 'abfg%' from 'abc%%defg%%%%%'); returns 'c%%de'; trim(leading FROM ' 123 '); returns '123 '; trim(trailing FROM ' 123 '); returns ' 123'; Syntax #2: trim('&@' FROM '&@&@&@&127+1-@&@&@&@')"; returns "127+1-"; Syntax #3: trim(leading 'ab%' from 'abc%%defg%%%%%'); returns 'c%%defg%%%%%'; trim(trailing 'bfg%' from 'abc%%defg%%%%%'); returns 'abc%%de'; trim(both 'abfg%' from 'abc%%defg%%%%%')"; returns "c%%de"; Change-Id: I4753c608b0b00569bf8c5e95b132df6df358e602 --- M be/src/exprs/expr-test.cc M be/src/exprs/string-functions-ir.cc M be/src/exprs/string-functions.h M common/function-registry/impala_functions.py A common/function-registry/string-functions-ir.cc M common/thrift/Exprs.thrift M fe/src/main/cup/sql-parser.cup A fe/src/main/java/com/cloudera/impala/analysis/TrimExpr.java M fe/src/main/jflex/sql-scanner.flex M fe/src/test/java/com/cloudera/impala/analysis/AnalyzeExprsTest.java 10 files changed, 1,439 insertions(+), 30 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/74/4474/4 -- To view, visit http://gerrit.cloudera.org:8080/4474 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4753c608b0b00569bf8c5e95b132df6df358e602 Gerrit-PatchSet: 4 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Youwei Wang Gerrit-Reviewer: Alex Behm Gerrit-Reviewer: Jim Apple Gerrit-Reviewer: Mostafa Mokhtar Gerrit-Reviewer: Youwei Wang