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 ECA9D200D5D for ; Wed, 20 Dec 2017 09:02:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id EAFDB160C15; Wed, 20 Dec 2017 08:02:04 +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 3E1F9160C0A for ; Wed, 20 Dec 2017 09:02:04 +0100 (CET) Received: (qmail 90258 invoked by uid 500); 20 Dec 2017 08:02:03 -0000 Mailing-List: contact issues-help@kylin.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kylin.apache.org Delivered-To: mailing list issues@kylin.apache.org Received: (qmail 90249 invoked by uid 99); 20 Dec 2017 08:02:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Dec 2017 08:02:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id D7CA41805CC for ; Wed, 20 Dec 2017 08:02:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-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=[RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id TzjJ7zCNz46X for ; Wed, 20 Dec 2017 08:02:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 132C75F1EE for ; Wed, 20 Dec 2017 08:02:01 +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 59934E012B for ; Wed, 20 Dec 2017 08:02:00 +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 1DB31240DA for ; Wed, 20 Dec 2017 08:02:00 +0000 (UTC) Date: Wed, 20 Dec 2017 08:02:00 +0000 (UTC) From: "peng.jianhua (JIRA)" To: issues@kylin.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (KYLIN-3119) Fix a few bugs in function 'massageSql' of 'QueryUtil.java' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 20 Dec 2017 08:02:05 -0000 [ https://issues.apache.org/jira/browse/KYLIN-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] peng.jianhua updated KYLIN-3119: -------------------------------- Description: public static String massageSql(String sql, String project, int limit, int offset, String defaultSchema) { sql = sql.trim(); sql = sql.replace("\r", " ").replace("\n", System.getProperty("line.separator")); KylinConfig kylinConfig = KylinConfig.getInstanceFromEnv(); while (sql.endsWith(";")) sql = sql.substring(0, sql.length() - 1); if (limit > 0 && !sql.toLowerCase().contains("limit")) { sql += ("\nLIMIT " + limit); } if (offset > 0 && !sql.toLowerCase().contains("offset")) { sql += ("\nOFFSET " + offset); } // https://issues.apache.org/jira/browse/KYLIN-2649 if (kylinConfig.getForceLimit() > 0 && !sql.toLowerCase().contains("limit") && sql.toLowerCase().contains("*")) { sql += ("\nLIMIT " + kylinConfig.getForceLimit()); } // customizable SQL transformation if (queryTransformers == null) { initQueryTransformers(); } for (IQueryTransformer t : queryTransformers) { sql = t.transform(sql, project, defaultSchema); } return sql; } > Fix a few bugs in function 'massageSql' of 'QueryUtil.java' > ----------------------------------------------------------- > > Key: KYLIN-3119 > URL: https://issues.apache.org/jira/browse/KYLIN-3119 > Project: Kylin > Issue Type: Bug > Reporter: peng.jianhua > Assignee: peng.jianhua > > public static String massageSql(String sql, String project, int limit, int offset, String defaultSchema) { > sql = sql.trim(); > sql = sql.replace("\r", " ").replace("\n", System.getProperty("line.separator")); > KylinConfig kylinConfig = KylinConfig.getInstanceFromEnv(); > while (sql.endsWith(";")) > sql = sql.substring(0, sql.length() - 1); > if (limit > 0 && !sql.toLowerCase().contains("limit")) { > sql += ("\nLIMIT " + limit); > } > if (offset > 0 && !sql.toLowerCase().contains("offset")) { > sql += ("\nOFFSET " + offset); > } > // https://issues.apache.org/jira/browse/KYLIN-2649 > if (kylinConfig.getForceLimit() > 0 && !sql.toLowerCase().contains("limit") > && sql.toLowerCase().contains("*")) { > sql += ("\nLIMIT " + kylinConfig.getForceLimit()); > } > // customizable SQL transformation > if (queryTransformers == null) { > initQueryTransformers(); > } > for (IQueryTransformer t : queryTransformers) { > sql = t.transform(sql, project, defaultSchema); > } > return sql; > } -- This message was sent by Atlassian JIRA (v6.4.14#64029)