Mutate the optimizer flags for prepared statements in:
1. ha_mcs::open
2. ha_mcs::discover_check_version
This is done to ensure the optimizer flags are disabled before
JOIN::prepare() is called during "PREPARE stmt FROM ...".
This patch enables select handler for executing prepared
statements. Most importantly, we are now activating a
persistent arena which will allocate any new items in a
permanent MEMROOT for prepared statements and stored procedures.
Refer to JOIN::optimize_inner() for details.
In processWhere(), we now use SELECT_LEX::prep_where in case
we are executing a prepared statement, as this is where the saved
WHERE clause is stored for prepared statement processing.
In addition, we also disable derived handler for prepared
statements.
Original SH implementation sends the result set back to the client
thus it can't be used in INSERT..SELECT, SELECT INTO OUTFILE,CREATE
TABLE AS SELECT etc.
CLX-77 feature has been backported into MDB to enable SH to run
query part of the mentioned queries.
internally(thus can remove equi-JOIN predicates) with a recursive f()
to inject equi-JOIN conditions for IN + correlated subquery Item.
This change both solves MCOL-3747 issue and remove issues I first
faced in union.sql test.
This commit also fixes a clean up for conditions pushed for table API
execution path and replaces NULL with nullptr in ha_mcs_impl.cpp.
Disabled 4th if block in buildOuterJoin to handle non-optimized MDB query
structures.
Broke getSelectPlan into pieces: processFrom, processWhere.
MCOL-3593 UNION processing depends on two flags isUnion that comes as
arg of getSelectPlan and unionSel that is a local variable in
getSelectPlan. Modularization of getSelectPlan broke the mechanizm.
This patch is supposed to partially fix it.
MCOL-3593 Removed unused if condition from buildOuterJoin that allows
unsupported construct subquery in ON expression.
Fixed an improper if condition that ignors tableMap entries w/o condition
in external_lock thus external_lock doesn't clean up when the query
finishes.
Fixed wrong logging for queries processed in tableMode. Now rnd_init
properly sends queryText down to ExeMgr to be logged.
MCOL-3593 Unused attribute FromSubQuery::fFromSub was removed.
getSelectPlan has been modularized into: setExecutionParams,
processFrom, processWhere. SELECT, HAVING, GROUP BY, ORDER BY
still lives in getSelectPlan.
Copied optimization function simplify_joins_ into our pushdown
code to provide the plugin code with some rewrites from MDB it
expects.
The columnstore_processing_handlers_fallback session variable
has been removed thus CS can't fallback from SH to partial
execution paths, e.g. DH, GBH or plugin API.
MCOL-3602 Moved MDB optimizer rewrites into a separate file.
Add SELECT_LEX::optimize_unflattened_subqueries() call to fix IN
into EXISTS rewrite for semi-JOINs with subqueries.
disable_indices_for_CEJ() add index related hints to disable
index access methods in Cross Engine Joins.
create_SH() now flattens JOIN that has both physical tables and
views. This fixes most of views related tests in the regression.
Set a proper type for string literals on ConstantColumn ctor
to fix the regression produced by MCOL-174.
Removed OPTIMIZER_SWITCH_EXISTS_TO_IN b/c MDB produces
unsupported optimization with it and CS couldn't create
ExistsFilter.
any function in projection looking for either aggregation function or
GROUP BY key column.
MDB doesn't convert Item_equal into corresponding Item_func_eq w/o
OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING optimizer flag.
Activation of the flag fixes queries from having test scenario w
equal operator in HAVING, e.g. HAVING c1 = 50.
This happens in external_lock() whilst locking the table.
Fixes LIMIT=1 optimization for EXISTS_SUBS subqueries.
external_lock() contains if condition that gives false positive
for SH + pushed conditions.
external_lock() now resets in_subquery_conversion_threshold
variable that governs IN_INTO_SUBQUERY optimization for
queries run in table mode.
external_lock() now purges dynamicall allocated condInfo for
SH and DH execution path.
Commented out UNION check b/c if condition gives false positives
and silently enables table mode execution for queries w/o
UNION.
call.
CS doesn't use SH for SELECT..INTO OUTFILE queries.
Clean up gwi::physTableList when processing Storage API request.
SH now explicitly set an execution error in THD::stmt_da.
SH now set queryState in select_next() to mark a begging of the execution.
SH query execution migrated from SH::init() into create_SH().
There is a session variable columnstore_processing_handlers_fallback
that allows to fallback to DH, GBH if SH fails. DH now uses semantic
tree check for unsupported features to allow to fallback to GBH or
storage API.
Fixes GBH related bug when create_GBH() returns a handler for
queries with impossible WHERE/HAVING.
Fixed bug in FromSubquery::transform() where isUnion is set to true.
Enabled RTTI b/c server team enabled it for MDB.
Removed unused code supposed to be used with vtable.
We preserve union related condition blocks until UNION-capable smart handler.
Removed a number of commented code blocks.
Add projection list REAL and TIME constants, e.g
SELECT TIME'10:20:30', TIMESTAMP'2001-01-01 10:20:30', DATE'2001-01-01' FROM cs1;
Marked potentially useless block in ORDER BY processing for future removal.
Removed string variables used for reconstructed query in the pre-1.4 fork.
Removed cp_get_plan().
GBH doesn't step in if SH processes the query.
All smart handlers now correctly processes impossible WHERE and HAVING.
to avoid accedental crashes.
Add check for Conversion of Big IN Predicates Into Subqueries optimization
conditions.
Enabled derivedTableOptimization() for group by and derived handlers.
Disabled Conversion of Big IN Predicates Into Subqueries optimization.
Disabled most of optimizer_flags for now.
RowGroup + operator now correctly sets useStringTable flag that
instructs code to check StringStore instead of plain data buffer.
Fix crash in ha_calpont_impl_close_connection()
Fix leak in ci.tableMap.
Removed extra returns in pushdown_init to avoid crashes.
create_select_handler now detects INSERT..SELECT.
buildConstColFromFilter now uses any kind of filter to supply
relevant columns.
Remove strings used by vtable redo phase.
Make FromSubQuery aware of Pushdown handlers.
Changed debug_walk to work around changed Item framework.
Temporary disabled derived handler and unsupported features checks.
Used Item attribute getters introduced by 10.4
Make changes to support Item::CONST_ITEM introduced by 10.4
as a replacement for INT_,REAL_,STRING_ ITEM.
Replaced QT_INFINIDB_DERIVED and similar flags
with correponded flags for Item->print().
Replaced or commented out infinidb_ variable names with columnstore_
where applicable.
SELECT_LEX had been moved in THD so changed all references.
Avoid writing CS decimal scales into MDB decimal fields
d-only dec attribute. WIP
Replaced infinidb_vtable with a singleton MIGR.
Merged with MCOL-2121.
Added new wsrep include paths needed by UDaF code.
Removed .vcxproj from Connector code.
Renamed isInfiniDB() into isMCSTable
Changed getSelectPlan() to reuse it with derived and
other handler types.
Separate pushdown handlers methods and functions.
Removed vcxproj files from the source.
Added fix for MCOL-2166.
Merged with MCOL-2121