Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1751
  
    example SQL:
    _NOTE:  All the `\n` should be removed before you test it_
    ```
    CREATE EXTERNAL TABLE ORDERS (ID INT PRIMARY KEY, UNIT_PRICE INT, QUANTITY 
INT)
     STORED AS
     INPUTFORMAT org.apache.storm.sql.runtime.serde.avro.AvroScheme
     OUTPUTFORMAT org.apache.storm.sql.runtime.serde.avro.AvroSerializer
     LOCATION 'kafka://localhost:2181/brokers?topic=orders'
     TBLPROPERTIES '
     {
        "producer": {
                "bootstrap.servers": "localhost:9092",
                "acks": "1",
                "key.serializer": 
"org.apache.org.apache.storm.kafka.IntSerializer",
                "value.serializer": 
"org.apache.org.apache.storm.kafka.ByteBufferSerializer"
        },
        
        "input.avro.schema": "
    {\"type\": \"record\", 
     \"name\": \"orders\",
     \"fields\" : [
      {\"name\": \"id\", \"type\": \"int\"},
      {\"name\": \"unit_price\", \"type\": \"int\"},
      {\"name\": \"quantity\", \"type\": \"int\"},
      {\"name\": \"timestamp\", \"type\": \"long\"}
     ]
    }
        ",
        
        "output.avro.schema": "
    {\"type\": \"record\", 
     \"name\": \"orders\",
     \"fields\" : [
      {\"name\": \"id\", \"type\": \"int\"},
      {\"name\": \"unit_price\", \"type\": \"int\"},
      {\"name\": \"quantity\", \"type\": \"int\"}
     ]
    }
        "
    }'
    
    CREATE EXTERNAL TABLE LARGE_ORDERS (ID INT PRIMARY KEY, TOTAL INT)
     STORED AS
     INPUTFORMAT org.apache.storm.sql.runtime.serde.avro.AvroScheme
     OUTPUTFORMAT org.apache.storm.sql.runtime.serde.avro.AvroSerializer
     LOCATION 'kafka://localhost:2181/brokers?topic=large_orders'
     TBLPROPERTIES '
     {
        "producer": {
                "bootstrap.servers": "localhost:9092",
                "acks": "1",
                "key.serializer": 
"org.apache.org.apache.storm.kafka.IntSerializer",
                "value.serializer": 
"org.apache.org.apache.storm.kafka.ByteBufferSerializer"
        },
        
        "input.avro.schema": "
    {\"type\": \"record\", 
     \"name\": \"large_orders\",
     \"fields\" : [
      {\"name\": \"id\", \"type\": \"int\"},
      {\"name\": \"total\", \"type\": \"int\"},
      {\"name\": \"timestamp\", \"type\": \"long\"}
     ]
    }
        ",
        
        "output.avro.schema": "
    {\"type\": \"record\", 
     \"name\": \"large_orders\",
     \"fields\" : [
      {\"name\": \"id\", \"type\": \"int\"},
      {\"name\": \"total\", \"type\": \"int\"}
     ]
    }
        "
    }'
    
    INSERT INTO LARGE_ORDERS
     SELECT ID, UNIT_PRICE * QUANTITY AS TOTAL FROM ORDERS WHERE UNIT_PRICE * 
QUANTITY > 50
    
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to