Skip to content

Commit

Permalink
upgrade greptimedb to v0.4 (#1311)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben <8350029+bk-saas@user.noreply.gitee.com>
  • Loading branch information
liyin and Ben authored Nov 3, 2023
1 parent 189b49c commit 6f29222
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
7 changes: 1 addition & 6 deletions warehouse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<influxdb.version>2.23</influxdb.version>
<spring-cloud-starter-openfeign.version>3.0.5</spring-cloud-starter-openfeign.version>
<taos-jdbcdriver.version>3.0.0</taos-jdbcdriver.version>
<greptimedb.version>0.3.1</greptimedb.version>
<greptimedb.version>0.4.0</greptimedb.version>
</properties>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -92,11 +92,6 @@
<artifactId>greptimedb-protocol</artifactId>
<version>${greptimedb.version}</version>
<exclusions>
<!-- TODO delete this when greptime sdk stable https://github.com/GreptimeTeam/greptimedb-client-java/issues/51 -->
<exclusion>
<groupId>com.github.GreptimeTeam</groupId>
<artifactId>greptime-proto</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ public class HistoryGrepTimeDbDataStorage extends AbstractHistoryDataStorage {
*/
private static final String STORAGE_DATABASE = "hertzbeat";
private static final String QUERY_HISTORY_SQL
= "SELECT ts, instance, \"%s\" FROM %s WHERE ts >= %s and monitor_id = %s order by ts desc;";
= "SELECT CAST (ts AS Int64) ts, instance, \"%s\" FROM %s WHERE ts >= %s and monitor_id = %s order by ts desc;";
private static final String QUERY_HISTORY_WITH_INSTANCE_SQL
= "SELECT ts, instance, \"%s\" FROM %s WHERE ts >= %s and monitor_id = %s and instance = %s order by ts desc;";
= "SELECT CAST (ts AS Int64) ts, instance, \"%s\" FROM %s WHERE ts >= %s and monitor_id = %s and instance = %s order by ts desc;";
private static final String QUERY_INSTANCE_SQL
= "SELECT DISTINCT instance FROM %s WHERE ts >= now() - interval '1' WEEK";
private static final String QUERY_HISTORY_INTERVAL_WITH_INSTANCE_SQL
= "SELECT first, avg ,max, min FROM (SELECT %s as first FROM %s WHERE monitor_id = %s and ts >= %s and ts < %s ORDER BY ts LIMIT 1) LEFT JOIN (SELECT avg(%s) as avg, min(%s) as min, max(%s) as max FROM %s WHERE ts >= %s and ts < %s) ON 1=1";
= "SELECT first, avg ,max, min FROM (SELECT \"%s\" as first FROM %s WHERE monitor_id = %s and ts >= %s and ts < %s ORDER BY ts LIMIT 1) LEFT JOIN (SELECT avg(\"%s\") as avg, min(\"%s\") as min, max(\"%s\") as max FROM %s WHERE ts >= %s and ts < %s) ON 1=1";
private static final String TABLE_NOT_EXIST = "not exist";
private static final String DATABASE_NOT_EXIST = "not exist";
private GreptimeDB greptimeDb;
Expand Down Expand Up @@ -158,7 +158,7 @@ void saveData(CollectRep.MetricsData metricsData) {
TableSchema.Builder tableSchemaBuilder = TableSchema.newBuilder(TableName.with(STORAGE_DATABASE, table));

List<SemanticType> semanticTypes = new LinkedList<>(Arrays.asList(SemanticType.Tag, SemanticType.Tag, SemanticType.Timestamp));
List<ColumnDataType> dataTypes = new LinkedList<>(Arrays.asList(ColumnDataType.String, ColumnDataType.String, ColumnDataType.Int64));
List<ColumnDataType> dataTypes = new LinkedList<>(Arrays.asList(ColumnDataType.String, ColumnDataType.String, ColumnDataType.TimestampMillisecond));
List<String> columnNames = new LinkedList<>(Arrays.asList("monitor_id", "instance", "ts"));

List<CollectRep.Field> fieldsList = metricsData.getFieldsList();
Expand Down

0 comments on commit 6f29222

Please sign in to comment.