ClickHouse / ClickHouse/clickhouse-java
In the JDBC query result set, columns of type AggregateFunction cannot be parsed normally
- Langage dominant
- Java
- Étoiles
- 1.6k
- Forks
- 636
- Merge moyen
- 2 j 23 h
- PR mergées (30 j)
- 29
Description
## Description
When creating a materialized view, specify the Select statement as follows:
```sql
SELECT
toDate(timestamp) AS date,
countState(*) AS count,
quantileState(0.9)(duration) AS tp90_duration_ms,
quantileState(0.99)(duration) AS tp99_duration_ms,
avgState(duration) AS avg_duration_ms,
maxState(duration) AS max_duration_ms,
minState(duration) AS min_duration_ms
FROM test.test_table_local
GROUP BY
date
```
This statement is queried directly with JDBC, and the final error is:
java.sql.SQLException: Failed to read value for column count
final debug result:
1. BinaryStreamReader.java -> readValue method
case AggregateFunction:
return (T)this.readBitmap(actualColumn);
2. readBitmap method
```java
private ClickHouseBitmap readBitmap(ClickHouseColumn column) throws IOException {
return ClickHouseBitmap.deserialize(this.input, ((ClickHouseColumn)column.getNestedColumns().get(0)).getDataType());
}
```
column.getNestedColumns() is empty
3.
### Error Log or Exception StackTrace
```
This statement is queried directly with JDBC, and the final error is:
java.sql.SQLException: Failed to read value for column count
```
### Expected Behaviour
### Code Example
```java
```
### Configuration
#### Client Configuration
```java
```
#### Environment
* [ ] Cloud
* Client version: 0.9.4
* Language version: 1.8
* OS: mac
#### ClickHouse Server
* ClickHouse Server version: 25.5.1
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par BinaryStreamReader.java, en particulier readValue et readBitmap, et reproduisez la requête de la vue matérialisée avec ClickHouse Java client 0.9.4 contre ClickHouse 25.5.1. Examinez pourquoi AggregateFunction n’a pas de colonnes imbriquées ; le travail est terminé lorsque JDBC peut lire les colonnes du résultat agrégé sans la SQLException.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java, sql
- Domaine
- database
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100