aminghadersohi commented on code in PR #44703:
URL: https://github.com/apache/superset/pull/44703#discussion_r4120007668


##########
superset/db_engine_specs/elasticsearch.py:
##########
@@ -75,19 +82,19 @@ def _fetch_page_via_cursor(
         r"\s+LIMIT\s+\d+\s*$", "", sanitized_sql, flags=re.IGNORECASE
     )
 
-    # The raw transport does not auto-set Content-Type the way the Python
-    # DB-API driver does; ES rejects POSTs without a JSON content type.
-    json_headers = {"Content-Type": "application/json"}
+    request_kwargs: dict[str, Any] = {"headers": headers} if headers else {}
     with database.get_raw_connection() as conn:
         transport = conn.es.transport
         response = transport.perform_request(
             "POST",
             sql_path,
-            headers=json_headers,
             body={"query": sanitized_sql, "fetch_size": page_size},
+            **request_kwargs,
         )
-        columns = [col["name"] for col in response.get("columns", [])]
-        rows = response.get("rows", [])
+        columns = [
+            col.get("alias") or col["name"] for col in 
response.get(columns_key, [])
+        ]

Review Comment:
   Declining: both the Elasticsearch `columns` and OpenSearch JDBC `schema` 
entries always include `name`, and `col.get("name")` would only turn a 
malformed response into a silent `None` column label instead of a clear error.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to