Skip to content

Query fails on selecting column Map(IPv4, Float32) #1731

@yurifedoseev

Description

@yurifedoseev

Observed

  1. Create a table with a column Map(IPv4, Float32)
  2. Insert any data to this table
  3. Query select * from table
  4. Receive an error clickhouse: unsupported column type "Map(IPv4, Float32)"

Expected behaviour

No error on querying the data similar for usage ofMap(UInt32, Float32)
The same issue with using Map(IPv6, ...)

Please, replace CH credentials for your own instance

Code example

package main

import (
	"context"
	"crypto/tls"
	"fmt"
	"log"
	"time"

	"github.com/ClickHouse/clickhouse-go/v2"
)

const (
	clickHouseAddr     = "127.0.0.1"             // replace with your endpoint
	clickHouseUsername = "default"         // replace with your username
	clickHousePassword = "<your_password>"   // replace with your password
	clickHouseDatabase = "default"
)

func main() {
	if err := run(); err != nil {
		log.Fatalf("error: %v", err)
	}
}

func run() error {
	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()

	conn, err := clickhouse.Open(&clickhouse.Options{
		Addr: []string{clickHouseAddr},
		Auth: clickhouse.Auth{
			Database: clickHouseDatabase,
			Username: clickHouseUsername,
			Password: clickHousePassword,
		},
		TLS: &tls.Config{
			InsecureSkipVerify: true,
		},
		Debug: true,
	})
	if err != nil {
		return fmt.Errorf("connect: %w", err)
	}

	if err := conn.Ping(ctx); err != nil {
		return fmt.Errorf("ping: %w", err)
	}

	runQuery := func(query string) error {
		if err := conn.Exec(ctx, query); err != nil {
			return fmt.Errorf("exec failed (%s): %w", query, err)
		}
		return nil
	}

	if err := runQuery("DROP TABLE IF EXISTS test_table"); err != nil {
		return err
	}

	createTable := `
CREATE TABLE IF NOT EXISTS test_table (
	c0 UInt32,
	ipMap Map(IPv4, Float32)
) ENGINE = MergeTree
PRIMARY KEY c0
`
	if err := runQuery(createTable); err != nil {
		return err
	}

	insertRandom := `
INSERT INTO test_table
SELECT *
FROM generateRandom()
LIMIT 5
`
	if err := runQuery(insertRandom); err != nil {
		return err
	}

	rows, err := conn.Query(ctx, "SELECT * FROM test_table LIMIT 1")
	if err != nil {
		return fmt.Errorf("query rows: %w", err)
	}
	defer rows.Close()

	for rows.Next() {
		// reading the rows without Scan
	}

	if err := rows.Err(); err != nil {
		return fmt.Errorf("rows err: %w", err)
	}
	return nil
}

Error log

[clickhouse][3.133.198.69:9440][id=1][handshake] ->  0.0.0
[clickhouse][3.133.198.69:9440][id=1][handshake] <- ClickHouse (clickhouse-cloud) server version 25.12.1 revision 54483 (timezone UTC)
[clickhouse][3.133.198.69:9440][id=1][acquired new]
[clickhouse][3.133.198.69:9440][id=1][ping]
[clickhouse][3.133.198.69:9440][id=1][ping] -> ping
[clickhouse][3.133.198.69:9440][id=1][ping] <- pong
[clickhouse][3.133.198.69:9440][id=1][released]
[clickhouse][3.133.198.69:9440][id=1][acquired from pool]
[clickhouse][3.133.198.69:9440][id=1][exec] "DROP TABLE IF EXISTS test_table"
[clickhouse][3.133.198.69:9440][id=1][send query] compression="none" DROP TABLE IF EXISTS test_table
[clickhouse][3.133.198.69:9440][id=1][send data] compression="none"
[clickhouse][3.133.198.69:9440][id=1][end of stream]
[clickhouse][3.133.198.69:9440][id=1][released]
[clickhouse][3.133.198.69:9440][id=1][acquired from pool]
[clickhouse][3.133.198.69:9440][id=1][exec] "
CREATE TABLE IF NOT EXISTS test_table (
	c0 UInt32,
	ipMap Map(IPv4, Float32)
) ENGINE = MergeTree
PRIMARY KEY c0
"
[clickhouse][3.133.198.69:9440][id=1][send query] compression="none"
CREATE TABLE IF NOT EXISTS test_table (
	c0 UInt32,
	ipMap Map(IPv4, Float32)
) ENGINE = MergeTree
PRIMARY KEY c0
[clickhouse][3.133.198.69:9440][id=1][send data] compression="none"
[clickhouse][3.133.198.69:9440][id=1][end of stream]
[clickhouse][3.133.198.69:9440][id=1][released]
[clickhouse][3.133.198.69:9440][id=1][acquired from pool]
[clickhouse][3.133.198.69:9440][id=1][exec] "
INSERT INTO test_table
SELECT *
FROM generateRandom()
LIMIT 5
"
[clickhouse][3.133.198.69:9440][id=1][send query] compression="none"
INSERT INTO test_table
SELECT *
FROM generateRandom()
LIMIT 5
[clickhouse][3.133.198.69:9440][id=1][send data] compression="none"
[clickhouse][3.133.198.69:9440][id=1][progress] rows=5, bytes=132, total rows=5, wrote rows=5 wrote bytes=132 elapsed=62.706356ms
[clickhouse][3.133.198.69:9440][id=1][progress] rows=5, bytes=132, total rows=5, wrote rows=5 wrote bytes=132 elapsed=62.706356ms
[clickhouse][3.133.198.69:9440][id=1][read data] compression="none". block: columns=6, rows=96
[clickhouse][3.133.198.69:9440][id=1][profile events] rows=96
[clickhouse][3.133.198.69:9440][id=1][profile events] skipping scan
[clickhouse][3.133.198.69:9440][id=1][end of stream]
[clickhouse][3.133.198.69:9440][id=1][released]
[clickhouse][3.133.198.69:9440][id=1][acquired from pool]
[clickhouse][3.133.198.69:9440][id=1][query] "SELECT * FROM test_table LIMIT 1"
[clickhouse][3.133.198.69:9440][id=1][send query] compression="none" SELECT * FROM test_table LIMIT 1
[clickhouse][3.133.198.69:9440][id=1][send data] compression="none"
[clickhouse][3.133.198.69:9440][id=1][read data] decode error: clickhouse: unsupported column type "Map(IPv4, Float32)"
[clickhouse][3.133.198.69:9440][id=1][query] first block error: clickhouse: unsupported column type "Map(IPv4, Float32)"
[clickhouse][3.133.198.69:9440][id=1][released with error]
[clickhouse][3.133.198.69:9440][id=1][close: error] clickhouse: unsupported column type "Map(IPv4, Float32)"
2025/12/09 12:32:04 error: query rows: clickhouse: unsupported column type "Map(IPv4, Float32)"

Details

Environment

  • clickhouse-go version: v2.41.0
  • Interface: ClickHouse API
  • Go version: 1.25.3 (similar to 1.24.7)
  • Operating system: macos Tahoe 26.1
  • ClickHouse version: 25.12.1.668
  • Is it a ClickHouse Cloud?
  • ClickHouse Server non-default settings, if any:
  • CREATE TABLE statements for tables involved: CREATE TABLE IF NOT EXISTS test_table ( c0 UInt32, ipMap Map(IPv4, Float32) ) ENGINE = MergeTree PRIMARY KEY c0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions