1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-24 14:20:59 +03:00

Merge pull request #741 from mariadb-corporation/MCOL-1985

MCOL-1985 Server set decimal count for UDF based on both parameters. …
This commit is contained in:
Roman Nozdrin
2019-04-25 10:28:45 +03:00
committed by GitHub
15 changed files with 25 additions and 44 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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))))