def METHOD_NAME(self, query):
    from vdk.plugin.trino import lineage_utils
    import sqlparse
    statement = sqlparse.parse(query)[0]
    if statement.get_type() == "ALTER":
        rename_table_lineage = lineage_utils.get_rename_table_lineage_from_query(
            query, self._schema, self._catalog
        )
        if rename_table_lineage:
            log.debug("Collecting lineage for rename table operation ...")
            return rename_table_lineage
        else:
            log.debug(
                "ALTER operation not a RENAME TABLE operation. No lineage will be collected."
            )
    elif statement.get_type() == "SELECT" or statement.get_type() == "INSERT":
        if lineage_utils.is_heartbeat_query(query):
            return None
        log.debug("Collecting lineage for SELECT/INSERT query ...")
        try:
            with closing_noexcept_on_close(self._cursor()) as cur:
                cur.execute(f"EXPLAIN (TYPE IO, FORMAT JSON) {query}")
                result = cur.fetchall()
                if result:
                    return lineage_utils.get_lineage_data_from_io_explain(
                        query, result[0][0]
                    )
        except Exception as e:
            log.info(
                f"Failed to get query io details for telemetry: {e}. Will continue with query execution"
            )
            return None
    else:
        log.debug(
            "Unsupported query type for lineage collection. Will not collect lineage."
        )
        return None
    return None