code: def get_hive_table(
      cursor, tableName, hive_database_name, user_partitions
  ):
      query = "use " + hive_database_name
      runHiveDDL(cursor, query)
      query = "describe formatted " + tableName
      result, description = runHiveQuery(cursor, query)
  
      schema = {}
      schema["columns"] = []
      schema["column_types"] = []
      i = 0
      parsingColumns = False
      parsingPartitionColumns = False
      startParsingPartitionRows = 0
      schema["delimiter"] = chr(1)
      for triple in result:
          if triple[0] is not None:
              if i == 2:
                  parsingColumns = True
              if parsingColumns:
                  if triple[0] == "":
                      parsingColumns = False
                  else:
                      schema["columns"].append(
                          (
                              triple[0],
                              convertTypeNameStrToCudfType(triple[1]),
                              False,
                          )
                      )
              elif isinstance(triple[0], str) and triple[0].startswith(
                  "Location:"
              ):
                  if triple[1].startswith("file:"):
                      schema["location"] = triple[1].replace(
                          "file:", ""
                      )
                  else:
                      schema["location"] = triple[1]
              elif isinstance(triple[0], str) and triple[0].startswith(
                  "InputFormat:"
              ):
                  if "TextInputFormat" in triple[1]:
                      #   schema['fileType'] = self.CSV_FILE_TYPE
                      schema["fileType"] = "csv"
                  if "ParquetInputFormat" in triple[1]:
                      #   schema['fileType'] = self.PARQUET_FILE_TYPE
                      schema["fileType"] = "parquet"
                  if "OrcInputFormat" in triple[1]:
                      #   schema['fileType'] = self.ORC_FILE_TYPE
                      schema["fileType"] = "orc"
                  if "JsonInputFormat" in triple[1]:
                      #   schema['fileType'] = self.JSON_FILE_TYPE
                      schema["fileType"] = "json"
              elif isinstance(triple[1], str) and triple[1].startswith(
                  "field.delim"
              ):
                  schema["delimiter"] = triple[2][0]
              elif triple[0] == "# Partition Information":
                  parsingPartitionColumns = True
                  startParsingPartitionRows = i + 2
              elif (
                  parsingPartitionColumns
                  and i > startParsingPartitionRows
              ):
                  if triple[0] == "# Detailed Table Information":
                      parsingPartitionColumns = False
                  elif triple[0] != "":
                      schema["columns"].append(
                          (
                              triple[0],
                              convertTypeNameStrToCudfType(triple[1]),
                              True,
                          )
                      )
          i = i + 1
  
      hasPartitions = False
      for column in schema["columns"]:
          if column[2]:
              hasPartitions = True
      file_list = []
      if hasPartitions:
          schema["partitions"] = getPartitions(
              tableName, schema, cursor
          )
  
          if user_partitions is not None:
              schema[
                  "partitions"
              ] = filterHivePartitionsWithUserPartitions(
                  schema["partitions"], user_partitions
              )
  
          file_list = getFolderListFromPartitions(
              schema["partitions"], schema["location"]
          )
      else:
          schema["partitions"] = {}
          file_list.append(schema["location"] + "/*")
  
      extra_kwargs = {}
      if schema["delimiter"] != chr(1):
          extra_kwargs["delimiter"] = schema["delimiter"]
      if schema["fileType"] == "csv":
          extra_kwargs["names"] = [
              col_name
              for col_name, dtype, is_virtual_col in schema["columns"]
              if not is_virtual_col
          ]
          extra_kwargs["dtype"] = [
              cudfTypeToCsvType[dtype]
              for col_name, dtype, is_virtual_col in schema["columns"]
              if not is_virtual_col
          ]
          # if the delimiter was not set and its infering its a csv file,
          # we may have a problem
          if schema["delimiter"] == chr(1):
              print(
                  "WARNING: Hive cursor is infering the file_format to be a csv,"
                  + " but no delimiter can be infered from the Hive cursor"
              )
  
      # schema['column_names'] and schema['column_types'] will be given to the
      # BlazingTable object. We want to use these instead of that gets returned
      # from _parseSchema because the files and the hive cursor may not agree
      # and we want to go off of the hive cursor
      schema["column_names"] = [
          col_n.encode()
          for col_n, dtype, is_virtual_col in schema["columns"]
      ]
      schema["column_types"] = [
          dtype for col_name, dtype, is_virtual_col in schema["columns"]
      ]
  
      extra_kwargs["file_format"] = schema["fileType"]
      extra_columns = []
      for column in schema["columns"]:
          if column[2]:
              extra_columns.append((column[0], column[1]))
  
      return (
          file_list,
          schema["fileType"],
          extra_kwargs,
          extra_columns,
          schema,
      )
  
file_path: blazingsql/pyblazing/pyblazing/apiv2/hive.py
imports: from itertools import repeat
  import cudf
  from TCLIService.ttypes import TOperationState
label_desc: Use image node_id 6 for calling a global function with example usage: get_hive_table(cursor, tableName, hive_database_name, user_partitions) and returns: file_list,  schema,  extra_kwargs,  extra_columns,  schema