You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-05 15:41:14 +03:00
MCOL-1985 Server set decimal count for UDF based on both parameters. This doesn't work for regr_avgx and regr_avgy, which only care about one of them. Do our best to handle it reasonably. Still gives unlimited decimals for InnoDB when the unused parameter is not numeric.
This commit is contained in:
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the corr function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION corr returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION corr returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_corr
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the covar_pop function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION covar_pop returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION covar_pop returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_covar_pop
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the covar_samp function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION covar_samp returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION covar_samp returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_covar_samp
|
||||
|
@ -63,13 +63,6 @@ mcsv1_UDAF::ReturnCode regr_avgx::init(mcsv1Context* context,
|
||||
context->setErrorMessage("regr_avgx() with a non-numeric x argument");
|
||||
return mcsv1_UDAF::ERROR;
|
||||
}
|
||||
if (!(isNumeric(colTypes[1].dataType)))
|
||||
{
|
||||
// The error message will be prepended with
|
||||
// "The storage engine for the table doesn't support "
|
||||
context->setErrorMessage("regr_avgx() with a non-numeric independant (second) argument");
|
||||
return mcsv1_UDAF::ERROR;
|
||||
}
|
||||
|
||||
context->setUserDataSize(sizeof(regr_avgx_data));
|
||||
context->setResultType(CalpontSystemCatalog::DOUBLE);
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_avgx function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_avgx returns REAL soname
|
||||
* 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_avgx returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_avgx
|
||||
|
@ -60,14 +60,7 @@ mcsv1_UDAF::ReturnCode regr_avgy::init(mcsv1Context* context,
|
||||
{
|
||||
// The error message will be prepended with
|
||||
// "The storage engine for the table doesn't support "
|
||||
context->setErrorMessage("regr_avgy() with a non-numeric x argument");
|
||||
return mcsv1_UDAF::ERROR;
|
||||
}
|
||||
if (!(isNumeric(colTypes[0].dataType)))
|
||||
{
|
||||
// The error message will be prepended with
|
||||
// "The storage engine for the table doesn't support "
|
||||
context->setErrorMessage("regr_avgy() with a non-numeric dependant (first) argument");
|
||||
context->setErrorMessage("regr_avgy() with a non-numeric y argument");
|
||||
return mcsv1_UDAF::ERROR;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_avgy function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_avgy returns REAL soname
|
||||
* 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_avgy returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_avgy
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_count function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_count returns INTEGER
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_count returns INTEGER soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_count
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_intercept function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_intercept returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_intercept returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_intercept
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_r2 function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_r2 returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_r2 returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_r2
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_slope function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_slope returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_slope returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_slope
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_sxx function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_sxx returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_sxx returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_sxx
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_sxy function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_sxy returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_sxy returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_sxy
|
||||
|
@ -25,8 +25,7 @@
|
||||
* Columnstore interface for for the regr_syy function
|
||||
*
|
||||
*
|
||||
* CREATE AGGREGATE FUNCTION regr_syy returns REAL
|
||||
* soname 'libregr_mysql.so';
|
||||
* CREATE AGGREGATE FUNCTION regr_syy returns REAL soname 'libregr_mysql.so';
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_regr_syy
|
||||
|
@ -167,10 +167,13 @@ extern "C"
|
||||
strcpy(message,"regr_avgx() with a non-numeric independant (second) argument");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (initid->decimals != DECIMAL_NOT_SPECIFIED)
|
||||
if (args->arg_type[1] == DECIMAL_RESULT && initid->decimals != DECIMAL_NOT_SPECIFIED)
|
||||
{
|
||||
initid->decimals +=4;
|
||||
initid->decimals += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
initid->decimals = DECIMAL_NOT_SPECIFIED;
|
||||
}
|
||||
|
||||
if (!(data = (struct regr_avgx_data*) malloc(sizeof(struct regr_avgx_data))))
|
||||
@ -272,9 +275,13 @@ extern "C"
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (initid->decimals != DECIMAL_NOT_SPECIFIED)
|
||||
if (args->arg_type[0] == DECIMAL_RESULT && initid->decimals != DECIMAL_NOT_SPECIFIED)
|
||||
{
|
||||
initid->decimals +=4;
|
||||
initid->decimals += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
initid->decimals = DECIMAL_NOT_SPECIFIED;
|
||||
}
|
||||
|
||||
if (!(data = (struct regr_avgy_data*) malloc(sizeof(struct regr_avgy_data))))
|
||||
|
Reference in New Issue
Block a user