Michael Brown has uploaded a new change for review. http://gerrit.cloudera.org:8080/5520
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, <class 'db_types.Int'> != <class 'tests.comparison.db_types.Int'>. 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. For tpch_kudu data, it seems sufficient to use a --timeout of about 300. 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 change the suffix name Change-Id: Ia427f3d793cdf85411603cc97805e96c6e868713 load number of rows INSERTed Change-Id: Ibc17f2bf6e71039203337443102f9ceb796310f9 move cleaning up to main thread Change-Id: Ide3f1c292820f101ac377a48759b08b178ece331 make execution a property Change-Id: I3d1e74252110ed6935aca2946716697850f695a3 count number of statements that added rows, and row count Change-Id: I0b5ac07f79ada861f72aec1da3460ca8b8d290a2 --- 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, 371 insertions(+), 100 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/20/5520/1 -- To view, visit http://gerrit.cloudera.org:8080/5520 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0b5ac07f79ada861f72aec1da3460ca8b8d290a2 Gerrit-PatchSet: 1 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Michael Brown <mi...@cloudera.com>