How to find the distinct count of the below listed result from the table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 04:16 AM
Hi,
How to get the distinct count from the below listed image,
keywords = column name
table = appCatalog
keywords (column)
"[""data"",""cis"",""mining"",""financial"",""pso"",""value""]"
"[""bzo"",""employee news"",""news""]"
"[""core.store"",""fbi""]"
"[""data"",""display"",""support""]"
"[""bTravel"",""bTravel Expense"",""non-travel-related expenses"",""travel expenses""]"
For me output should be like, 17 as result. While counting the distinct values it should result 17.
keyword name called 'data' is occurring 2 times in the result as shown above Row 1 and Row 4.
How to achieve the result?
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 05:57 AM
Hi Kaniz,
Thank you for your reply and time.
I have tried the above query in the SQL Editor. I have to display the distinct count of the keywords from the table.
datatype is string. I have uploaded the csv file as a data for the Table. How to use the previous comment code in SQL Editor in Databricks.?
Query:
Error:
[DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE] Cannot resolve "explode(keywords)" due to data type mismatch: Parameter 1 requires the ("ARRAY" or "MAP") type, however "keywords" has the type "STRING"
Thank you.

