1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-05-10 02:01:04 +03:00

39 Commits

Author SHA1 Message Date
Alexander Barkov
2ea73846b9 MCOL-4422 Remove mariadb.h and my_sys.h dependency from collation.h 2020-11-30 14:26:35 +04:00
Roman Nozdrin
6ab1b829a0 MCOL-4334 Enable Select Handler for queries run inside Stored Procedures
There is another session variable to enable/disable SH in SP
2020-10-13 13:07:59 +00:00
Gagan Goel
a1ea633a19 MCOL-4282 Follow up version 2.
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 ...".
2020-09-25 13:49:52 -04:00
David.Hall
f584bab846
Merge pull request #1467 from drrtuy/MCOL-4278-dev
MCOL-4278 MCS quits early from rnd_end() in the presense of sql_selec…
2020-09-24 10:11:08 -05:00
Roman Nozdrin
df0c2b2fbe MCOL-4278 MCS quits early from rnd_end() in the presense of sql_select_limit session variable
Renamed a couple methods to align their names with others
2020-09-24 08:46:00 +00:00
Gagan Goel
e257570b04 MCOL-4282 Follow up on the previous commit.
Activate statement arena for:
  1. disable_indices_for_CEJ()
  2. in_subselect_rewrite() for prepared statements
2020-09-23 15:45:20 -04:00
Gagan Goel
a117786027 MCOL-4282 Enable Select Handler for Prepared Statements
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.
2020-09-11 16:35:51 -04:00
Roman Nozdrin
ab2003baaa MCOL-3903 Enable Select Handler to run query part of INSERT..SELECT.
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.
2020-04-07 09:17:05 +00:00
Roman Nozdrin
ce0311aa79 MCOL-3828 This commit replaces the method that calls JOIN::optimise()
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.
2020-03-24 14:00:42 +00:00
Roman Nozdrin
3345f7a437 MCOL-3769 This commit divides create_SH in two parts: before rewrites and
after rewrites. We can safely fallback from SH to DH and table mode from
'before rewrites' part.
2020-03-18 20:24:34 +03:00
David.Hall
f71158601e Merge pull request #1032 from drrtuy/MCOL-3766
MCOL-3766 EXPLAIN now doesn't execute query via SH thus doesn't fail
2020-02-28 16:19:25 -05:00
David.Hall
0db52396f9 Merge pull request #1025 from mariadb-corporation/MCOL-3747
MCOL-3747 This patch properly enables queries with IN + uncorrelated …
2020-02-28 13:58:45 -05:00
Gagan Goel
dd89943a5b MCOL-3788 Remove save/restore_group_list impl since the optimizer call
does not happen in create_SH anymore
2020-02-21 15:32:16 +00:00
Roman Nozdrin
7acfddddb7 Refactored MDB relation names decoding in DDL code.
SH now takes all or nothing thus we need to change if conditions that rules our GBH.

Small warning fixes for GCC8.2

Disabled GBH.
2019-12-13 11:38:19 -06:00
Roman Nozdrin
3fabf01e93 MCOL-3593 Disabled full optimizer run and enabled copy-pasted simplify_joins.
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.
2019-11-25 10:03:32 -06:00
Gagan Goel
c8df46ed26 Replace ha_calpont with ha_mcs in the source code and filenames in the plugin code. 2019-10-11 17:33:43 +00:00
Gagan Goel
4c8471a786 Create separate functions for saving and restoring group by list columns. 2019-10-11 14:28:01 +00:00
Gagan Goel
ccb36e9794
Merge pull request #890 from drrtuy/separate_pushdown
MCOL-2178 Separate ha_mcs_pushdown.cpp compilation.
2019-10-07 18:50:01 -04:00
Roman Nozdrin
12cb5201ac MCOL-2178 Separate ha_mcs_pushdown.cpp compilation.
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.
2019-10-07 03:12:37 -05:00
Gagan Goel
a9eec783e6 Disable SH for a SELECT INTO query that uses interceptor classes. 2019-10-04 10:27:19 -04:00
Roman Nozdrin
69c1a613fa MCOL-2178 Fix distinctAggregationAndGroupBy by allowing to traverse into
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.
2019-09-19 08:06:39 +03:00
Gagan Goel
7599a9379e Save and restore the group by list columns as the server
optimizer can optimize out the constant columns in this list
2019-09-17 10:36:49 -04:00
Gagan Goel
5fe8388760 Undo commit e60fbf260f4b67907925bf637bc64516d401b42e 2019-09-17 00:45:04 -04:00
Roman Nozdrin
0c58f10d12 MCOL-2178 CS now sets optimizer flags like it did in the fork-era.
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.
2019-09-15 07:12:50 -05:00
Andrew Hutchings
4d2a1594aa
Merge pull request #835 from tntnatbry/union-subquery
Disable processing of a union in a subquery by the select_handler
2019-09-02 06:58:06 +01:00
Gagan Goel
e2084493f3 Disable handlers for set_user_var and get_user_var functions in the SELECT clause 2019-08-30 23:59:37 -04:00
Gagan Goel
92ee66f5fd Remove a curly brace and add a check in a for loop in create_columnstore_select_handler() 2019-08-28 19:29:12 -04:00
Roman Nozdrin
cb36041587 MCOL-2178 CS now explicitly calls MDB's optimizer using JOIN::optimizer_inner
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.
2019-08-28 12:22:11 -05:00
Roman Nozdrin
2c63258537 MCOL-2178 SH now allows to fallback to other pushdown handlers.
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.
2019-08-25 04:05:59 +03:00
Gagan Goel
e60fbf260f Disable processing of a union in a subquery by the select_handler 2019-08-21 21:59:27 -04:00
Roman Nozdrin
f64db01d81
Merge pull request #822 from mariadb-corporation/remove-infinidb
Fix hton usage
2019-08-14 16:44:13 +03:00
Andrew Hutchings
ad355dc771 Fix hton usage 2019-08-14 14:03:23 +01:00
Roman Nozdrin
f0c83a4a1f MCOL-2178 Enable GBH by default.
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.
2019-08-12 21:02:32 +03:00
Gagan Goel
1c460f3ba5 MCOL-2178 Cleanup of MIGR:: singleton from the plugin code.
Disable SP execution by the smart handlers for now.

    Add session variables to Enable/Disable select/derived/group_by
    handlers. Defaulted to Enable.
2019-08-04 21:50:50 -04:00
Roman Nozdrin
d62b66ecf7 parse_item() in execplan code now always get an actual GWI structure
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.
2019-08-01 14:29:55 -04:00
Roman Nozdrin
3074b6c4b3 MCOL-2178 Functions with constant args are processed by CS now.
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.
2019-08-01 14:09:35 -04:00
Roman Nozdrin
cd72326c4d MCOL-2178 Introduced a dummy replacement for a infinidb_table.
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.
2019-08-01 14:09:35 -04:00
Roman Nozdrin
6fd5b2f22d MCOL-2178 Merging with 10.4
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.
2019-08-01 12:54:17 -04:00
Roman Nozdrin
2071716ebd MCOL-2121 New derived_handler(MDEV-17096) infrastructure.
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
2019-08-01 12:54:17 -04:00