You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Du Li <li...@yahoo-inc.com.INVALID> on 2014/09/24 01:55:43 UTC

SQL status code to indicate success or failure of query

Hi,

After executing sql() in SQLContext or HiveContext, is there a way to tell whether the query/command succeeded or failed? Method sql() returns SchemaRDD which either is empty or contains some Rows of results. However, some queries and commands do not return results by nature; being empty is not indicative of their status of execution. For example, if the command is to create/drop a table, how could I know if the table has really been created/dropped? If it fails, is there a status code or something I could check to tell the reasons for failure?

Thanks,
Du

Re: SQL status code to indicate success or failure of query

Posted by Michael Armbrust <mi...@databricks.com>.
An exception should be thrown in the case of failure for DDL commands.

On Tue, Sep 23, 2014 at 4:55 PM, Du Li <li...@yahoo-inc.com.invalid> wrote:

>   Hi,
>
>  After executing sql() in SQLContext or HiveContext, is there a way to
> tell whether the query/command succeeded or failed? Method sql() returns
> SchemaRDD which either is empty or contains some Rows of results. However,
> some queries and commands do not return results by nature; being empty is
> not indicative of their status of execution. For example, if the command is
> to create/drop a table, how could I know if the table has really been
> created/dropped? If it fails, is there a status code or something I could
> check to tell the reasons for failure?
>
>  Thanks,
> Du
>