Skip to content

Commit

Permalink
Faster select series names
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobRobertSteeves committed Jan 15, 2016
1 parent d56688b commit 461249d
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.knowm.datasets.numenta;

import java.util.ArrayList;
import java.util.List;

import org.knowm.datasets.common.business.DatasetsDAO;
Expand Down Expand Up @@ -39,17 +38,14 @@ public static List<SeriesPoint> selectSeries(String series) {

Object[] params = new Object[] { series };
String SELECT_ALL_SQL = "SELECT * FROM NUMENTA WHERE series = ? ORDER BY timestamp ASC";

return Yank.queryBeanList(SELECT_ALL_SQL, SeriesPoint.class, params);
}

public static List<String> selectSeriesNames() {

String SELECT_ALL_SQL = "SELECT DISTINCT SERIES FROM NUMENTA";
List<SeriesPoint> uniqueSeries = Yank.queryBeanList(SELECT_ALL_SQL, SeriesPoint.class, null);
List<String> names = new ArrayList<String>();
for (SeriesPoint p : uniqueSeries) {
names.add(p.getSeries());
}
String SELECT_SERIES_NAMES_SQL = "SELECT DISTINCT series FROM NUMENTA";
List<String> names = Yank.queryColumn(SELECT_SERIES_NAMES_SQL, "series", String.class, null);
return names;
}

Expand Down

0 comments on commit 461249d

Please sign in to comment.