Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am charles-tan on github.
  • I am charlestan (https://keybase.io/charlestan) on keybase.
  • I have a public key ASCo6erESP8eQ6GYQtOVPvqPmHl3Ivn21qWVz1-hqSPbFgo

To claim this, I am signing this object:

{
"Order_timestamp": "2023.03.02 13:53:22",
"orderID": "Order_17",
"customerID": "customer_32",
"price": "12.31",
"itemID": "7740485A-836A-447F-96F9-DBBD00E92387",
"destination_address": {
"number": 2555,
"street": "University",
"city": "Palo Alto",
{
"shipment_timestamp": "2023.03.02 13:53:22",
"orderID": "Order_17",
"shipment_center_ID": 3
}
CREATE STREAM "Orders" (
order_timestamp TIMESTAMP(3),
"orderID" VARCHAR,
"customerID" VARCHAR,
price DOUBLE,
"itemID" VARCHAR,
destination_address STRUCT<"number" BIGINT, street VARCHAR, city VARCHAR, "state" VARCHAR, zipcode VARCHAR>
) WITH (
'topic'='Orders',
'value.format'='json',
CREATE STREAM "Shipments" (
shipment_timestamp TIMESTAMP(3),
"orderID" VARCHAR,
"shipment_center_ID" BIGINT
) WITH (
'topic'='Shipments',
'value.format'='json',
'timestamp'='shipment_timestamp'
);
CREATE STREAM "OrdersShipmentsJoin" AS
SELECT
*
FROM "Orders" o
LEFT JOIN "Shipments" s
WITHIN 30 minutes
ON o."orderID" = s."orderID";
CREATE STREAM "OrdersNotShipped" AS
SELECT
order_timestamp,
"o_orderID" AS "orderID",
"customerID",
"itemID",
destination_address->zipcode AS "Destination_zipcode"
FROM "OrdersShipmentsJoin"
WHERE shipment_timestamp IS NULL;
{
"order_timestamp": "2023-03-02T13:53:22",
"orderID": "Order_1",
"customerID": "customer_32",
"price": "12.31",
"itemID": "7740485A-836A-447F-96F9-DBBD00E92387",
"destination_address": {
"number": 2555,
"street": "University",
"city": "Palo Alto",
{
"shipment_timestamp": "2023-03-02T14:08:43",
"orderID": "Order_1",
"shipment_center_ID": 7
}
{
"shipment_timestamp": "2023-03-02T14:45:17",
"orderID": "Order_2",
"shipment_center_ID": 3
}
{
"order_timestamp": "2023-03-02T13:53:22",
"o_orderID": "Order_1",
"customerID": "customer_32",
"price": 12.31,
"itemID": "7740485A-836A-447F-96F9-DBBD00E92387",
"destination_address": {
"number": 2555,
"street": "University",
"city": "Palo Alto",