You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-4480: TEXT type added for alter table add column (#3221)
This commit is contained in:
@ -47,6 +47,7 @@ using namespace logging;
|
|||||||
|
|
||||||
#include "we_messages.h"
|
#include "we_messages.h"
|
||||||
#include "we_ddlcommandclient.h"
|
#include "we_ddlcommandclient.h"
|
||||||
|
#include "we_ddlcommon.h"
|
||||||
using namespace WriteEngine;
|
using namespace WriteEngine;
|
||||||
|
|
||||||
#include "oamcache.h"
|
#include "oamcache.h"
|
||||||
@ -732,10 +733,13 @@ void AlterTableProcessor::addColumn(uint32_t sessionID, execplan::CalpontSystemC
|
|||||||
throw std::runtime_error(err);
|
throw std::runtime_error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((columnDefPtr->fType->fType == CalpontSystemCatalog::CHAR && columnDefPtr->fType->fLength > 8) ||
|
int dataType = WriteEngine::convertDataType(columnDefPtr->fType->fType);
|
||||||
(columnDefPtr->fType->fType == CalpontSystemCatalog::VARCHAR && columnDefPtr->fType->fLength > 7) ||
|
|
||||||
(columnDefPtr->fType->fType == CalpontSystemCatalog::VARBINARY && columnDefPtr->fType->fLength > 7) ||
|
if ((dataType == CalpontSystemCatalog::CHAR && columnDefPtr->fType->fLength > 8) ||
|
||||||
(columnDefPtr->fType->fType == CalpontSystemCatalog::BLOB))
|
(dataType == CalpontSystemCatalog::VARCHAR && columnDefPtr->fType->fLength > 7) ||
|
||||||
|
(dataType == CalpontSystemCatalog::VARBINARY && columnDefPtr->fType->fLength > 7) ||
|
||||||
|
(dataType == CalpontSystemCatalog::TEXT) ||
|
||||||
|
(dataType == CalpontSystemCatalog::BLOB))
|
||||||
{
|
{
|
||||||
isDict = true;
|
isDict = true;
|
||||||
}
|
}
|
||||||
|
@ -401,6 +401,7 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, long t
|
|||||||
// @2835. Handle empty string and null confusion. store empty string for string column
|
// @2835. Handle empty string and null confusion. store empty string for string column
|
||||||
if (colType.colDataType == CalpontSystemCatalog::CHAR ||
|
if (colType.colDataType == CalpontSystemCatalog::CHAR ||
|
||||||
colType.colDataType == CalpontSystemCatalog::VARCHAR ||
|
colType.colDataType == CalpontSystemCatalog::VARCHAR ||
|
||||||
|
colType.colDataType == CalpontSystemCatalog::TEXT ||
|
||||||
colType.colDataType == CalpontSystemCatalog::VARBINARY)
|
colType.colDataType == CalpontSystemCatalog::VARBINARY)
|
||||||
{
|
{
|
||||||
(*f)->reset();
|
(*f)->reset();
|
||||||
|
@ -428,6 +428,7 @@ execplan::ReturnedColumn* buildPseudoColumn(Item* item, gp_walk_info& gwi, bool&
|
|||||||
|
|
||||||
if ((pseudoType == PSEUDO_EXTENTMIN || pseudoType == PSEUDO_EXTENTMAX) &&
|
if ((pseudoType == PSEUDO_EXTENTMIN || pseudoType == PSEUDO_EXTENTMAX) &&
|
||||||
(sc->colType().colDataType == CalpontSystemCatalog::VARBINARY ||
|
(sc->colType().colDataType == CalpontSystemCatalog::VARBINARY ||
|
||||||
|
(sc->colType().colDataType == CalpontSystemCatalog::TEXT) ||
|
||||||
(sc->colType().colDataType == CalpontSystemCatalog::VARCHAR && sc->colType().colWidth > 7) ||
|
(sc->colType().colDataType == CalpontSystemCatalog::VARCHAR && sc->colType().colWidth > 7) ||
|
||||||
(sc->colType().colDataType == CalpontSystemCatalog::CHAR && sc->colType().colWidth > 8)))
|
(sc->colType().colDataType == CalpontSystemCatalog::CHAR && sc->colType().colWidth > 8)))
|
||||||
return nullOnError(gwi, funcName);
|
return nullOnError(gwi, funcName);
|
||||||
|
21
mysql-test/columnstore/bugfixes/MCOL_5175.result
Normal file
21
mysql-test/columnstore/bugfixes/MCOL_5175.result
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
DROP DATABASE IF EXISTS MCOL_5175;
|
||||||
|
CREATE DATABASE MCOL_5175;
|
||||||
|
USE MCOL_5175;
|
||||||
|
create table testtext2 ( myvalue varchar(100) )engine=Columnstore CHARSET=utf8;
|
||||||
|
show create table testtext2;
|
||||||
|
Table Create Table
|
||||||
|
testtext2 CREATE TABLE `testtext2` (
|
||||||
|
`myvalue` varchar(100) DEFAULT NULL
|
||||||
|
) ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
|
||||||
|
alter table testtext2 add column myvalue2 text;
|
||||||
|
show create table testtext2;
|
||||||
|
Table Create Table
|
||||||
|
testtext2 CREATE TABLE `testtext2` (
|
||||||
|
`myvalue` varchar(100) DEFAULT NULL,
|
||||||
|
`myvalue2` text DEFAULT NULL
|
||||||
|
) ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
|
||||||
|
insert into testtext2 (myvalue2) VALUES ('myvalue');
|
||||||
|
select * from testtext2;
|
||||||
|
myvalue myvalue2
|
||||||
|
NULL myvalue
|
||||||
|
DROP DATABASE MCOL_5175;
|
22
mysql-test/columnstore/bugfixes/MCOL_5175.test
Normal file
22
mysql-test/columnstore/bugfixes/MCOL_5175.test
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# Alter table add column
|
||||||
|
# Author: Bharath, bharath.bokka@mariadb.com
|
||||||
|
#
|
||||||
|
-- source include/have_innodb.inc
|
||||||
|
-- source ../include/have_columnstore.inc
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP DATABASE IF EXISTS MCOL_5175;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE DATABASE MCOL_5175;
|
||||||
|
USE MCOL_5175;
|
||||||
|
|
||||||
|
create table testtext2 ( myvalue varchar(100) )engine=Columnstore CHARSET=utf8;
|
||||||
|
show create table testtext2;
|
||||||
|
alter table testtext2 add column myvalue2 text;
|
||||||
|
show create table testtext2;
|
||||||
|
insert into testtext2 (myvalue2) VALUES ('myvalue');
|
||||||
|
select * from testtext2;
|
||||||
|
|
||||||
|
DROP DATABASE MCOL_5175;
|
@ -11,4 +11,9 @@ INSERT INTO src VALUES (1, "Pretty Bloby Thing", "This is some text");
|
|||||||
select * from src where c0=1 and substr(cLT, 1, 4)="This";
|
select * from src where c0=1 and substr(cLT, 1, 4)="This";
|
||||||
c0 cLB cLT
|
c0 cLB cLT
|
||||||
1 Pretty Bloby Thing This is some text
|
1 Pretty Bloby Thing This is some text
|
||||||
|
ALTER TABLE src ADD COLUMN (cLT2 LONGTEXT);
|
||||||
|
UPDATE src SET cLT2="My Friday Night" where c0=1;
|
||||||
|
select * from src where c0=1 and substr(cLT, 1, 4)="This";
|
||||||
|
c0 cLB cLT cLT2
|
||||||
|
1 Pretty Bloby Thing This is some text My Friday Night
|
||||||
DROP DATABASE `mcol_4758`;
|
DROP DATABASE `mcol_4758`;
|
||||||
|
@ -11,9 +11,9 @@ INSERT INTO src VALUES (1, "Pretty Bloby Thing", "This is some text");
|
|||||||
select * from src where c0=1 and substr(cLT, 1, 4)="This";
|
select * from src where c0=1 and substr(cLT, 1, 4)="This";
|
||||||
|
|
||||||
# To be uncommented when MCOL-4480 is fixed
|
# To be uncommented when MCOL-4480 is fixed
|
||||||
#ALTER TABLE src ADD COLUMN (cLT2 LONGTEXT);
|
ALTER TABLE src ADD COLUMN (cLT2 LONGTEXT);
|
||||||
#UPDATE src SET cLT2="My Friday Night" where c0=1;
|
UPDATE src SET cLT2="My Friday Night" where c0=1;
|
||||||
#select * from src where c0=1 and substr(cLT, 1, 4)="This";
|
select * from src where c0=1 and substr(cLT, 1, 4)="This";
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
DROP DATABASE `mcol_4758`;
|
DROP DATABASE `mcol_4758`;
|
||||||
|
Reference in New Issue
Block a user