Commit b6ea0452 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

implement count(*)

parent ab17530e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -155,7 +155,13 @@ ASTNode* Parser::methodCall() {
  /* read arguments */
  do {
    consumeToken();

    /* ignore T_ALL in SELECT count(*) FROM ... */
    if (*cur_token_ == Token::T_ASTERISK) {
      consumeToken();
    } else {
      e->appendChild(expr());
    }
  } while (*cur_token_ == Token::T_COMMA);

  expectAndConsume(Token::T_RPAREN);
+9 −0
Original line number Diff line number Diff line
@@ -824,6 +824,15 @@ TEST_CASE(SQLTest, TestTableScanGroupByCountQuery, [] () {
  EXPECT(sum == 10);
});

TEST_CASE(SQLTest, TestCountAllQuery, [] () {
  auto results = executeTestQuery(
      "  SELECT count(*) FROM testtable2;");

  EXPECT(results->getNumRows() == 1);
  EXPECT_EQ(results->getRow(0)[0], "10");
});


TEST_CASE(SQLTest, TestTableScanGroupBySumQuery, [] () {
  auto results = executeTestQuery(
      "  SELECT"
+6 −4
Original line number Diff line number Diff line
@@ -9,23 +9,22 @@
[ SQL ]
    - find time constraint from sql query
    - scan samples with range / sstable binary search
    - SELECT count(*) ...
    - group over doc: GROUP OVER TIMEWINDOW(time_window, step) oder so
    - sql time helpers (1hour, etc)
    - sql: in
    - sql: if
    - sql: case
    - functions: sum, avg, percentile, mean, variance, stddev, delta, nth_derivate,
    - round fn

[ release ]
    - inline libev
    - svg: escape series names, labels!
    - functions: sum, avg, percentile, mean, variance, stddev, delta, nth_derivate,
    - round fn
    - bug: chart with only same values -> strange rendering
    - bug: multiple draw statements dont produce multiple charts
    - bug: NAN is not a valid value in SVG
    - bug: line chart with only negative values
    - bug: 2d area chart with explicit y domain, min > 0
    - inline libev

-----

@@ -71,6 +70,9 @@
           no complex nodes inbetween
    - report with markdown + chartsql

[ bug q ]
    - SELECT count(*) AS row_count FROM `/osx/load_avg_5m`; --- does not return col name

[ refactor q ]
    - refactor nextRow(SValue* row, size_t len) -> nextRow(RowType) (std::vector<SValue>)
    - refactor tokenizer // dynamically register tokens