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 5C959200BFF for ; Tue, 13 Dec 2016 01:28:27 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 5B2C6160B22; Tue, 13 Dec 2016 00:28:27 +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 A2688160B2A for ; Tue, 13 Dec 2016 01:28:26 +0100 (CET) Received: (qmail 30261 invoked by uid 500); 13 Dec 2016 00:28:25 -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 30076 invoked by uid 99); 13 Dec 2016 00:28:25 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Dec 2016 00:28:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 314E81AAA82 for ; Tue, 13 Dec 2016 00:28:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.363 X-Spam-Level: X-Spam-Status: No, score=0.363 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 70_4IrNb0Jdq for ; Tue, 13 Dec 2016 00:28:23 +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 mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 9EC415FDAB for ; Tue, 13 Dec 2016 00:28:22 +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 uBD0QJVr019325; Tue, 13 Dec 2016 00:26:19 GMT Message-Id: <201612130026.uBD0QJVr019325@ip-10-146-233-104.ec2.internal> Date: Tue, 13 Dec 2016 00:26:19 +0000 From: "Michael Brown (Code Review)" To: impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: David Knupp , Taras Bobrovytsky Reply-To: mikeb@cloudera.com X-Gerrit-MessageType: newpatchset Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-4355=3A_random_query_generator=3A_modify_statement_execution_flow_to_support_DML=0A?= X-Gerrit-Change-Id: Ia4c63a2223185d0e056cc5713796772e5d1b8414 X-Gerrit-ChangeURL: X-Gerrit-Commit: 63331dea848c07072324d02d5b66176f2bcb3045 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: Tue, 13 Dec 2016 00:28:27 -0000 Michael Brown has uploaded a new patch set (#2). Change subject: IMPALA-4355: random query generator: modify statement execution flow to support DML ...................................................................... IMPALA-4355: random query generator: modify statement execution flow to support DML - Rework the discrepancy searcher to run DML statements. We do this by using the query profile to choose a table, copy that table, and generate a statement that will INSERT into that copy. We chose a slow copy over other methods because INSERTing into a copy is a more reliable test that prevents table sizes from getting out of hand or time-consuming replay to reproduce a particular statement. - Introduce a statement generator stub. The real generator work is tracked in IMPALA-4351 and IMPALA-4353. Here we simply generate a basic INSERT INTO ... VALUES statement to make sure our general query execution flow is working. - Add query profile stub for DML statements (INSERT-only at this time). Since we'll want INSERT INTO ... SELECT very soon, this inherits from DefaultProfile. Also add building blocks for choosing random statements in the DefaultProfile. - Improve the concept of an "execution mode" and add new modes. Before, we had "RAW", "CREATE_TABLE_AS", and "CREATE_VIEW_AS". The idea here is that some random SELECT queries could be generated as "CREATE TABLE|VIEW AS" at execution time, based on weights in the query profile. First, we remove the use of raw string literals for this, since raw string literals can be error-prone, and introduce a StatementExecutionMode class to contain a namespace for the enumerated statement execution modes. Second, we introduce a couple new execution modes. The first is DML_SETUP: this is a DML statement that needs to be run in both the test and reference databases concurrently. For our purposes, it's the INSERT ... SELECT that copies data from the chosen random table into the table copy. The second is DML_TEST: this is a randomly-generated DML statement. - Switch to using absolute imports in many places. There was a mix of absolute and relative imports happening here, and they were causing problems, especially when comparing data types. In Python, != . Using from __future__ import absolute_import didn't seem to catch the relative import usage anyway, so I haven't employed that. - Rename some, but not nearly all, names from "query" to "statement". Doing this is a rather large undertaking leading to much larger diffs and testing (IMPALA-4602). - Fix a handful of flake8 warnings. There are a bunch that went unfixed for over- and under-indentation. - Testing o ./discrepancy_searcher.py runs with and without --explain-only, and with --profile default and --profile dmlonly o Leopard run to make sure standard SELECT-only generation still works o Generated random stress queries locally o Generated random data locally Change-Id: Ia4c63a2223185d0e056cc5713796772e5d1b8414 --- M tests/comparison/cli_options.py M tests/comparison/common.py M tests/comparison/data_generator.py M tests/comparison/data_generator_mapred_common.py M tests/comparison/db_connection.py M tests/comparison/discrepancy_searcher.py M tests/comparison/funcs.py M tests/comparison/leopard/job.py M tests/comparison/model_translator.py M tests/comparison/query.py M tests/comparison/query_flattener.py M tests/comparison/query_generator.py M tests/comparison/query_profile.py M tests/comparison/random_val_generator.py A tests/comparison/statement_generator.py M tests/comparison/tests/test_use_nested_with.py M tests/stress/concurrent_select.py 17 files changed, 324 insertions(+), 95 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/87/5387/2 -- To view, visit http://gerrit.cloudera.org:8080/5387 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia4c63a2223185d0e056cc5713796772e5d1b8414 Gerrit-PatchSet: 2 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Michael Brown Gerrit-Reviewer: David Knupp Gerrit-Reviewer: Michael Brown Gerrit-Reviewer: Taras Bobrovytsky