Skip to content

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

@pregress

Description

@pregress

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions