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