@Override
    public Map<K, V> loadAll(Collection<K> keys) {
        awaitSuccessfulInit();

        Object[] keysArray = keys.toArray();

        String sql = queries.loadAll(keys.size());
        try (SqlResult queryResult = sqlService.execute(sql, keysArray)) {
            Iterator<SqlRow> it = queryResult.iterator();

            Map<K, V> result = new HashMap<>();

            while (it.hasNext()) {
                SqlRow sqlRow = it.next();
                // If there is a single column as the value, return that column as the value
                if (queryResult.getRowMetadata().getColumnCount() == 2 && genericMapStoreProperties.singleColumnAsValue) {
                    K id = sqlRow.getObject(genericMapStoreProperties.idColumn);
                    result.put(id, sqlRow.getObject(1));
                } else {
                    K id = sqlRow.getObject(genericMapStoreProperties.idColumn);
                    //noinspection unchecked
                    V record = (V) toGenericRecord(sqlRow, genericMapStoreProperties);
                    result.put(id, record);
                }
            }
            return result;
        }
    }
@Test
    public void givenRowDoesNotExist_whenLoadAll_thenReturnEmptyMap() {
        objectProvider.createObject(mapName, false);
        mapLoader = createMapLoader();

        Map<Integer, GenericRecord> records = mapLoader.loadAll(newArrayList(0));
        assertThat(records).isEmpty();
    }