Fix histograms for primary key of salted tables Users attempting to use Update Statistics to create a multi-column histogram (MC) corresponding to the primary key of a salted table may be unaware that the "_SALT_" column is implicitly prepended to the key as stated in the Create Table statement, and omit it. This fix will cause Update Stats to detect a request for a multi-column histograms that specifies the primary key columns (or a prefix of the full key), and add _SALT_ to it if missing, and order the MC to match the order of the columns in the primary key.
The change only affects salted tables, and is only applied if neither the ON EVERY KEY nor ON EVERY COLUMN clauses is present, because an MC matching the full primary key is automatically generated in those cases.
A second part of this fix applies to cases where ON EVERY KEY or ON EVERY COLUMN is specified in an Update Statistics statement on a salted table. By default, MCs corresponding to subsets of the primary key will no longer be generated automatically in this case. The cqd USTAT_ADD_SALTED_KEY_PREFIXES_FOR_MC may be set to 'ON' to cause MCs for subsets of the primary key to be generated.
enable embedded compiler support for fetch histogram queries The fetch histogram logic executes queries against the user metadata tables HISTOGAMS and HISTORAGM_INTERVALS that require the spawning of external arkcmp processes. The work in this check-in enables embedded compiler for these queries so the spawning of external arkcmps is avoided. The change introduces a "switch context" to a meta data context when compiling the user metadata queries and "switch back" to the user context prior to fetching the rows from the cursors on the user metadata tables. The main change is implemented in the "readHistogram" function in hs_read.cpp file.
A new method (switchBackContext) was added to class CmpContext class to enable switching back to a previous context. The purpose of the new method is to ensure that thread globals are appropriately reset when reverting back to a previous context.
The checkin also turns OFF CQD HBASE_SERIALIZATION in file regress/tools/sbdefs as the hbase serialization feature is not enabled yet. The feature (CQD) was enabled during regression testing prior to this checkin.