… could not figure out how to work with a string time that includes GMT offset so left that as is… added a string field that contained the unix epoc value and then defined that via the ksql as a timestamp with desired results
Curious to know, the schema i define the field as a number, but it’s getting a string posted to it, topic is happily accepting the payloads?
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"BasketItems": {
"items": [
{
"properties": {
"Brand": {
"type": "string"
},
"Catergory": {
"type": "string"
},
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"Price": {
"type": "number"
},
"Quantity": {
"type": "integer"
}
},
"required": [
"Id",
"Name",
"Brand",
"Catergory",
"Price",
"Quantity"
],
"type": "object"
}
],
"type": "array"
},
"Clerk": {
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
}
},
"required": [
"Id",
"Name"
],
"type": "object"
},
"InvoiceNumber": {
"type": "string"
},
"Nett": {
"type": "number"
},
"SaleDateTime": {
"format": "date",
"type": "string"
},
"SaleTimestamp": {
"type": "number"
},
"Store": {
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
}
},
"required": [
"Id",
"Name"
],
"type": "object"
},
"TerminalPoint": {
"type": "string"
},
"Total": {
"type": "number"
},
"VAT": {
"type": "number"
}
},
"required": [
"InvoiceNumber",
"SaleDateTime",
"SaleTimestamp",
"Store",
"Clerk",
"TerminalPoint",
"BasketItems",
"Nett",
"VAT",
"Total"
],
"type": "object"
}
Stream Create
CREATE STREAM salesbasket (
InvoiceNumber VARCHAR ,
SaleDateTime VARCHAR,
SaleTimestamp TIMESTAMP,
TerminalPoint VARCHAR,
Nett DOUBLE,
Vat DOUBLE,
Total DOUBLE,
Store STRUCT<
Id VARCHAR,
Name VARCHAR>,
Clerk STRUCT<
Id VARCHAR,
Name VARCHAR>,
BasketItems ARRAY< STRUCT<id VARCHAR,
Name VARCHAR,
Brand VARCHAR,
Catergory VARCHAR,
Price DOUBLE,
Quantity integer >>)
WITH (KAFKA_TOPIC='salesbasket',
VALUE_FORMAT='JSON',
PARTITIONS=1);