Thanks everyone for checking my email.   

I encountered a problem. Let me explain the environment first: 


1. I built a Kafka cluster and created a topic of yzhoujsontp01 
2. I packaged and compiled Sqlline, and wrote a startup script 
(start_sqlline.bat) to add all the related dependency jars to the classpath. 
The script content is as follows:


```
@echo off
set LOG4J_CONFIG=file:D:\Code\Java\sqlline\cli\log4j2.xml
set JAVA_OPTS=-Xmx1g
set 
CP=D:\Code\Java\sqlline\cli\sqlline-1.13.0-SNAPSHOT-jar-with-dependencies.jar;D:\Code\Java\sqlline\cli\mysql-connector-j-8.0.33.jar;D:\Code\Java\sqlline\cli\calcite-kafka-1.38.0-SNAPSHOT.jar;D:\Code\Java\sqlline\cli\kafka-clients-3.5.2.jar;D:\Code\Java\sqlline\cli\calcite-core-1.38.0-SNAPSHOT.jar;D:\Code\Java\sqlline\cli\avatica-1.25.0.jar;D:\Code\Java\sqlline\cli\calcite-linq4j-1.38.0-SNAPSHOT.jar;D:\Code\Java\sqlline\cli\guava-32.1.3-jre.jar;D:\Code\Java\sqlline\cli\jackson-annotations-2.16.2.jar;D:\Code\Java\sqlline\cli\jackson-core-2.16.2.jar;D:\Code\Java\sqlline\cli\jackson-databind-2.16.2.jar;D:\Code\Java\sqlline\cli\jackson-dataformat-yaml-2.16.2.jar;D:\Code\Java\sqlline\cli\commons-codec-1.16.0.jar;D:\Code\Java\sqlline\cli\json-path-2.9.0.jar;D:\Code\Java\sqlline\cli\jts-core-1.19.0.jar;D:\Code\Java\sqlline\cli\janino-3.1.11.jar;D:\Code\Java\sqlline\cli\commons-compiler-3.1.11.jar;D:\Code\Java\sqlline\cli\commons-math3-3.6.1.jar;D:\Code\Java\sqlline\cli\commons-collections4-4.4.jar;D:\Code\Java\sqlline\cli\failureaccess-1.0.2.jar;D:\Code\Java\sqlline\cli\log4j-core-2.17.1.jar;D:\Code\Java\sqlline\cli\slf4j-api-1.7.25.jar;D:\Code\Java\sqlline\cli\log4j-api-2.17.1.jar;D:\Code\Java\sqlline\cli\log4j-slf4j-impl-2.17.1.jar

java %JAVA_OPTS% -cp "%CP%" sqlline.SqlLine
```



3. Write kafka.model.json 

```json
{
    "version": "1.0",
    "defaultSchema": "KAFKA",
    "schemas": [
      {
        "name": "KAFKA",
        "tables": [
          {
            "name": "yzhoujsontp01",
            "type": "custom",
            "factory": "org.apache.calcite.adapter.kafka.KafkaTableFactory",
            "operand": {
              "bootstrap.servers": "192.168.0.201:9092",
              "topic.name": "yzhoujsontp01",
              "consumer.params": {
                "group.id": "yzhougid2024062201",
                "row.converter": 
"org.apache.calcite.adapter.kafka.KafkaRowConverter"
              }
            }
          }
        ]
      }
    ]
}
```


4. I started to execute the following command: .\start_sqlline.bat 
Then execute !connect jdbc:calcite:model=kafka.model.json admin admin  


5. In the above steps, no blocking exceptions were found, but there were 
differences below, I executed the following two SQLs respectively, and after 
starting, used the kafka console producer script to send test data, and 2 
different results appeared 
1) SELECT STREAM * FROM "yzhoujsontp01" LIMIT 1; The result information can be 
displayed   

```
0: jdbc:calcite:model=kafka.model.json> SELECT STREAM * FROM "yzhoujsontp01" 
LIMIT 1;
+---------------+---------------+------------+---------------+-----------------+
| MSG_PARTITION | MSG_TIMESTAMP | MSG_OFFSET | MSG_KEY_BYTES | MSG_VALUE_BYTES |
+---------------+---------------+------------+---------------+-----------------+
| 0             | 1719119877526 | 98         |               | 14              |
+---------------+---------------+------------+---------------+-----------------+

```



2) SELECT STREAM * FROM "yzhoujsontp01"; No results have been displayed 

I have a good understanding of Kafka's mechanism and can determine the offset 
of the groupid before submitting, indicating that the data is being consumed, 
but it is not printed out.
I hope you can help me solve this problem. It has been bothering me for several 
hours.  Thank you

Reply via email to