From d49f28292766907626eee3a63e296361dd257301 Mon Sep 17 00:00:00 2001 From: Tim Fox Date: Wed, 18 Sep 2019 14:19:24 +0100 Subject: [PATCH] fix:#3347 If the table has an key and a value for it has been provided in an insert then make sure rowkey gets the string form of it --- .../io/confluent/ksql/engine/InsertValuesExecutor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ksql-engine/src/main/java/io/confluent/ksql/engine/InsertValuesExecutor.java b/ksql-engine/src/main/java/io/confluent/ksql/engine/InsertValuesExecutor.java index 01ee6835ea47..b60727f9badb 100644 --- a/ksql-engine/src/main/java/io/confluent/ksql/engine/InsertValuesExecutor.java +++ b/ksql-engine/src/main/java/io/confluent/ksql/engine/InsertValuesExecutor.java @@ -323,8 +323,12 @@ private static void handleExplicitKeyField( final Object rowKeyValue = values.get(SchemaUtil.ROWKEY_NAME); if (keyValue != null ^ rowKeyValue != null) { - values.putIfAbsent(key, rowKeyValue); - values.putIfAbsent(SchemaUtil.ROWKEY_NAME, keyValue); + if (keyValue == null) { + values.putIfAbsent(key, rowKeyValue); + } else { + // Note, ROWKEY must always be a String + values.putIfAbsent(SchemaUtil.ROWKEY_NAME, keyValue.toString()); + } } else if (!Objects.equals(keyValue, rowKeyValue)) { throw new KsqlException( String.format(