1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

MCOL-270 Add support for MEDIUMINT data type

This commit is contained in:
Gagan Goel
2018-12-30 19:07:20 -05:00
parent 90b43f9fc7
commit d1ada75395
22 changed files with 206 additions and 23 deletions

View File

@@ -198,6 +198,10 @@ uint32_t convertDataType(int dataType)
calpontDataType = CalpontSystemCatalog::USMALLINT;
break;
case ddlpackage::DDL_UNSIGNED_MEDINT:
calpontDataType = CalpontSystemCatalog::UMEDINT;
break;
case ddlpackage::DDL_UNSIGNED_INT:
calpontDataType = CalpontSystemCatalog::UINT;
break;
@@ -323,21 +327,33 @@ bool validateNextValue( int type, int64_t value )
case ddlpackage::DDL_INT:
case ddlpackage::DDL_INTEGER:
case ddlpackage::DDL_MEDINT:
{
if (value > MAX_INT)
validValue = false;
}
break;
case ddlpackage::DDL_MEDINT:
{
if (value > MAX_MEDINT)
validValue = false;
}
break;
case ddlpackage::DDL_UNSIGNED_INT:
case ddlpackage::DDL_UNSIGNED_MEDINT:
{
if (static_cast<uint64_t>(value) > MAX_UINT)
validValue = false;
}
break;
case ddlpackage::DDL_UNSIGNED_MEDINT:
{
if (static_cast<uint64_t>(value) > MAX_UMEDINT)
validValue = false;
}
break;
case ddlpackage::DDL_SMALLINT:
{
if (value > MAX_SMALLINT)

View File

@@ -1062,6 +1062,7 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_
}
case CalpontSystemCatalog::INT:
case CalpontSystemCatalog::MEDINT:
{
if (nullVal && (ci.columnTypes[colpos].constraintType != CalpontSystemCatalog::NOTNULL_CONSTRAINT))
fprintf(ci.filePtr, "%c", ci.delimiter);
@@ -1073,6 +1074,7 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_
}
case CalpontSystemCatalog::UINT:
case CalpontSystemCatalog::UMEDINT:
{
if (nullVal && (ci.columnTypes[colpos].constraintType != CalpontSystemCatalog::NOTNULL_CONSTRAINT))
fprintf(ci.filePtr, "%c", ci.delimiter);

View File

@@ -220,6 +220,14 @@ void storeNumericField(Field** f, int64_t value, CalpontSystemCatalog::ColType&
break;
}
case MYSQL_TYPE_INT24: //MEDINT type
{
Field_medium* f2 = (Field_medium*)*f;
longlong int_val = (longlong)value;
f2->store(int_val, f2->unsigned_flag);
break;
}
case MYSQL_TYPE_LONG: //INT type
{
Field_long* f2 = (Field_long*)*f;
@@ -592,6 +600,7 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
}
case CalpontSystemCatalog::INT:
case CalpontSystemCatalog::MEDINT:
{
intColVal = row.getIntField<4>(s);
storeNumericField(f, intColVal, colType);
@@ -599,6 +608,7 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
}
case CalpontSystemCatalog::UINT:
case CalpontSystemCatalog::UMEDINT:
{
uintColVal = row.getUintField<4>(s);
storeNumericField(f, uintColVal, colType);