Azure / Azure/azure-iot-sdk-csharp

[Bug Report] IoT Hub Query — GROUP BY Without Aggregate Does Not Deduplicate Rows

Open
#3,511 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
C#
Stars
477
Forks
492
Avg merge
9h 55m
Merged PRs (30d)
2

Description

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
1. Run the following query against an IoT Hub where multiple devices share the same tags.model value:
```sql
SELECT tags.model AS Model
FROM devices
GROUP BY tags.model
```
2. Note the number of rows returned.
3. Run the same query with an aggregate function added:
```sql
SELECT tags.model AS Model, count() AS Cnt
FROM devices
GROUP BY tags.model
```
4. Compare the row counts — the second query returns fewer, correct rows.

Contributor guide

Open the contributing guide

Research direction

The report concerns Azure IoT Hub's query service rather than a file in this C# SDK. Start by running the two supplied GROUP BY queries against an IoT Hub with repeated tags.model values and compare their row counts. Done would require an agreed service-side correction or documented workaround; no repository entry point or test is named.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, sql
Domain
cloud
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.