XuMingmin commented on a change in pull request #1127: [CALCITE-2913] Adapter 
for Apache Kafka
URL: https://github.com/apache/calcite/pull/1127#discussion_r284358866
 
 

 ##########
 File path: site/_docs/kafka_adapter.md
 ##########
 @@ -0,0 +1,103 @@
+---
+layout: docs
+title: Kafka adapter
+permalink: /docs/kafka_adapter.html
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+  
+**Note**:
+
+KafkaAdapter is an experimental feature, changes in public API and usage are 
expected.
+
+For instructions on downloading and building Calcite, start with 
the[tutorial]({{ site.baseurl }}/docs/tutorial.html).
+
+The Kafka adapter exposes an Apache Kafka topic as a STREAM table, so it can 
be queried using
+[Calcite Stream SQL]({{ site.baseurl }}/docs/stream.html). Note that the 
adapter will not attempt to scan all topics,
+instead users need to configure tables manually, one Kafka stream table is 
mapping to one Kafka topic.
+
+A basic example of a model file is given below:
+
+{% highlight json %}
+{
+  "version": "1.0",
+  "defaultSchema": "KAFKA",
+  "schemas": [
+    {
+      "name": "KAFKA",
+      "tables": [
+        {
+          "name": "TABLE_NAME",
+          "type": "custom",
+          "factory": "org.apache.calcite.adapter.kafka.KafkaTableFactory",
+          "row.converter": "com.example.CustKafkaRowConverter",
+          "operand": {
+            "bootstrap.servers": "host1:port,host2:port",
+            "topic.name": "kafka.topic.name",
+            "consumer.params": {
+              "key.deserializer": 
"org.apache.kafka.common.serialization.ByteArrayDeserializer",
+              "value.deserializer": 
"org.apache.kafka.common.serialization.ByteArrayDeserializer"
+            }
+          }
+        }
+      ]
+    }
+  ]
+}
+{% endhighlight %}
+
+Note that:
+
+1. As Kafka message is schemaless, a [KafkaRowConverter]({{ site.apiRoot 
}}/org/apache/calcite/adapter/kafka/KafkaRowConverter.html)
+ is required to specify row schema explicitly(with parameter `row.converter`), 
and
+ how to decode Kafka message to Calcite row. [KafkaRowConverterImpl]({{ 
site.apiRoot }}/org/apache/calcite/adapter/kafka/KafkaRowConverterImpl.html)
+ is used if not provided;
+
+2. More consumer settings can be added in parameter `consumer.paras`;
 
 Review comment:
   yes, let me update it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to