function queryResultsCompleted(athenaClient, queryExecutionId) {
    const client = athenaClient;

    const queryParams = {
        QueryExecutionId: queryExecutionId
    };

    return new Promise(function(resolve, reject) {
        return client.getQueryExecution(queryParams, (err, data) => {
            if (err) {
                Logger.log(`Unexpected Error getting Athena Query Execution Status ${err}`);
                return reject(-1);
            }
            const state = data.QueryExecution.Status.State;
            let queryState = 0, queryStatus = '';
            switch (state) {
                case 'QUEUED':
                    queryState = 0;
                    queryStatus = 'Query is queued';
                    break;
                case 'RUNNING':
                    queryState = 0;
                    queryStatus = 'Query still executing';
                    break;
                case 'SUCCEEDED':
                    queryState = 1;
                    queryStatus = 'Query completed successfully';
                    break;
                case 'FAILED':
                    queryState = -1;
                    queryStatus = data.QueryExecution.Status.StateChangeReason;
                    break;
                case 'CANCELLED':
                    queryState = -1;
                    queryStatus = 'Query was cancelled';
                    break;
                default:
                    queryState = -1;
                    queryStatus = 'Unknown error executing the query';
                    break;
            }

            const rst = {
                queryState,
                queryStatus
            };
            return resolve(rst);
        });
    });
}
The following method will check to see if the query results
have completed.  It will return -1 if the query errored, 0
if it is still executing or 1 if it has completed
@param {object} athenaClient  - Object created using create athena client
@param {string} queryExecutionId - AWS Query Execution Id
@returns {int} -1 : Error, 0 : Still running, 1 : Completed