Commit 451314f4 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

QueryTest::TestImportCSVTable

parent 64819fef
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -53,15 +53,25 @@ point chart examples:
--- TimeDomain!
--- max interpolation gap -> draw as missing data

IMPORT tablename FROM CSV { 'filename' | STDIN }
    [ [ WITH ]
          [ DELIMITER [ AS ] 'delimiter' ]
          [ ROW_DELIMITER [ AS ] 'row_delimiter' ]
          [ HEADER ]
          [ QUOTE [ AS ] 'escape' ]
          [ ESCAPE [ AS ] 'escape' ] ]

DRAW BAR CHART
  [TITLE title]
  [SUBTITLE subtitle]
    [ [ WITH ] ]
      [ TITLE 'title' ]
      [ SUBTITLE 'subtitle' ]
      [ ORIENTATION {HORIZONTAL|VERTICAL} ]
      [ STACKED {TRUE|FALSE} ]
  [LABELS {INSIDE|OUTSIDE|OFF}];
      [ LABELS {INSIDE|OUTSIDE|OFF} ] ]

DRAW AXIS {TOP|RIGHT|BOTTOM|LEFT}
  [TITLE title]
    [ [ WITH ] ]
      [ TITLE 'title' ]
      [ DOMAIN min, max [ LOGARITHMIC ] ];

SELECT
+18 −0
Original line number Diff line number Diff line
@@ -914,3 +914,21 @@ TEST_CASE(QueryTest, TestTypeError, [] () {
  });
});


TEST_CASE(QueryTest, TestImportCSVTable, [] () {
  TableRepository repo;

  auto query = Query(
      "  IMPORT TABLE gbp_per_country "
      "     FROM CSV 'test/fixtures/gbp_per_country_simple.csv' HEADER;"
      ""
      "  SELECT"
      "    sum(gbp) as global_gbp"
      "  FROM"
      "    gbp_per_country;",
      &repo);

  query.execute();
});

+4 −1
Original line number Diff line number Diff line
@@ -116,7 +116,10 @@ Executable* QueryPlan::buildDrawStatement(ASTNode* ast) {
      type = DrawStatement::T_AREA_CHART;
      break;
    default:
      assert(888 == 0); // FIXPAUL add error
      RAISE(
          util::RuntimeException,
          "invalid chart type: %s",
          Token::getTypeName(ast->getToken()->getType()));
      return nullptr;
  }