Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ private Object validateStructurallyEqualTypes(
return null;
} else if (inputTypeDef instanceof EnumTypeDefinition) {
checkState(
outputTypeDef instanceof EnumTypeDefinition
|| outputTypeDef instanceof ScalarTypeDefinition
&& inputTypeDef.getName().equals(outputTypeDef.getName()),
(outputTypeDef instanceof EnumTypeDefinition
&& inputTypeDef.getName().equals(outputTypeDef.getName()))
|| (outputTypeDef instanceof ScalarTypeDefinition
&& outputTypeDef.getName().equals("String")),
inputType.getSourceLocation(),
"Enum types not matching for field %s %s: found %s but wanted %s",
outputField.getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void specificUseCase(UseCaseParam param, TestContainerHook hook) {

/** Ad-hoc debugging entry point. Change the path below to run a single use case manually. */
static Stream<UseCaseParam> specificUseCaseProvider() {
return Stream.of(new UseCaseParam(USE_CASES.resolve("repository").resolve("package.json")));
return Stream.of(new UseCaseParam(USE_CASES.resolve("temporal-join").resolve("package.json")));
}

@ParameterizedTest
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"version": "1",
"enabled-engines": ["vertx", "postgres", "kafka", "flink"],
"script": {
"main": "temporal-join.sqrl"
"main": "temporal-join.sqrl",
"graphql": "temporal-join.graphqls"
},
"engines": {
"flink" : {
Expand All @@ -13,6 +14,7 @@
},
"test-runner": {
"delay-sec": 30,
"mutation-delay-sec": 1
"mutation-delay-sec": 1,
"use-inferred-schema": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
"data" : {
"add1" : {
"sensorid" : 101,
"temperature" : 23.5
"temperature" : 23.5,
"placement" : "DOWNSTAIRS"
},
"add2" : {
"sensorid" : 101,
"temperature" : 33.5
"temperature" : 33.5,
"placement" : "DOWNSTAIRS"
},
"add3" : {
"sensorid" : 111,
"temperature" : 13.5
"temperature" : 13.5,
"placement" : "UPSTAIRS"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
"EnrichedSensorReading" : [ {
"sensorid" : 101,
"temperature" : 23.5,
"placement" : "DOWNSTAIRS",
"sensor_name" : "Living Room Sensor"
}, {
"sensorid" : 101,
"temperature" : 33.5,
"placement" : "DOWNSTAIRS",
"sensor_name" : "Living Room Sensor"
}, {
"sensorid" : 111,
"temperature" : 13.5,
"placement" : "UPSTAIRS",
"sensor_name" : "Dining Room Sensor"
} ]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"data" : {
"EnrichedSensorReadingByPlacement" : [ {
"sensorid" : 101,
"temperature" : 23.5,
"placement" : "DOWNSTAIRS",
"sensor_name" : "Living Room Sensor"
}, {
"sensorid" : 101,
"temperature" : 33.5,
"placement" : "DOWNSTAIRS",
"sensor_name" : "Living Room Sensor"
} ]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"An RFC-3339 compliant Full Date Scalar"
scalar Date

"A DateTime scalar that handles both full RFC3339 and shorter timestamp formats"
scalar DateTime

type EnrichedSensorReading {
sensorid: Int!
temperature: Float!
placement: String!
event_time: DateTime!
sensor_name: String
}

"A JSON scalar"
scalar JSON

"24-hour clock time value string in the format `hh:mm:ss` or `hh:mm:ss.sss`."
scalar LocalTime

"A 64-bit signed integer"
scalar Long

type Mutation {
SensorReading(event: SensorReadingInput!): SensorReadingResultOutput!
SensorUpdates(event: SensorUpdatesInput!): SensorUpdatesResultOutput!
}

type Query {
EnrichedSensorReading(limit: Int = 10, offset: Int = 0): [EnrichedSensorReading!]
SensorReading(limit: Int = 10, offset: Int = 0): [SensorReading!]
SensorUpdates(limit: Int = 10, offset: Int = 0): [SensorUpdates!]
EnrichedSensorReadingByPlacement(placement: Placements!, limit: Int = 10, offset: Int = 0): [EnrichedSensorReading!]
}

enum Placements {
DOWNSTAIRS
UPSTAIRS
}

type SensorReading {
sensorid: Int!
temperature: Float!
placement: Placements!
event_time: DateTime!
}

input SensorReadingInput {
sensorid: Int!
temperature: Float!
placement: Placements!
}

type SensorReadingResultOutput {
sensorid: Int!
temperature: Float!
placement: Placements!
event_time: DateTime!
}

type SensorUpdates {
sensorid: Int!
sensor_name: String!
lastUpdated: DateTime!
}

input SensorUpdatesInput {
sensorid: Int!
sensor_name: String!
}

type SensorUpdatesResultOutput {
sensorid: Int!
sensor_name: String!
lastUpdated: DateTime!
}

enum _McpMethodType {
NONE
TOOL
RESOURCE
}

enum _RestMethodType {
NONE
GET
POST
}

directive @api(mcp: _McpMethodType, rest: _RestMethodType, uri: String) on QUERY | MUTATION | FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
CREATE TABLE SensorReading (
sensorid INT NOT NULL,
temperature FLOAT NOT NULL,
placement STRING NOT NULL,
event_time TIMESTAMP_LTZ(3) NOT NULL METADATA FROM 'timestamp'
);

Expand All @@ -17,8 +18,11 @@ EXPORT SensorUpdates TO logger.SensorUpdates;

_SensorDistinct := DISTINCT SensorUpdates ON sensorid ORDER BY lastUpdated DESC;

EnrichedSensorReading := SELECT r.sensorid, r.temperature, r.event_time, u.sensor_name
EnrichedSensorReading := SELECT r.sensorid, r.temperature, r.placement, r.event_time, u.sensor_name
FROM SensorReading r LEFT JOIN _SensorDistinct FOR SYSTEM_TIME AS OF r.event_time u on r.sensorid = u.sensorid
ORDER BY r.event_time ASC;

EnrichedSensorReadingByPlacement(placement STRING NOT NULL) :=
SELECT * FROM EnrichedSensorReading WHERE placement = :placement;

EXPORT EnrichedSensorReading TO logger.Result;
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
mutation SensorReadings {
add1: SensorReading(event: {
sensorid: 101,
temperature: 23.5
temperature: 23.5,
placement: DOWNSTAIRS
}) {
sensorid
temperature
placement
}
add2: SensorReading(event: {
sensorid: 101,
temperature: 33.5
placement: DOWNSTAIRS
}) {
sensorid
temperature
placement
}
add3: SensorReading(event: {
sensorid: 111,
temperature: 13.5
placement: UPSTAIRS
}) {
sensorid
temperature
placement
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ query GetEnrichedSensorReadings {
EnrichedSensorReading(limit: 10, offset: 0) {
sensorid
temperature
placement
sensor_name
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
query GetEnrichedSensorReadingByPlacement {
EnrichedSensorReadingByPlacement(placement: DOWNSTAIRS, limit: 10, offset: 0) {
sensorid
temperature
placement
sensor_name
}
}
Loading