Skip to content

Conversation

@aditya-gupta36
Copy link
Contributor

@aditya-gupta36 aditya-gupta36 commented Jan 21, 2026

What changes were proposed in this pull request?

Problem Description (Before Fix)

  1. GROUP BY works only for String attributes

Query:
Table groupby(owner)
Conclusion: Works

Query:
Table groupby(createTime)
Conclusion: Returns no records

Both owner (String) and createTime (Date/Long) attributes exist on the same hive_table entities.

  1. GROUP BY with SELECT fails for DATE attributes

Query:
Table groupby(createTime) select owner, name, max(createTime)
Conclusion: Returns no records

Similar query using a String attribute works as expected:
Table groupby(owner) select owner, count()
Conclusion: Works

  1. Root Cause
    GROUP BY keys were handled only for String data types
    When grouping by non-String attributes (Date/Long), valid group keys were dropped during result processing
    This resulted in empty results even though grouping succeeded internally

Fix Description (After Fix)

  1. Handle GROUP BY keys of any data type

Updated method:
AtlasJanusGraphTraversal.getAtlasVertexMap()

Logic change:
String keyStr = (key instanceof String) ? (String) key : String.valueOf(key);

This converts GROUP BY keys of type Long, Date, Integer, etc. into String. Prevents valid GROUP BY results from being dropped

  1. GROUP BY on DATE attributes now works correctly

Query:
Table groupby(createTime)
Conclusion: Returns grouped results

  1. DSL queries now behave as documented

The following queries now return valid results:
Table groupby(createTime) select owner, name, min(createTime)
Table groupby(createTime) select owner, name, max(createTime)

How was this patch tested?

. UI testing
. Local Build (jdk8/17)
. PC: https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/2029/
. CI workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant