public GenericMetricEntityBatchReader(String metricName, SearchCondition condition) throws Exception { reader = new GenericEntityStreamReader(GenericMetricEntity.GENERIC_METRIC_SERVICE, condition, metricName); }
@Override public long getFirstTimestamp() { return reader.getFirstTimestamp(); } }
@Override public long getLastTimestamp() { long lastTimestamp = 0; for (GenericEntityStreamReader reader : readers) { if (lastTimestamp < reader.getLastTimestamp()) { lastTimestamp = reader.getLastTimestamp(); } } return lastTimestamp; }
public GenericEntityStreamReader(EntityDefinition entityDef, SearchCondition condition, String prefix) throws InstantiationException, IllegalAccessException{ this.prefix = prefix; checkNotNull(entityDef, "entityDef"); this.entityDef = entityDef; checkNotNull(entityDef, "EntityDefinition"); this.condition = condition; this.readerAfterPlan = selectQueryReader(); }
@Override public void readAsStream() throws Exception{ reader.register(this); reader.readAsStream(); }
StreamReader reader = null; if(ed.getMetricDefinition() == null){ reader = new GenericEntityStreamReader(serviceName, condition); }else{ // metric aggregation need metric reader reader = new GenericMetricEntityDecompactionStreamReader(metricName, condition); if(ed.getMetricDefinition() == null){ if(parallel <= 0){ // TODO ugly quick win reader = new GenericEntityStreamReader(serviceName, condition); }else{ reader = new GenericEntityStreamReaderMT(serviceName, condition, parallel); LOG.info("Output: " + StringUtils.join(condition.getOutputFields(), ", ")); GenericEntityStreamReader reader = new GenericEntityStreamReader(serviceName, condition); HierarchicalAggregator agg = new HierarchicalAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields()); reader.register(agg); reader.readAsStream(); if(comp.sortOptions() == null){ result.setObj(agg.result()); result.setLastTimestamp(reader.getLastTimestamp()); result.setFirstTimestamp(reader.getFirstTimestamp());
@Override public Void call() throws Exception { reader.readAsStream(); return null; } }
@Override public void readAsStream() throws Exception { // populate listeners to all readers for (EntityCreationListener l : listeners) { for (GenericEntityStreamReader r : readers) { r.register(l); } } List<Future<Void>> futures = new ArrayList<Future<Void>>(); for (GenericEntityStreamReader r : readers) { SingleReader reader = new SingleReader(r); Future<Void> readFuture = EagleConfigFactory.load().getExecutor().submit(reader); futures.add(readFuture); } // join threads and check exceptions for (Future<Void> future : futures) { try { future.get(); } catch (Exception ex) { LOG.error("Error in read", ex); throw ex; } } }
StreamReader reader = null; if(ed.getMetricDefinition() == null){ reader = new GenericEntityStreamReader(serviceName, condition); }else{ // metric aggregation need metric reader reader = new GenericMetricEntityDecompactionStreamReader(metricName, condition); if(ed.getMetricDefinition() == null){ if(parallel <= 0){ // TODO ugly quick win reader = new GenericEntityStreamReader(serviceName, condition); }else{ reader = new GenericEntityStreamReaderMT(serviceName, condition, parallel); LOG.info("Output: " + StringUtils.join(condition.getOutputFields(), ", ")); GenericEntityStreamReader reader = new GenericEntityStreamReader(serviceName, condition); HierarchicalAggregator agg = new HierarchicalAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields()); reader.register(agg); reader.readAsStream(); if(comp.sortOptions() == null){ result.setObj(agg.result()); result.setLastTimestamp(reader.getLastTimestamp()); result.setFirstTimestamp(reader.getFirstTimestamp());
@Override public void readAsStream() throws Exception { reader.register(this); reader.readAsStream(); }
public GenericEntityStreamReader(EntityDefinition entityDef, SearchCondition condition, String prefix) throws InstantiationException, IllegalAccessException { this.prefix = prefix; checkNotNull(entityDef, "entityDef"); this.entityDef = entityDef; checkNotNull(entityDef, "EntityDefinition"); this.condition = condition; this.readerAfterPlan = selectQueryReader(); }
@Override public Void call() throws Exception{ reader.readAsStream(); return null; } }
@Override public void readAsStream() throws Exception{ // populate listeners to all readers for(EntityCreationListener l : _listeners){ for(GenericEntityStreamReader r : readers){ r.register(l); } } List<Future<Void>> futures = new ArrayList<Future<Void>>(); for(GenericEntityStreamReader r : readers){ SingleReader reader = new SingleReader(r); Future<Void> readFuture = EagleConfigFactory.load().getExecutor().submit(reader); futures.add(readFuture); } // join threads and check exceptions for(Future<Void> future : futures){ try{ future.get(); }catch(Exception ex){ LOG.error("Error in read", ex); throw ex; } } }
public GenericMetricEntityBatchReader(String metricName, SearchCondition condition) throws Exception{ reader = new GenericEntityStreamReader(GenericMetricEntity.GENERIC_METRIC_SERVICE, condition, metricName); }
@SuppressWarnings("unchecked") public <T> List<T> read() throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("Start reading as batch mode"); } reader.register(this); reader.readAsStream(); return (List<T>)entities; } }
@Override public long getFirstTimestamp() { long firstTimestamp = 0; for (GenericEntityStreamReader reader : readers) { if (firstTimestamp > reader.getLastTimestamp() || firstTimestamp == 0) { firstTimestamp = reader.getLastTimestamp(); } } return firstTimestamp; } }
@Override public long getFirstTimestamp() { return reader.getFirstTimestamp(); } }
public GenericEntityStreamReader(String serviceName, SearchCondition condition, String prefix) throws InstantiationException, IllegalAccessException { this.prefix = prefix; checkNotNull(serviceName, "serviceName"); this.entityDef = EntityDefinitionManager.getEntityByServiceName(serviceName); checkNotNull(entityDef, "EntityDefinition"); this.condition = condition; this.readerAfterPlan = selectQueryReader(); }
public GenericEntityBatchReader(String serviceName, SearchCondition condition) throws InstantiationException, IllegalAccessException { reader = new GenericEntityStreamReader(serviceName, condition); reader.register(this); }
@SuppressWarnings("unchecked") public <T> List<T> read() throws Exception{ if(LOG.isDebugEnabled()) LOG.debug("Start reading as batch mode"); reader.register(this); reader.readAsStream(); return (List<T>)entities; } }