class_docstr: Reuses PrestoEngineSpec functionality.
class_docstr_tok: ["Reuses","PrestoEngineSpec","functionality","."]
code: def where_latest_partition(  # pylint: disable=too-many-arguments
      cls,
      table_name: str,
      schema: str | None,
      database: Database,
      query: Select,
      columns: list[ResultSetColumnType] | None = None,
  ) -> Select | None:
      try:
          col_names, values = cls.latest_partition(
              table_name, schema, database, show_first=True
          )
      except Exception:  # pylint: disable=broad-except
          # table is not partitioned
          return None
      if values is not None and columns is not None:
          for col_name, value in zip(col_names, values):
              for clm in columns:
                  if clm.get("name") == col_name:
                      query = query.where(Column(col_name) == value)
  
          return query
      return None
  
imports: from __future__ import annotations
  import logging
  import os
  import re
  import tempfile
  import time
  from datetime import datetime
  from typing import Any, TYPE_CHECKING
  from urllib import parse
  import numpy
  import pandas
  import pyarrow
  import pyarrow.parquet
  from flask import current_app, g
  from sqlalchemy import Column, text, types
  from sqlalchemy.engine.base import Engine
  from sqlalchemy.engine.reflection import Inspector
  from sqlalchemy.engine.url import URL
  from sqlalchemy.sql.expression import ColumnClause, Select
  from superset import db
  from superset.common.db_query_status import QueryStatus
  from superset.constants import TimeGrain
  from superset.databases.utils import make_url_safe
  from superset.db_engine_specs.base import BaseEngineSpec
  from superset.db_engine_specs.presto import PrestoEngineSpec
  from superset.exceptions import SupersetException
  from superset.extensions import cache_manager
  from superset.models.sql_lab import Query
  from superset.sql_parse import ParsedQuery, Table
  from superset.superset_typing import ResultSetColumnType
label_desc: Use image node_id 12 for calling the HiveEngineSpec obj's underlying member method code with example usage: obj.where_latest_partition(cls, table_name, schema, database, query, columns) and returns: None, query, None