# Key format: does not match any supported format when trying to repartition the data

**URL:** <https://forum.confluent.io/t/key-format-does-not-match-any-supported-format-when-trying-to-repartition-the-data/7860>\
**Category:** ksqlDB\
**Created:** [13 May 2023 19:42 UTC](https://forum.confluent.io/t/key-format-does-not-match-any-supported-format-when-trying-to-repartition-the-data/7860 "2023-05-13T19:42:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johannes](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Johannes](https://forum.confluent.io/u/Johannes)\
**Post date:** [13 May 2023 19:42 UTC](https://forum.confluent.io/t/key-format-does-not-match-any-supported-format-when-trying-to-repartition-the-data/7860/1 "2023-05-13T19:42:54Z")

</div>

```
I have a KSQL stream ip_locator that reads data from a Kafka topic locator and selects two fields (ip and uaid) from the geolocation and user nested structures, respectively. This stream works fine and emits AVRO-formatted.

```

```auto
ksql> print 'locator' FROM BEGINNING LIMIT 1;
        Key format: ¯\_(ツ)_/¯ - no data processed
        Value format: AVRO
        rowtime: 2022/04/4 11:13:33.131 Z, key: <null>, value: {"IP": "10.10.10.10", "UAID": "ff6204b2f1bf11eda05b0242ac120003"}, partition: 3
        Topic printing ceased

  

        CREATE STREAM ip_locator WITH(VALUE_FORMAT='AVRO',KEY_FORMAT='KAFKA',
       KAFKA_TOPIC='locator',PARTITIONS=4, REPLICAS=4) AS
                SELECT 
                	geolocation->ip as ip,
                	user->uaid as uaid
                FROM input
                EMIT CHANGES;

```

```
Now I want to create a new stream ip_key that uses the same data from ip_locator but sets the Kafka topic key as a composite structure with the ip and uaid fields. For this, I use the STRUCT function to build the key.

```

```auto
   CREATE STREAM ip_key
            WITH (FORMAT='AVRO', KAFKA_TOPIC='locator.key', PARTITIONS=4,REPLICAS=4) AS
            SELECT 
                STRUCT("ip":= ip, "uaid" := uaid) KEY,
                AS_VALUE(ip) as IP,
                AS_VALUE(uaid) as uaid,
            FROM ip_locator
  		    PARTITION BY STRUCT("ip":= ip, "uaid" := uaid)
            EMIT CHANGES;

```

```
However, when I try to print the Kafka topic locator.key that corresponds to the new stream, I get an error message saying that the key format is not recognized

```

```auto

            ksql> print 'locator.key' FROM BEGINNING LIMIT 3;
            Key format: does not match any supported format. It may be a STRING with encoding other than UTF8, or some other format.
            Value format: AVRO
            rowtime: 2022/04/4 11:13:33.131 Z, key: \x00\x00\x00\x00\x94\x02\x1C10.10.10.10\x02Pff6204b2f1bf11eda05b0242ac120003, value: {"IP": "10.10.10.10", "UAID": "ff6204b2f1bf11eda05b0242ac120003"}, partition: 3
            Topic printing ceased

```

```
Thank you for the help.

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [12 June 2023 19:43 UTC](https://forum.confluent.io/t/key-format-does-not-match-any-supported-format-when-trying-to-repartition-the-data/7860/2 "2023-06-12T19:43:29Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
