Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugin/trino-prometheus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import io.trino.spi.block.Block;

import javax.annotation.Nullable;

import java.time.Instant;

import static java.util.Objects.requireNonNull;
Expand All @@ -25,13 +27,14 @@ public class PrometheusStandardizedRow
private final Instant timestamp;
private final Double value;

public PrometheusStandardizedRow(Block labels, Instant timestamp, Double value)
public PrometheusStandardizedRow(@Nullable Block labels, Instant timestamp, Double value)
{
this.labels = requireNonNull(labels, "labels is null");
this.labels = labels;
this.timestamp = requireNonNull(timestamp, "timestamp is null");
this.value = requireNonNull(value, "value is null");
}

@Nullable
public Block getLabels()
{
return labels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,11 @@ public void testDescribeTable()
"('timestamp', 'timestamp(3) with time zone', '', '')," +
"('value', 'double', '', '')");
}

@Test
public void testSelectWithoutLabels()
{
assertQuerySucceeds("SELECT timestamp, value FROM prometheus.default.up");
assertQuery("SELECT value FROM prometheus.default.up LIMIT 1", "VALUES ('1.0')");
}
}