Closed onlysumitg closed 1 month ago
Thanks for the note! I will see about writing a test case tomorrow to check. Nonetheless, since this is not really an issue as you mentioned, i will close this for now.
Finally, I was able to load the server.
"column_count": 4,
"data": [
{
"NAME": "SUMIT",
"DEPT": "D1",
"ADDR": "ADDRESS1"
}
],
{
"id": "query3",
"has_results": "True",
"update_count": -1,
"metadata": {
"column_count": 4,
"job": "***************************",
"columns": [
{
"name": "NAME",
"type": "CHAR",
"display_size": 10,
"label": "NAME"
},
{
"name": "DEPT",
"type": "CHAR",
"display_size": 10,
"label": "DEPT"
},
{
"name": "NAME",
"type": "CHAR",
"display_size": 10,
"label": "NAME"
},
{
"name": "ADDR",
"type": "CHAR",
"display_size": 10,
"label": "ADDR"
}
]
},
"data": [
{
"NAME": "SUMIT",
"DEPT": "D1",
"ADDR": "ADDRESS1"
}
],
"is_done": "True",
"success": "True"
}
Based on my previous experience with converting database result sets to JSON:
I encountered an issue where duplicate column names in the query would lead to the first column's value being overwritten by the second one in the final JSON output.
There are several scenarios where a query might produce duplicate column names, such as:
Self-joins Joins between tables that have columns with the same names Duplicate aliases etc
In the code snippet:
BlockRetrievableRequest.DataBlockFetchResult() ==> mapRowData.put(column, cellDataForResponse);
When duplicate column names are present, the second occurrence overwrites the value in the map from the first put operation.
I encountered this problem while building a JDBC-based SQL client. To resolve it, I prefixed the column names in the 'data' array with their index to ensure uniqueness. (And also included this prefixed value as part of the 'columns' array. So the client can map it)
This observation is based solely on reviewing the code, and I haven't tested it on a running instance of the Mapepire server. If this issue has already been fixed, that's great!
Here is a sample JSON produced using my code. `
`