class_docstr: This handler handles connection and execution of the Apache Pinot statements.
class_docstr_tok: ["This","handler","handles","connection","and","execution","of","the","Apache","Pinot","statements","."]
docstr: Receive raw query and act upon it somehow.
  Args:
      query (str): query in native format
  Returns:
      HandlerResponse
docstr_tok: ["Receive","raw","query","and","act","upon","it","somehow",".","Args",":","query","(","str",")",":","query","in","native","format","Returns",":","HandlerResponse"]
code: def native_query(self, query: str) -> StatusResponse:
      """
      Receive raw query and act upon it somehow.
      Args:
          query (str): query in native format
      Returns:
          HandlerResponse
      """
  
      need_to_close = self.is_connected is False
  
      connection = self.connect()
      cursor = connection.cursor()
  
      try:
          cursor.execute(query)
          result = cursor.fetchall()
          if result:
              response = Response(
                  RESPONSE_TYPE.TABLE,
                  data_frame=pd.DataFrame(
                      result, columns=[x[0] for x in cursor.description]
                  ),
              )
          else:
              connection.commit()
              response = Response(RESPONSE_TYPE.OK)
      except Exception as e:
          logger.error(f"Error running query: {query} on Pinot!")
          response = Response(RESPONSE_TYPE.ERROR, error_message=str(e))
  
      cursor.close()
      if need_to_close is True:
          self.disconnect()
  
      return response
  
imports: from typing import Optional
  from collections import OrderedDict
  import pandas
  import pinotdb
  import requests
  from requests.exceptions import InvalidSchema
  import json
  from mindsdb_sql import parse_sql
  from mindsdb_sql.render.sqlalchemy_render import SqlalchemyRender
  from mindsdb.integrations.libs.base import DatabaseHandler
  from pinotdb.sqlalchemy import PinotDialect
  from mindsdb_sql.parser.ast.base import ASTNode
  from mindsdb.utilities import log
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
label_desc: Use image node_id 6 for calling the PinotHandler obj's underlying member method code with example usage: obj.native_query(query) and returns: response