Add the time bucket setting in segment DAO class.

This commit is contained in:
peng-yongsheng 2017-11-21 09:11:27 +08:00
parent 90bd26c89e
commit 4d415a8aee
2 changed files with 2 additions and 0 deletions

View File

@ -53,6 +53,7 @@ public class SegmentEsPersistenceDAO extends EsDAO implements ISegmentPersistenc
@Override public IndexRequestBuilder prepareBatchInsert(Segment data) {
Map<String, Object> source = new HashMap<>();
source.put(SegmentTable.COLUMN_DATA_BINARY, new String(Base64.getEncoder().encode(data.getDataBinary())));
source.put(SegmentTable.COLUMN_TIME_BUCKET, data.getTimeBucket());
logger.debug("segment source: {}", source.toString());
return getClient().prepareIndex(SegmentTable.TABLE, data.getId()).setSource(source);
}

View File

@ -50,6 +50,7 @@ public class SegmentH2PersistenceDAO extends H2DAO implements ISegmentPersistenc
H2SqlEntity entity = new H2SqlEntity();
source.put(SegmentTable.COLUMN_ID, data.getId());
source.put(SegmentTable.COLUMN_DATA_BINARY, data.getDataBinary());
source.put(SegmentTable.COLUMN_TIME_BUCKET, data.getTimeBucket());
logger.debug("segment source: {}", source.toString());
String sql = SqlBuilder.buildBatchInsertSql(SegmentTable.TABLE, source.keySet());