* (rightBorderInd - minInd) / (maxInd - minInd)));
} else if (colStatTypes[colStatIndex] == ColStatType.Double) {
return (Double) ((Double) min[0] + (((Double) max[0] - (Double) min[0])
* (rightBorderInd - minInd) / (maxInd - minInd)));
} else {
Decimal dmax = (Decimal) max[0];
BigDecimal bdmax = new BigDecimal(dmax.toString());
double doublemax = bdmax.doubleValue();
Decimal dmin = (Decimal) min[0];
BigDecimal bdmin = new BigDecimal(dmin.toString());
double doublemin = bdmin.doubleValue();
double ret = doublemin + (doublemax - doublemin)
* (rightBorderInd - minInd) / (maxInd - minInd);
return createThriftDecimal(String.valueOf(ret));
}
} else {
// left border is the max
if (colStatTypes[colStatIndex] == ColStatType.Long) {
return (Long) ((Long) min[0] + ((Long) max[0] - (Long) min[0])
* minInd / (minInd - maxInd));
} else if (colStatTypes[colStatIndex] == ColStatType.Double) {
return (Double) ((Double) min[0] + ((Double) max[0] - (Double) min[0])
* minInd / (maxInd - minInd));
} else {
Decimal dmax = (Decimal) max[0];
BigDecimal bdmax = new BigDecimal(dmax.toString());
double doublemax = bdmax.doubleValue();
Decimal dmin = (Decimal) min[0];
BigDecimal bdmin = new BigDecimal(dmin.toString());
double doublemin = bdmin.doubleValue();
double ret = doublemin + (doublemax - doublemin) * minInd
/ (maxInd - minInd);
return createThriftDecimal(String.valueOf(ret));
}
}
} else {
if (minInd < maxInd) {
// left border is the min
if (colStatTypes[colStatIndex] == ColStatType.Long) {
Long ret = (Long) max[0] - ((Long) max[0] - (Long) min[0]) * maxInd
/ (maxInd - minInd);
return ret;
} else if (colStatTypes[colStatIndex] == ColStatType.Double) {
Double ret = (Double) max[0] - ((Double) max[0] - (Double) min[0])
* maxInd / (maxInd - minInd);
return ret;
} else {
Decimal dmax = (Decimal) max[0];
BigDecimal bdmax = new BigDecimal(dmax.toString());
double doublemax = bdmax.doubleValue();
Decimal dmin = (Decimal) min[0];
BigDecimal bdmin = new BigDecimal(dmin.toString());
double doublemin = bdmin.doubleValue();
double ret = doublemax - (doublemax - doublemin) * maxInd
/ (maxInd - minInd);
return createThriftDecimal(String.valueOf(ret));
}
} else {
// right border is the min
if (colStatTypes[colStatIndex] == ColStatType.Long) {
Long ret = (Long) max[0] - ((Long) max[0] - (Long) min[0])
* (rightBorderInd - maxInd) / (minInd - maxInd);
return ret;
} else if (colStatTypes[colStatIndex] == ColStatType.Double) {
Double ret = (Double) max[0] - ((Double) max[0] - (Double) min[0])
* (rightBorderInd - maxInd) / (minInd - maxInd);
return ret;
} else {
Decimal dmax = (Decimal) max[0];
BigDecimal bdmax = new BigDecimal(dmax.toString());
double doublemax = bdmax.doubleValue();
Decimal dmin = (Decimal) min[0];
BigDecimal bdmin = new BigDecimal(dmin.toString());
double doublemin = bdmin.doubleValue();
double ret = doublemax - (doublemax - doublemin)
* (rightBorderInd - maxInd) / (minInd - maxInd);
return createThriftDecimal(String.valueOf(ret));
}