Create a Kafka table in the Kafka table editor to use a Kafka topic as a source or a
sink in your SQL jobs. You select the data source, the topic, and the format, without writing
DDL.
Register the Kafka cluster. For more information, see Adding a Kafka data
source.
In the Streaming SQL Console, click Projects in the left
navigation pane, and click the name of your project.
The project opens, with the Explorer panel on the left.
To open the Streaming SQL Console, see Accessing Cloudera SQL Stream Builder.
In the Explorer, open the menu of
Virtual Tables, and click New Kafka Table.
The New Kafka Table editor opens. The
Properties panel is on the left. The tabs are on the
right.
In Table Name, enter a name.
In Kafka Cluster, select the Kafka data source.
In Data Format, select JSON or
AVRO.
In Topic Name, select or enter the topic.
On the Schema Definition tab, define the schema.
For a topic with JSON messages, click Detect Schema to read
messages from the topic and fill in the schema. For more information, see Defining
the schema of a Kafka table.
Optional: Optional: Set the event time, the properties, and the
deserialization policy on the other tabs.
For more information, see Configuring Kafka tables.
Click Create.
The table is displayed under Virtual Tables.
Schema detection reads messages from the topic. It displays the following messages when it
cannot import a schema.
Table 1. Schema detection messages
Message
Meaning
Unable to detect schema, no messages in source topic.
The topic is empty. Produce messages, or define the schema by hand.
Unable to detect schema, no valid JSON messages found.
The messages are not JSON.
Unknown failure during schema detection.
Check the job logs. For more information, see Viewing
logs for Cloudera Streaming Analytics.
To stop a detection that is running, click Cancel.