未验证 提交 cd8b83ff 编写于 作者: V Vlad Ilyushchenko 提交者: GitHub

chore: small fixes for ksum/nsum and added logging (#245)

上级 3d092dea
......@@ -438,7 +438,7 @@ double SUM_DOUBLE_KAHAN(double *d, int64_t count) {
double sum = horizontal_add(sumVec);
double c = horizontal_add(cVec);
int nans = horizontal_add(nancount);
int64_t nans = horizontal_add(nancount);
for (; d < lim; d++) {
double x = *d;
if (x == x) {
......@@ -459,6 +459,7 @@ double SUM_DOUBLE_KAHAN(double *d, int64_t count) {
}
double SUM_DOUBLE_NEUMAIER(double *d, int64_t count) {
// return sumDoubleNeumaier_Vanilla(d, count);
Vec8d inputVec;
const int step = 8;
const auto *lim = d + count;
......@@ -483,7 +484,7 @@ double SUM_DOUBLE_NEUMAIER(double *d, int64_t count) {
double sum = horizontal_add(sumVec);
double c = horizontal_add(cVec);
int nans = horizontal_add(nancount);
int64_t nans = horizontal_add(nancount);
for (; d < lim; d++) {
double input = *d;
if (input == input) {
......
......@@ -578,6 +578,12 @@ public class TableReader implements Closeable {
}
}
}
LOG.info()
.$("purging memory [prevMinTimestamp=").$ts(prevMinTimestamp)
.$(", minTimestamp=").$ts(minTimestamp)
.$(", partitionCount=").$(partitionCount)
.$(']').$();
// adjust columns list when leading partitions have been removed
if (prevMinTimestamp != minTimestamp) {
assert prevMinTimestamp < minTimestamp;
......@@ -989,7 +995,8 @@ public class TableReader implements Closeable {
.$("new transaction [txn=").$(txn)
.$(", transientRowCount=").$(transientRowCount)
.$(", fixedRowCount=").$(fixedRowCount)
.$(", maxTimestamp=").$(maxTimestamp)
.$(", minTimestamp=").$ts(this.minTimestamp)
.$(", maxTimestamp=").$ts(this.maxTimestamp)
.$(", attempts=").$(count)
.$(']').$();
return true;
......
......@@ -73,25 +73,6 @@ public class GroupByFunctionTest extends AbstractGriffinTest {
);
}
@Test
public void testKeyedNSumDoubleAllNaN() throws Exception {
assertQuery("s\tnsum\n" +
"aa\tNaN\n" +
"bb\tNaN\n",
"select s, nsum(d) nsum from x",
"create table x as " +
"(" +
"select" +
" rnd_symbol('aa','bb') s," +
" NaN d" +
" from" +
" long_sequence(200)" +
")",
null,
true
);
}
@Test
public void testKeyedKSumDoubleSomeNaN() throws Exception {
assertQuery("s\tksum\n" +
......@@ -111,25 +92,6 @@ public class GroupByFunctionTest extends AbstractGriffinTest {
);
}
@Test
public void testKeyedNSumDoubleSomeNaN() throws Exception {
assertQuery("s\tnsum\n" +
"aa\t37.816973659638755\n" +
"bb\t50.90642211368272\n",
"select s, nsum(d) nsum from x",
"create table x as " +
"(" +
"select" +
" rnd_symbol('aa','bb') s," +
" rnd_double(2) d" +
" from" +
" long_sequence(200)" +
")",
null,
true
);
}
@Test
public void testKeyedMaxDateAllNaN() throws Exception {
assertQuery("s\tmin\n" +
......@@ -453,6 +415,44 @@ public class GroupByFunctionTest extends AbstractGriffinTest {
);
}
@Test
public void testKeyedNSumDoubleAllNaN() throws Exception {
assertQuery("s\tnsum\n" +
"aa\tNaN\n" +
"bb\tNaN\n",
"select s, nsum(d) nsum from x",
"create table x as " +
"(" +
"select" +
" rnd_symbol('aa','bb') s," +
" NaN d" +
" from" +
" long_sequence(200)" +
")",
null,
true
);
}
@Test
public void testKeyedNSumDoubleSomeNaN() throws Exception {
assertQuery("s\tnsum\n" +
"aa\t37.816973659638755\n" +
"bb\t50.90642211368272\n",
"select s, nsum(d) nsum from x",
"create table x as " +
"(" +
"select" +
" rnd_symbol('aa','bb') s," +
" rnd_double(2) d" +
" from" +
" long_sequence(200)" +
")",
null,
true
);
}
@Test
public void testKeyedSumDoubleAllNaN() throws Exception {
assertQuery("s\tsum\n" +
......@@ -585,16 +585,16 @@ public class GroupByFunctionTest extends AbstractGriffinTest {
}
@Test
public void testVectorNSumDoubleAllNaN() throws Exception {
public void testVectorKSumOneDouble() throws Exception {
assertQuery("sum\n" +
"NaN\n",
"select nsum(d) sum from x",
"416711.27751251\n",
"select round(ksum(d),8) sum from x",
"create table x as " +
"(" +
"select" +
" NaN d" +
" rnd_double(2) d" +
" from" +
" long_sequence(200)" +
" long_sequence(1000000)" +
")",
null,
false
......@@ -602,16 +602,16 @@ public class GroupByFunctionTest extends AbstractGriffinTest {
}
@Test
public void testVectorKSumOneDouble() throws Exception {
public void testVectorNSumDoubleAllNaN() throws Exception {
assertQuery("sum\n" +
"416711.27751251357\n",
"select ksum(d) sum from x",
"NaN\n",
"select nsum(d) sum from x",
"create table x as " +
"(" +
"select" +
" rnd_double(2) d" +
" NaN d" +
" from" +
" long_sequence(1000000)" +
" long_sequence(200)" +
")",
null,
false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册