You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
Mcol 5092 MODA uses wrong column width for some types (#2450)
* MCOL-5092 Ensure column width is correct for datatype Change MODA return type to STRING Modify MODA to handle every numeric type * MCOL-5162 MODA to support char and varchar with collation support Fixes to the aggregate bit functions When we fixed the storage sign issue for MCOL-5092, it uncovered a problem in the bit aggregates (bit_and, bit_or and bit_xor). These aggregates should always return UBIGINT, but they relied on the type of the argument column, which gave bad results.
This commit is contained in:
@@ -979,7 +979,9 @@ const JobStepVector doAggProject(const CalpontSelectExecutionPlan* csep, JobInfo
|
||||
// Changing col type based on a parm if multiple parms
|
||||
// doesn't really make sense.
|
||||
if (op != AggregateColumn::SUM && op != AggregateColumn::DISTINCT_SUM &&
|
||||
op != AggregateColumn::AVG && op != AggregateColumn::DISTINCT_AVG)
|
||||
op != AggregateColumn::AVG && op != AggregateColumn::DISTINCT_AVG &&
|
||||
op != AggregateColumn::BIT_AND && op != AggregateColumn::BIT_OR &&
|
||||
op != AggregateColumn::BIT_XOR)
|
||||
{
|
||||
updateAggregateColType(aggc, srcp, op, jobInfo);
|
||||
}
|
||||
|
@@ -1332,16 +1332,7 @@ void TupleAggregateStep::prep1PhaseAggregate(JobInfo& jobInfo, vector<RowGroup>&
|
||||
keysAgg.push_back(key);
|
||||
scaleAgg.push_back(0);
|
||||
precisionAgg.push_back(-16); // for connector to skip null check
|
||||
|
||||
if (isUnsigned(typeProj[colProj]))
|
||||
{
|
||||
typeAgg.push_back(CalpontSystemCatalog::UBIGINT);
|
||||
}
|
||||
else
|
||||
{
|
||||
typeAgg.push_back(CalpontSystemCatalog::BIGINT);
|
||||
}
|
||||
|
||||
typeAgg.push_back(CalpontSystemCatalog::UBIGINT);
|
||||
csNumAgg.push_back(csNumProj[colProj]);
|
||||
widthAgg.push_back(bigIntWidth);
|
||||
}
|
||||
@@ -1941,16 +1932,7 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate(JobInfo& jobInfo, vector<Ro
|
||||
keysAgg.push_back(aggKey);
|
||||
scaleAgg.push_back(0);
|
||||
precisionAgg.push_back(-16); // for connector to skip null check
|
||||
|
||||
if (isUnsigned(typeProj[colProj]))
|
||||
{
|
||||
typeAgg.push_back(CalpontSystemCatalog::UBIGINT);
|
||||
}
|
||||
else
|
||||
{
|
||||
typeAgg.push_back(CalpontSystemCatalog::BIGINT);
|
||||
}
|
||||
|
||||
typeAgg.push_back(CalpontSystemCatalog::UBIGINT);
|
||||
csNumAgg.push_back(8);
|
||||
widthAgg.push_back(bigIntWidth);
|
||||
colAgg++;
|
||||
@@ -3274,16 +3256,7 @@ void TupleAggregateStep::prep2PhasesAggregate(JobInfo& jobInfo, vector<RowGroup>
|
||||
keysAggPm.push_back(aggKey);
|
||||
scaleAggPm.push_back(0);
|
||||
precisionAggPm.push_back(-16); // for connector to skip null check
|
||||
|
||||
if (isUnsigned(typeProj[colProj]))
|
||||
{
|
||||
typeAggPm.push_back(CalpontSystemCatalog::UBIGINT);
|
||||
}
|
||||
else
|
||||
{
|
||||
typeAggPm.push_back(CalpontSystemCatalog::BIGINT);
|
||||
}
|
||||
|
||||
typeAggPm.push_back(CalpontSystemCatalog::UBIGINT);
|
||||
csNumAggPm.push_back(8);
|
||||
widthAggPm.push_back(bigIntWidth);
|
||||
colAggPm++;
|
||||
@@ -4183,16 +4156,7 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(JobInfo& jobInfo, vector<R
|
||||
keysAggPm.push_back(aggKey);
|
||||
scaleAggPm.push_back(0);
|
||||
precisionAggPm.push_back(-16); // for connector to skip null check
|
||||
|
||||
if (isUnsigned(typeProj[colProj]))
|
||||
{
|
||||
typeAggPm.push_back(CalpontSystemCatalog::UBIGINT);
|
||||
}
|
||||
else
|
||||
{
|
||||
typeAggPm.push_back(CalpontSystemCatalog::BIGINT);
|
||||
}
|
||||
|
||||
typeAggPm.push_back(CalpontSystemCatalog::UBIGINT);
|
||||
csNumAggPm.push_back(8);
|
||||
widthAggPm.push_back(bigIntWidth);
|
||||
++colAggPm;
|
||||
|
@@ -98,10 +98,14 @@ class StoreFieldMariaDB : public StoreField
|
||||
return m_field->store_binary(str, length);
|
||||
}
|
||||
|
||||
int store_xlonglong(int64_t val) override
|
||||
int store_longlong(int64_t val) override
|
||||
{
|
||||
idbassert(dynamic_cast<Field_num*>(m_field));
|
||||
return m_field->store(val, static_cast<Field_num*>(m_field)->unsigned_flag);
|
||||
return m_field->store(val, 0);
|
||||
}
|
||||
|
||||
int store_ulonglong(uint64_t val)override
|
||||
{
|
||||
return m_field->store(static_cast<int64_t>(val), 1);
|
||||
}
|
||||
|
||||
int store_float(float dl) override
|
||||
|
@@ -5192,7 +5192,7 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
|
||||
else if (isp->sum_func() == Item_sum::SUM_BIT_FUNC)
|
||||
{
|
||||
CalpontSystemCatalog::ColType ct;
|
||||
ct.colDataType = CalpontSystemCatalog::BIGINT;
|
||||
ct.colDataType = CalpontSystemCatalog::UBIGINT;
|
||||
ct.colWidth = 8;
|
||||
ct.scale = 0;
|
||||
ct.precision = -16; // borrowed to indicate skip null value check on connector
|
||||
|
@@ -78,7 +78,7 @@ CREATE OR REPLACE FUNCTION caldroppartitionsbyvalue RETURNS STRING SONAME 'ha_co
|
||||
CREATE OR REPLACE FUNCTION caldisablepartitionsbyvalue RETURNS STRING SONAME 'ha_columnstore.so';
|
||||
CREATE OR REPLACE FUNCTION calenablepartitionsbyvalue RETURNS STRING SONAME 'ha_columnstore.so';
|
||||
CREATE OR REPLACE FUNCTION calshowpartitionsbyvalue RETURNS STRING SONAME 'ha_columnstore.so';
|
||||
CREATE OR REPLACE AGGREGATE FUNCTION moda RETURNS DECIMAL SONAME 'libregr_mysql.so';
|
||||
CREATE OR REPLACE AGGREGATE FUNCTION moda RETURNS STRING SONAME 'libregr_mysql.so';
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS infinidb_querystats;
|
||||
CREATE TABLE IF NOT EXISTS infinidb_querystats.querystats
|
||||
|
Reference in New Issue
Block a user