Commit Graph

225 Commits

Author SHA1 Message Date
Nong Li
87295a4e06 Decimal implementation.
This patch implements decimal support for text based formats.

Change-Id: I8e2c9e512ed149fe965216a72cb21fffd4f18e75
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1669
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: Nong Li <nong@cloudera.com>
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2238
Tested-by: jenkins
2014-04-14 21:07:32 -07:00
ishaan
5803e6883e Cleanup and re-enable some tests in TestPartitionMetadata
Partition metadata tests were marked as xfail because of IMPALA-624. Additionally, we had
to invoke hive to insert into two partitions pointing to the same location (this
limitation is now removed). This patch changes the test to use Impala exclusively,
removes the xfail tag and adds a teardown method to the test class.

Change-Id: I15fa97bef4f8714d0873a9c713627a198f3388ad
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2086
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2215
2014-04-13 17:55:43 -07:00
ishaan
0e0c480262 Re-enable some tests in test_describe_formatted
A few tests which dealt with running queries via hs2 and impala were marked as xfail as
hiveserver2 would occasionally not come up. Given that we now have a script that checks
whether hiveserver2 is up before continuining the build, it should be safe to remove the
xfail.

Change-Id: I2b5063e7259c01fc0ef8ffda86d85514c9cf959c
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2082
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2214
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
2014-04-13 17:51:45 -07:00
ishaan
6f416dd2c2 Close all queries in test_cancellation
The queries in test_cancellation are currently cancelled but not closed, causing some test
queries to eventually time out because the admission controller limits are passed. This
patch ensures that all queries issued in test_cancellation are closed.

Change-Id: I65b26672155e31889bb6f43d3ac87be0f7b4eb72
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2187
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2213
2014-04-13 17:45:51 -07:00
Nong Li
1a3caca8c4 [CDH5] Update execution engine to take advantage of DN caching.
This finishes up the support to use HDFS caching. The scheduler will
prefer replicas that are cached and the scan node plumbs the metadata
to the io mgr.

This is a bit hard to test without a cluster and some perf benchmarking.
I've added a basic test to make sure the path is being exercised.

Change-Id: I8762ca9ef2f88c3637113d3c5ee82f4c0ea7f1be
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2212
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
2014-04-13 17:11:21 -07:00
Skye Wanderman-Milne
e60bf29a96 IMPALA-13: Use SSE string functions that take an explicit length
This patch modifies DelimitedTextParser and StringValue to work with
data containing null characters by using SSE instructions that take a
length, rather than expecting null-terminated strings. It also adds
some other minor changes to correctly handle data with nulls and to
faciliate testing. I checked the execution time of a count(*) and a
select(*) limit 1 query locally, and saw no difference for either text
or sequence files.

Change-Id: Ia920b35bea7048aa286f39ec83e313c2a39251d1
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2110
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: Skye Wanderman-Milne <skye@cloudera.com>
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2181
2014-04-11 11:16:24 -07:00
Alex Behm
2fff51d9e9 IMP-1329,IMPALA-924: Make ExchangeNode::Open() block until rows are available.
The bug: Coordinator::Wait() is supposed to block until rows become available for
consumption by the client. We rely on Wait() to determine when to advance the query
status to a 'ready' state and signal to the client that rows can be fetched.
Long fetch times can trigger client timeouts at various levels (socket, app, etc.).
Coordinator::Wait() simply opens the coordinator fragment's plan tree.
For most plan nodes, Open() does work to prepare the plan tree, s.t., GetNext()
returns quickly. However, for ExchangeNodes Open() used to not wait
until rows are obtained form the underlying stream receiver.
The fix: Make ExchangeNode::Open() block until rows are available.

Change-Id: I7b197eea11d21fd732414d96c899a17b2d99631c
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2128
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2185
2014-04-10 23:49:38 -07:00
Henry Robinson
37236845b1 Mark test_non_codegen_tinyint_grouping as execute_serially
The test contains an INSERT and some DDL, which is racy if performed in parallel.

Change-Id: I2b88533f45756fcf6372d6ee4eb7edd474087048
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2167
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: Henry Robinson <henry@cloudera.com>
(cherry picked from commit 8b103c029cc341bacea4746c369bb58e6af5ed29)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2182
Tested-by: jenkins
2014-04-10 15:17:25 -07:00
Henry Robinson
415540d789 IMPALA-901: Fix grouping with NULLs when codegen is disabled
The standard implementation of HashTable::Equals() did not correctly
check the NULL bit when the argument row did not evaluate to NULL for a
given probe expr. In the rare circumstance that this gave rise to a
false positive (more on that below), two rows with different grouping
values would be considered equal, and one would be excluded from the
final aggregation output.

HashTable::EvalRow() fills an expression value buffer with the values of
either probe or build exprs evaluated for the argument row. These cached
values are used to determine row equality in Equals(). In order to avoid
a lot of false collisions, an 'unlikely' value is written to that buffer
for NULL values, chosen to be HashUtil::FNV_SEED. So without correct
NULL-bit checking in Equals(), two single-slot rows are considered to be
equal if one of them has NULL for its slot, and the other has a value
equal to HashUtil::FNV_SEED truncated to the size of the slot.

For tinyint columns, this value is -59. As it happens, our random
generator happened to create a table with one tinyint column and which
contained NULL and -59 as values. In order to trigger this bug, the rows
must also have been written to disk in order such that the scanners
returned -59 *first*, and then NULL to the aggregation node; the bug is
not symmetric and works in the opposite case.

Change-Id: I17d43eaeee62b2ac01b67dd599bc4346b012a074
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2130
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 6e8098254280a9d5ead0b607263ca6728a3222a7)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2161
Reviewed-by: Henry Robinson <henry@cloudera.com>
2014-04-07 17:30:52 -07:00
Henry Robinson
99c37aac37 IMPALA-827: Add an option for directories created by INSERT to inherit
their parent's permissions

This patch adds --insert_inherit_permissions. If true, all
new partition directories created by INSERT will inherit their
permissions from their parent. When false, the directories are created
with the default permissions.

Change-Id: Ib2b4c251e51ea5048387169678e8dde34ecfe5f6
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1917
Tested-by: jenkins
Reviewed-by: Henry Robinson <henry@cloudera.com>
2014-04-04 10:25:20 -07:00
Skye Wanderman-Milne
8e9776b824 Mark TestUdfs.test_mem_limits to run serially
This was causing other tests to fail with process mem limit exceeded.

Change-Id: I1407b0896052aece691c681827994961b09d8103
(cherry picked from commit 2bcc46117f504f50ded724fddf74f24bd829c6c6)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2003
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
2014-03-19 14:18:11 -07:00
Skye Wanderman-Milne
3e728f3180 Symbol mangling for UDF prepare/close functions
Change-Id: If8f1386073f467e66ada74e606fc98f3344f0733
(cherry picked from commit 32df8b3f963a2b46ec33aad86a151d4c7ecda39c)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1993
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
2014-03-19 02:15:07 -07:00
Lenni Kuff
9c3b318112 Fix test_compressed_formats to properly pull in tbl created in Hive
Change-Id: I4e143826e5900ebfa6f77023ae4cf0d2c71db190
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1960
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1967
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
2014-03-18 13:24:10 -07:00
Lenni Kuff
b7432cd68a Constrain test_explain to run only on text/none table format
The tests expect to be run against text/none tables which causes failures
on exhaustive test runs.
I don't think it adds any extra coverage to run these tests against lzo
format so added a constraint.

Change-Id: Ib0878e2ba84107c9df4499def304fe45ba4fe4b4
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1884
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: Lenni Kuff <lskuff@cloudera.com>
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1964
Tested-by: jenkins
2014-03-18 11:51:19 -07:00
Skye Wanderman-Milne
44125729dc UDF/UDA memory management improvements
* AggFnEvaluator now uses the UDF mem pool (I'm planning to change
  this to per-exec node pools in the expr refactoring)
* FunctionContext::TrackAllocation()/Free() actually use the UDF's mem tracker
* Added FunctionContextImpl::Close() which sets warnings for leaked allocations

Change-Id: I792ffd49102a92b57e34df18d8ff5f5d0fd27370
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1792
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: Skye Wanderman-Milne <skye@cloudera.com>
(cherry picked from commit 41a5f7cfa718789fa3b2de3a31f085411fb5000c)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1954
Tested-by: jenkins
2014-03-17 20:38:25 -07:00
Lenni Kuff
d7c06486e1 Disable flaky explain tests due to inconsistent per-host mem requirements
Change-Id: Ie372696c4986dc7f7c8f7fc074c41b89bd65f456
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1939
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
(cherry picked from commit ed4cb660b7a60d9b9248df525c477bab4d218c4b)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1953
Tested-by: Lenni Kuff <lskuff@cloudera.com>
2014-03-17 17:42:21 -07:00
Henry Robinson
635dd7d289 IMPALA-875: Respect isAnalyzed_ in IntLiteral expressions
Partition column expressions are analysed twice for INSERT statements -
once to infer the type and so to add a possible cast, and once to
compute stats on the resulting expr. However, this process resulted in
an partition column expr that was a IntLiteral getting the smallest type
that would contains its value, rather than retaining the
column-compatible type that had been assigned to it.

This patch does the minimum thing, which is make IntLiteral.analyze()
idempotent. Doing the same thing to Expr and LiteralExpr unearths some
other bugs, which we will have to fix in a follow-on patch (see
IMPALA-884).

Change-Id: Ie22fc5d3f4832c735a1ebc0ef78f50d736f597fd
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1931
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 1912d65ea21a5025d385948642f0d4aadad91abf)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1947
2014-03-17 17:35:12 -07:00
Lenni Kuff
dd20958e5d Minor test cleanup
* Prefer 'refresh <table name>' over 'invalidate metadata'
* Remove the 'RELOAD' test setup option that was used by only 1 test.
* Delete a .py test file that seems to be a duplicate

Change-Id: I890546635840bb8f4d55789a89f8c8f33e40d001
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1933
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1946
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
2014-03-17 17:30:15 -07:00
Skye Wanderman-Milne
be18bd8f76 IMPALA-752: Improve INSERT error message for unsupported file formats
Change-Id: Ib16817d6e49d3df30643563eb9ec5573a920bba7
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1911
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 9e93c237fde1877eb0d140e73b090f2b891f3474)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1941
2014-03-17 14:54:46 -07:00
Nong Li
88a54dc532 Restrict parquet many cols test to one test dimension.
Change-Id: Ib7e1a63a9981fc646899b627748b523119d9a5d4
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1928
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: Nong Li <nong@cloudera.com>
2014-03-16 15:37:37 -07:00
ishaan
2caf687d8d Temporarily disable explain tests for explain levels 2 and 3
The explain tests that verify we detect missing stats properly is failing for avro. This
change disables the test to unblock the full data load build.

Change-Id: I0a7f54dbf1e8a3ebb557250287e7e0491aaa27f2
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1925
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins
2014-03-15 20:13:20 -07:00
Lenni Kuff
aa0b7a35f5 IMPALA-880: COMPUTE STATS should update partitions in batches
When updating partition metadata as part of COMPUTE STATS we would previously
attempt to update all partitions at once. This could lead to HMS socket timeouts
and also could run into issues if there were > 32K partitions.

In this change we now update the partitions in batches, with a max size of 500
partitions per batch. We also compare whether the row count has changed and only
update partitions that have been modified.

Change-Id: If7bfcc30f86fc2fdd79855b981067ac29a47b5e1
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1913
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1918
2014-03-14 19:20:12 -07:00
Nong Li
6629c32d6a IMPALA-742: Fix unhandled metadata reading code path in parquet scanner.
Change-Id: I1dd6364d148fed881020c045ece635b1601f86bb
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1836
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
2014-03-14 16:08:45 -07:00
Lenni Kuff
cc1c0c61fd IMP-1291: Support "extended" ASCII characters as delimiters in text files
This fixes how we validate delimiters to be in line with Hive. A delimiter must
fit in a single byte and can be specified in the following formats, as far as I can
tell (there isn't documentation):
- A single ASCII or unicode character (ex. '|')
- An escape character in octal format (ex. \001. Stored in the metastore as a
  unicode character: \u0001).
- A signed decimal integer in the range [-128:127]. Used to support delimiters
  for ASCII character values between 128-255 (-2 maps to ASCII 254).

Previously, we were not handling the "signed integer" case so there was no way
to specify a delimiter in the "extended" ASCII range of 128-255.

To support result validation, the test infrastructure had to be updated to support
reading/writing different character encodings.

Change-Id: Ie3c4d444dc9c6e60192093ed0c0f6f151eab16bc
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1848
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1888
2014-03-13 13:00:15 -07:00
Alex Behm
748ea3f38b Fix test_partitioning.py and expected results.
Change-Id: I21148f3a10abbda4f9e587f83cbabdd2a79c6147
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1861
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1866
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
2014-03-12 11:25:17 -07:00
Lenni Kuff
08417c875f IMPALA-849: Impala does not work with boolean partition key columns
This is because in HdfsTable we call call "expr.castTo(colType)", but BooleanLiteral
(incorrectly) didn't implement "uncheckedCastTo()". This meant that instead of a
BooleanLiteral being returned we got back a CastExpr, which cannot be cast to LiteralExpr.

As part of this change it turns out Boolean partition columns are also broken in Hive. I
filed HIVE-6590 for these issues and we decided to disable INSERT into a boolean partition
column for Impala due to this bug.

Change-Id: I3e295bb96aadc08d64faf551f6393a7128a7ef27
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1755
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
2014-03-11 18:42:08 -07:00
Henry Robinson
05c8e4da93 IMPALA-624: Inserts should respect changes in partition location
Impala would ignore changes in a partition's location (by ALTER TABLE
... SET LOCATION ...).

Change-Id: I9fdc1f09f9d848aa1a4ade3d4f35f8de9cbd18a5
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1647
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1824
2014-03-08 13:21:06 -08:00
Lenni Kuff
23c619f794 Limit test_udfs to always run with a single exec_option test vector
Change-Id: If3ff1f5f17a95cce88282f9dc165fe5ce85200b9
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1781
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1811
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
2014-03-07 18:44:11 -08:00
Skye Wanderman-Milne
6ceed1e632 UDF API additions
This patch introduces the ability to specify a prepare and close
function for a UDF, as well as FunctionContext methods for maintaining
state across UDF invocations within a query. Many of the changes are
related to adding an Expr::Open() function which calls the UDF's
prepare function, if specified (it has to be called in Open() since
the LLVM module must be compiled first).

Change-Id: I581d90d03dff71f7ff5d4a6bef839ba6bc46b443
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1693
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 8e2ed7fb9051d98f89327715fdebd6f5ed22d6ee)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1757
2014-03-05 07:32:34 -08:00
Alex Behm
69a840d965 Consistent memory estimates for explain tests.
Our new build machines (e.g., beefy) have more cores than our other machines,
so scan nodes may have a different memory estimate causing the explain tests
to fail. This patch fixes the num_scanner_threads to 1 for explain tests
to ensure consisteny estimates.

Change-Id: Ie6194f3c3b17d04aa141d04fcddb7ac948e92fcf
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1735
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1753
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
2014-03-05 05:38:30 -08:00
Skye Wanderman-Milne
68f6d57809 More robust initialization of ScannerContext
This commit is in conjunction with the "Fix missing status check in
lzo scanner." commit in the LZO repo. It provides a test case for the
LZO fix, and changes the ScannerContext initialization so it will fail
more gracefully instead of crashing.

Change-Id: Idcafeb3679a8fa54322d1ec31c6f1aba860e4e4f
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1680
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 9b84e3514c618bb3e171b5b3bb2ff862af4d35cc)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1752
2014-03-04 21:39:47 -08:00
Skye Wanderman-Milne
203fc66456 Add GetTypeDesc() method to FunctionContext.
This is currently only implemented for NativeUdfExpr.

Change-Id: I81b442c5668dff43d0486d1cfc445bca2af66606
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1664
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
(cherry picked from commit e1087c3a78e6e12938b583c302907bd32c59f524)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1720
2014-03-01 20:24:30 -08:00
Lenni Kuff
d6cbd3dc44 Ensure db/table names are always case insensitive in catalog topic entry keys
This fixes a bug that can happen with 'invalidate metadata <table name>' if the following
sequences of events happens:

1) Table is created in Impala (table names are always treated as lower case)
2) Table is dropped and re-created in Hive, using the same name but different casing
3) invalidate metadata <table name> is run in Impala, which will update the existing
   table with the version from the Hive metastore.

When building the next statestore update, the catalog server will send an update out
thinking that the table from 1) was dropped and the table from 3) was added because
the topic entry key is case sensitive. This may incorrectly remove the table from
an impalad's catalog. The fix is to always treat db/table names as case insensitive.

Change-Id: Ib59edc403989781bf12e0405c0ccd37b8e41ee41
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1634
Tested-by: jenkins
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1637
2014-02-23 00:20:16 -08:00
Nong Li
904ae86e82 IMPALA-626: Allow dropping functions while it is running.
Change-Id: Ia9d6fa1daadddbd05961696d13b9ff43fef2da61
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1621
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
2014-02-20 13:12:10 -08:00
Lenni Kuff
5f027f61c5 IMPALA-800 / IMPALA-795: Check catalog version before removing entries from the lib cache
There was an issue with the lib cache cleanup code where if a function were dropped
then re-created we might incorrectly remove the new functions's library from the cache.

Consider these statements executed in quick succession:
1) create function fn()
2) drop function fn()
3) create function fn()
4) select fn() ...

Since we perform direct-DDL and immediately apply the result of a DDL operation to the
local impalad catalog, steps 1-4 may complete before a statestore catalog update with the
drop from step 2) is received. When the statestore heartbeat with the drop is received, we
incorrectly removed the new function's lib cache entry while the select statement was
executing, causing the crash.

The fix for this problem is to verify the catalog versions to ensure we only drop items
that have a catalog version <= the catalog version the drop corresponds to.

Change-Id: I7dd1886bf24740cb41f1315ecbb540e38d9ad363
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1552
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1576
2014-02-17 17:56:49 -08:00
Skye Wanderman-Milne
3598395290 Set sync_ddl=true for tests that drop functions.
This is a temporary "fix" for IMPALA-795 to unblock the build. The
actual fix should prevent a dropped and re-created function from being
re-dropped by an old catalog update.

Change-Id: Id9dc36a8ecd5e7d1a1146ad0ac092ae12cb33529
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1547
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 80439d638a4ac02cedfe1490556b176cd818429f)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1559
Tested-by: Skye Wanderman-Milne <skye@cloudera.com>
2014-02-14 10:44:54 -08:00
Nong Li
3722711a06 IMPALA-800 workaround. Mark test_libs_with_same_filename as serial.
This test will drop functions in a binary used by the other UDF
tests. That triggers IMPALA-800.

Change-Id: I8e6f1ad5b4a7ece2d891559751142f0c12e07c3c
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1556
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: Lenni Kuff <lskuff@cloudera.com>
(cherry picked from commit 95100e0bdfd9472183fcc7cd8636666d5b654a37)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1558
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: Nong Li <nong@cloudera.com>
2014-02-14 00:22:08 -08:00
Lenni Kuff
21652c02e8 IMPALA-736: invalidate metadata <table name> should add/remove table from catalog if it does/does not exist in the metastore
The invalidation logic is:
- If table exists in the metastore, add it to the catalog as an IncompleteTable.
  If the table's parent database does not exist in the catalog, it will also be added.
- If the table does not exist in the metastore, remove it from the catalog cache.
- If we are unable to determine whether the table exists in the metastore (there was
  an exception thrown), invalidate any existing entry by replacing it with an
  IncompleteTable.

Change-Id: If64f07950324a1bec186f9c9ce829197cad87044
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1301
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1522
2014-02-11 22:28:57 -08:00
Nong Li
80d4fd958e IMPALA-786: Drop function should clear library cache.
We were previously only clearing the cache in the catalog service
update loop so the impalad the drop was issued to was not doing the
right thing.

Change-Id: I6bee228e8c0d565cea4ea61cbf64240d83a45a7d
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1511
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
2014-02-10 18:51:39 -08:00
Lenni Kuff
b4f5c1edcf Enable lazy loading of table metadata for the CatalogService/Impalad
This change adds support for lazy loading of table metadata to the
CatalogService/Impalad. The way this works is that the CatalogService initially
sends out an update with only the databases and table names (wrapped as
IncompleteTables). When an Impalad encounters one of these tables, it will contact
the catalog service to get the metadata, possibly triggering a metadata load if the
catalog server has not yet loaded this table.

With these changes the catalog server starts up in just seconds, even for large
metastores since it only needs to call into the metastore to get the list of tables
and databases. The performance of "invalidate metadata" also improves for the same reason.

I also picked up the catalog cleanup patch I had to make the APIs a bit more consistent and
remove the need for using a LoadingCache for databases.

This also fixes up the FE tests to run in a more realistic fashion. The FE tests now run
against catalog object recieved from the catalog server. This actually turned up some bugs
in our previous test configuration where we were not running with the correct column stats
(we were always running with avgSerializedSize = slotSize).  This changed some plans so the
planner tests needed to be updated.

Still TODO:
This does not include the changes to perform background metadata loading. I will send
that out as a separate patch on top of this.

Change-Id: Ied16f8a7f3a3393e89d6bfea78f0ba708d0ddd0e

Saving changes

Change-Id: I48c34408826b7396004177f5fc61a9523e664acc
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1328
Tested-by: jenkins
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1338
Tested-by: Lenni Kuff <lskuff@cloudera.com>
2014-01-21 21:43:29 -08:00
Lenni Kuff
0ce83818a6 IMPALA-675: Add function to get current default database
This uses the same syntax as postgres: current_database()

Change-Id: Ic6ca8ce1fe8c10a496800c45c58b0df4d214b51c
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1274
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
2014-01-13 22:27:22 -08:00
Alex Behm
6799c93922 Simplified/enhanced explain plans with a total of four explain levels.
There are now 4 explain levels summarized as follows:
- Level 0: MINIMAL
  Non-fragmented parallel plan only showing plan nodes with minimal attributes
- Level 1: STANDARD
  Non-fragmented parallel plan with some details in plan nodes
- Level 2: EXTENDED
  Non-fragmented parallel plan with full details in plan nodes including
  the table/column stats, row size, #hosts, cardinality,
  and estimated per-host memory requirement
- Level 3: VERBOSE
  Fragmented parallel plan with full details (like level 2)

This patch also includes several bugfixes related to plan costing and/or
testing of explain plans.

Change-Id: I622310f01d1b3d53ea1031adaf3b3ffdd94eba30
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1211
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
2014-01-10 19:17:59 -08:00
Lenni Kuff
6afea60704 Update test logging to print executable SQL statements and log all actions executed
This is the first step in cleaning up the test logging. It provides a common connection
interface that provides tracing around all operations. When a test fails the output will
be executable SQL. It also logs actions such as when a connection is opened, close, or
when an operation is cancelled. Currently only beeswax connections are supported, but
I have a seperate patch that adds support for executing using HS2 as well as Beeswax.

Example of new logging:
-- connecting to: localhost:21000
-- executing against localhost:21000
use functional;

SET disable_codegen=False;
SET abort_on_error=1;
SET batch_size=0;
SET num_nodes=0;

-- executing against localhost:21000
select a.timestamp_col from alltypessmall a inner join alltypessmall b on
(a.timestamp_col = b.timestamp_col)
where a.year=2009 and a.month=1 and b.year=2009 and b.month=1;
-- closing connection to: localhost:21000

Change-Id: Iedc7d4d3a84bfeff6cc1daae6ed1ca97613d7700
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1133
Tested-by: jenkins
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
2014-01-08 10:54:40 -08:00
Alex Behm
ba804aed47 Execute HBase insert tests serially.
Change-Id: I7d218194d92da99753c1a521c12b3827261c1e86
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1137
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
2014-01-08 10:54:33 -08:00
Alex Behm
74164e8f99 IMPALA-688: Fix column stats computation for HBase row key. Use regex to fix flaky tests.
Change-Id: I1d3fb915921bbc5366da0ee51608fd54aa237777
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1135
Tested-by: jenkins
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
2014-01-08 10:54:33 -08:00
Skye Wanderman-Milne
de531e15bd IMPALA-694: Allow Impala to read files produced by parquet-mr version <= 1.2.8
parquet-mr had a bug where it didn't include the dictionary page's
header in the total column size. We now compensate for this by
detecting these files and padding the scan range length. This required
changing how the scanner detects when it's finished: it now counts the
number of rows rather than checking eosr (since the scan range may be
longer than the column).

Change-Id: Id9933808b965003c0c3b3aa78c32fe29a0c4bcbe
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1097
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
2014-01-08 10:54:27 -08:00
Lenni Kuff
9c2093fb79 Update tests to remove uneeded calls to invalidate all catalog metadata
All tables/databases/functions are dropped via Impala so there is no
need to invalidate all catalog metadata. Not only is this operation
expensive, it can cause other tests to fail when executed in parallel
since it has the potential to temporarily reset some direct DDL operations
that have been applied to the local catalog.

Change-Id: Ia9a48d8a0dbe2eb5928b41950d17a35e8991fe22
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1090
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
2014-01-08 10:54:26 -08:00
Lenni Kuff
da46464b91 Properly set TAccessLevel when loading partitions from thrift to fix READ_ONLY error msg
When loading partitions from thrift we were not setting the accessLevel. This caused
the partition to inherit the accessLevel from the parent table. This didn't have any
functional impact, but caused the READ_ONLY error messages on INSERT to fail to show the
proper HDFS paths.
Note: There were already analyzer tests to validate the error messages, but those didn't
catch this because they don't exercise the end-to-end loading to/from thrift code.

Change-Id: I5c82458d59a638ed8e771122830116419f78dfc4
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1083
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
2014-01-08 10:54:26 -08:00
Nong Li
d401f746d4 IMPALA-692: Fix data corruption with dictionary encoded values.
We weren't clearing the state in the dictionary when rolling over to a new
page. The memory for the dictionary (built from the first file) was cleared
but the dictionary entires were not.

This also had a minor side effect that unused dictionary entries from the first
page were still being written out for subsequent pages, although in practice,
this is unlikely to affect the file size much.

Change-Id: I8e11fc4723dc23d21c5de8a42def13d8238c137b
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1072
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
2014-01-08 10:54:24 -08:00
Lenni Kuff
5c612bce12 Fix failure of incompatible col stats test during exhaustive test run
This test was failing on 'exhaustive' test runs because a table/db of the
same name can be created twice for different exec option dimensions.
Since this test doesn't actually care about exploring exec options, the fix is just to
limit it to a single exec option. We might want to consider appending the exec option
value string to any test databases created to help uniquify the names if there are other
tests we want to run in parallel while performing DDL and exploring different exec
options.

Change-Id: I8db79b6387f7f1b87b1391e9dc93c20aad7cd667
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1073
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: Lenni Kuff <lskuff@cloudera.com>
2014-01-08 10:54:23 -08:00