* @param constant The value of an RLE block * @param dimension The size of an RLE block * @return A SparseData with a single RLE block of size dimension having value constant */
| 1243 | * @return A SparseData with a single RLE block of size dimension having value constant |
| 1244 | */ |
| 1245 | SparseData makeSparseDataFromDouble(double constant,int64 dimension) { |
| 1246 | char *bytestore=(char *)palloc(sizeof(char)*9); |
| 1247 | SparseData sdata = float8arr_to_sdata(&constant,1); |
| 1248 | int8_to_compword(dimension,bytestore); /* create compressed version of |
| 1249 | int8 value */ |
| 1250 | |
| 1251 | int newlen = int8compstoragesize(bytestore); |
| 1252 | sdata->index->len = 0; // write over existing value |
| 1253 | appendBinaryStringInfo(sdata->index, bytestore, newlen); |
| 1254 | |
| 1255 | sdata->total_value_count = dimension; |
| 1256 | |
| 1257 | return sdata; |
| 1258 | } |
| 1259 | |
| 1260 | /** |
| 1261 | * Frees up the memory occupied by sdata |
no test coverage detected