提交 9208b8f3 编写于 作者: D Daniel Gustafsson

Tidy up error reporting in gp_sparse_vector a little

This cleans up the error messages in the sparse vector code a little
by ensuring they mostly conform to the style guide for error handling.
Also fixes a nearby typo and removes commented out elogs which are
clearly dead code.
Reviewed-by: NHeikki Linnakangas <hlinnakangas@pivotal.io>
上级 41e8ed17
......@@ -236,8 +236,9 @@ double *sdata_to_float8arr(SparseData sdata) {
if (sdata->type_of_data != FLOAT8OID)
{
ereport(ERROR,(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("data type of SparseData is not FLOAT64")));
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("data type of SparseData is not FLOAT64")));
}
array = (double *) palloc(sizeof(double) * sdata->total_value_count);
......
......@@ -506,8 +506,8 @@ check_sdata_dimensions(SparseData left, SparseData right)
if (left->total_value_count != right->total_value_count)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("Operation undefined when dimension of left and right vectors are not the same")));
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("operation undefined when dimension of left and right vectors are not the same")));
}
}
......@@ -718,8 +718,8 @@ static inline SparseData op_sdata_by_sdata(int operation,SparseData left,
if ((operation > 3)|| (operation < 0))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("Operation not in range 0-3")));
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("operation not in range 0-3")));
while (1)
{
......
......@@ -152,8 +152,8 @@ gp_extract_feature_histogram(PG_FUNCTION_ARGS)
/* End of UDF wrapper =================================================== */
#ifdef VERBOSE
elog(NOTICE,"Number of text items in the feature array is: %d\n",num_features);
elog(NOTICE,"Number of text items in the document array is: %d\n",num_words);
elog(NOTICE,"Number of text items in the feature array is: %d",num_features);
elog(NOTICE,"Number of text items in the document array is: %d",num_words);
#endif
returnval = classify_document(features,num_features,document,num_words,gp_isnew_query());
......@@ -198,7 +198,7 @@ classify_document(char **features, int num_features, char **document, int num_wo
if (allocate) {
int *ordinals;
#ifdef VERBOSE
elog(NOTICE,"Classify_document allocating..., Number of features = %d\n",num_features);
elog(NOTICE,"Classify_document allocating..., Number of features = %d",num_features);
#endif
/*
* Calling hdestroy() isn't guaranteed to free any memory allocated
......@@ -269,7 +269,7 @@ classify_document(char **features, int num_features, char **document, int num_wo
histogram[*((int *)found_item->data)]++; //Increment the count at the appropriate ordinal
} else {
#ifdef VERBOSE
elog(NOTICE,"Item not found in feature list %s\n",(char *)item.key);
elog(NOTICE,"Item not found in feature list %s",(char *)item.key);
#endif
continue;
}
......@@ -304,7 +304,7 @@ get_text_array_contents(ArrayType *array, int *numitems)
if (ARR_ELEMTYPE(array) != TEXTOID) {
*numitems = 0;
elog(WARNING,"attempt to use a non-text[][] variable with a function that uses text[][] argumenst.\n");
elog(WARNING,"attempt to use a non-text[][] variable with a function that uses text[][] arguments");
return(NULL);
}
......
......@@ -610,12 +610,10 @@ void check_dimension(SvecType *svec1, SvecType *svec2, char *msg) {
if ((!IS_SCALAR(svec1)) &&
(!IS_SCALAR(svec2)) &&
(svec1->dimension != svec2->dimension)) {
// elog(NOTICE,"svec1: %s",svec_out_internal(svec1));
// elog(NOTICE,"svec2: %s",svec_out_internal(svec2));
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("%s: array dimension of inputs are not the same: dim1=%d, dim2=%d\n",
msg, svec1->dimension, svec2->dimension)));
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("%s: array dimension of inputs are not the same: dim1=%d, dim2=%d\n",
msg, svec1->dimension, svec2->dimension)));
}
}
......@@ -633,14 +631,12 @@ svec_cast_float8arr(PG_FUNCTION_ARGS) {
if (ARR_NDIM(A_PG) != 1)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("svec_cast_float8arr only defined over 1 dimensional arrays"))
);
errmsg("svec_cast_float8arr only defined over 1 dimensional arrays")));
if (ARR_NULLBITMAP(A_PG))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("svec_cast_float8arr does not allow null bitmaps on arrays"))
);
errmsg("svec_cast_float8arr does not allow null bitmaps on arrays")));
/* Extract array */
......@@ -1251,8 +1247,6 @@ partition_select (char **lists, size_t nlists, size_t *widths,
(const char **)lists,nlists,widths);
int nextRealIndex = realIndexCalc(MIN(maxlen,pivotNewIndex+1),
(const char **)lists,nlists,widths);
// elog(NOTICE,"k,realIndex,nextRealIndex,pni=%d,%d,%d,%d",k,realIndex,nextRealIndex,
// pivotNewIndex);
if ((realIndex <= k) && (k < nextRealIndex ))
{
break;
......
......@@ -235,7 +235,7 @@ svec_in(PG_FUNCTION_ARGS)
pgarray_vals = DatumGetArrayTypeP(OidFunctionCall3(F_ARRAY_IN,CStringGetDatum(values),
ObjectIdGetDatum(FLOAT8OID),Int32GetDatum(-1)));
/* Make an empty StringInfo becase we have the data array already */
/* Make an empty StringInfo because we have the data array already */
vals = (double *)ARR_DATA_PTR(pgarray_vals);
num_values = *(ARR_DIMS(pgarray_vals));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册