diff --git a/kareldb-core/src/main/java/io/kareldb/schema/Table.java b/kareldb-core/src/main/java/io/kareldb/schema/Table.java index d13038b2..0f8a7336 100644 --- a/kareldb-core/src/main/java/io/kareldb/schema/Table.java +++ b/kareldb-core/src/main/java/io/kareldb/schema/Table.java @@ -359,9 +359,12 @@ private boolean update(Object o) { keyValue.right[inverseIndex - keySize] = (Comparable) colValue; } } - boolean replaced = cache.replace(oldKey, oldValue, keyValue.left, keyValue.right); - if (replaced) { - rowsAffected++; + boolean replaced = false; + if (!Arrays.equals(oldKey, keyValue.left) || !Arrays.equals(oldValue, keyValue.right)) { + replaced = cache.replace(oldKey, oldValue, keyValue.left, keyValue.right); + if (replaced) { + rowsAffected++; + } } return replaced; } diff --git a/kareldb-core/src/test/java/io/kareldb/jdbc/BaseJDBCTestCase.java b/kareldb-core/src/test/java/io/kareldb/jdbc/BaseJDBCTestCase.java index 14d41c14..66c7ac42 100644 --- a/kareldb-core/src/test/java/io/kareldb/jdbc/BaseJDBCTestCase.java +++ b/kareldb-core/src/test/java/io/kareldb/jdbc/BaseJDBCTestCase.java @@ -490,7 +490,8 @@ protected Properties createProperties() { "org.apache.calcite.sql.ddl.ExtensionDdlExecutor#PARSER_FACTORY"); properties.put("schema.kind", "io.kareldb.kafka.KafkaSchema"); properties.put("schema.kafkacache.bootstrap.servers", bootstrapServers); - properties.put("schema.rocksdb.enable", "true"); + // TODO reenable RocksDB for tests + properties.put("schema.rocksdb.enable", "false"); properties.put("schema.rocksdb.root.dir", tempDir.getAbsolutePath()); return properties; } diff --git a/kareldb-core/src/test/java/io/kareldb/jdbc/DateTimeTest.java b/kareldb-core/src/test/java/io/kareldb/jdbc/DateTimeTest.java index 466a0000..4cfe23c3 100644 --- a/kareldb-core/src/test/java/io/kareldb/jdbc/DateTimeTest.java +++ b/kareldb-core/src/test/java/io/kareldb/jdbc/DateTimeTest.java @@ -560,7 +560,7 @@ public void testRandom() throws SQLException { JDBC.assertFullResultSet(rs, new String[][]{{"3245-09-09", "1001-06-07", "1999-01-05"}}, true); - assertUpdateCount(st, 2, " update sertest set d=s"); + assertUpdateCount(st, 1, " update sertest set d=s"); // should get type errors: assertStatementError("42821", st, @@ -574,7 +574,19 @@ public void testRandom() throws SQLException { " insert into sertest values (null, null, " + "timestamp'1745-01-01 09:30:25')"); - assertUpdateCount(st, 2, "update sertest set d=o"); + rs = st.executeQuery(" select * from sertest"); + JDBC.assertColumnNames(rs, new String[]{"D", "S", "O"}); + JDBC.assertFullResultSet(rs, new String[][]{{"1001-06-07", + "1001-06-07", "1999-01-05"}, {"1992-01-03", + "1992-01-03", "1992-01-03"}}, true); + + assertUpdateCount(st, 1, "update sertest set d=o"); + + rs = st.executeQuery(" select * from sertest"); + JDBC.assertColumnNames(rs, new String[]{"D", "S", "O"}); + JDBC.assertFullResultSet(rs, new String[][]{{"1992-01-03", + "1992-01-03", "1992-01-03"}, {"1999-01-05", + "1001-06-07", "1999-01-05"}}, true); rs = st.executeQuery(" select * from sertest where s is null " + "and o is not null"); diff --git a/pom.xml b/pom.xml index 5e8b19d7..ee804d40 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ limitations under the License. 4.12 2.13 2.6.0 - 3.2.2 + 3.2.3 3.1.2 3.0.0-M3 1.10.0