No really related to the c# sdk, but more related to the iothub service, and creating this for public visibility.
A GROUP BY query without an aggregate function returns more rows than the equivalent query that includes one (e.g. count()). The GROUP BY clause alone does not deduplicate rows as expected. Since DISTINCT is not supported in the IoT Hub query language, there is currently no clean workaround.
Steps to Reproduce
- Run the following query against an IoT Hub where multiple devices share the same tags.model value:
SELECT tags.model AS Model
FROM devices
GROUP BY tags.model
- Note the number of rows returned.
- Run the same query with an aggregate function added:
SELECT tags.model AS Model, count() AS Cnt
FROM devices
GROUP BY tags.model
- Compare the row counts — the second query returns fewer, correct rows.