@aemUser2345 ,
You have to modify your query a bit, 'componentGroup' is not a valid node type
Use the below query to get the valid nodes
SELECT 'componentGroup' FROM [cq:Component]
add a WHERE ISDESCENDANTNODE clause if you want to get component groups under a specific path
In your code then, you can get the value of 'componentGroup' property if required