MF-1061 - Fix cassandra-reader count for json format (#1327)

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
This commit is contained in:
Manuel Imperiale 2021-01-13 10:23:05 +01:00 committed by GitHub
parent 8e5a9cfc9a
commit a8c652f96c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -50,13 +50,14 @@ func (cr cassandraRepository) ReadAll(chanID string, offset, limit uint64, query
value, string_value, bool_value, data_value, sum, time, value, string_value, bool_value, data_value, sum, time,
update_time FROM messages WHERE channel = ? %s LIMIT ? update_time FROM messages WHERE channel = ? %s LIMIT ?
ALLOW FILTERING`, q) ALLOW FILTERING`, q)
countCQL := fmt.Sprintf(`SELECT COUNT(*) FROM %s WHERE channel = ? %s ALLOW FILTERING`, defTable, q)
if table != defTable { if table != defTable {
selectCQL = fmt.Sprintf(`SELECT channel, subtopic, publisher, protocol, created, payload FROM %s WHERE channel = ? %s LIMIT ? selectCQL = fmt.Sprintf(`SELECT channel, subtopic, publisher, protocol, created, payload FROM %s WHERE channel = ? %s LIMIT ?
ALLOW FILTERING`, table, q) ALLOW FILTERING`, table, q)
countCQL = fmt.Sprintf(`SELECT COUNT(*) FROM %s WHERE channel = ? %s ALLOW FILTERING`, table, q)
} }
countCQL := fmt.Sprintf(`SELECT COUNT(*) FROM %s WHERE channel = ? %s ALLOW FILTERING`, defTable, q)
iter := cr.session.Query(selectCQL, vals...).Iter() iter := cr.session.Query(selectCQL, vals...).Iter()
defer iter.Close() defer iter.Close()
scanner := iter.Scanner() scanner := iter.Scanner()