Return-Path: X-Original-To: apmail-asterixdb-users-archive@minotaur.apache.org Delivered-To: apmail-asterixdb-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2DBBE18386 for ; Mon, 8 Jun 2015 18:35:13 +0000 (UTC) Received: (qmail 80583 invoked by uid 500); 8 Jun 2015 18:35:13 -0000 Delivered-To: apmail-asterixdb-users-archive@asterixdb.apache.org Received: (qmail 80556 invoked by uid 500); 8 Jun 2015 18:35:13 -0000 Mailing-List: contact users-help@asterixdb.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@asterixdb.incubator.apache.org Delivered-To: mailing list users@asterixdb.incubator.apache.org Received: (qmail 80537 invoked by uid 99); 8 Jun 2015 18:35:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jun 2015 18:35:12 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [209.85.216.49] (HELO mail-vn0-f49.google.com) (209.85.216.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jun 2015 18:32:58 +0000 Received: by vnbg7 with SMTP id g7so12887063vnb.10 for ; Mon, 08 Jun 2015 11:33:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=tD2RB7VHsoM99mLaYng8axXJRtrHhENApSoW9DNeXq8=; b=ZqG3XazoJvSJ0xHk9PKR2+sj+mF+Ray9oIRtYFyDQLEKsKiz/bmW1IW+CsKf56Uw5A wLhu+RHS3EBVl3e7SAKwWRdQ9WvvQ6tn3NS8yr5hkvoZGjyAqQ6AmnZX4H/iUPTWgMVd qvrWfofTmbMORmsBCvsmv0zpTGARF70bJsgaDKLviexFeBUIGQkqvg1bBUkR8R49yZrr taBBhlJ+lhPTJUb3DviS97vUUCXAue17iFTULlh9G5zbbEq2kZQ8eghJaXUoiqWkMi6V vBFbGlItMrw8SBsrpJt94mbpshzu0czA6GykhSPxTMEw6/jvxTi7RJbvZTyQUgZF2KPI j0Fw== X-Gm-Message-State: ALoCoQm/LnmDCQohVwUGKKgj7xagbrg62boZoI34i5hkg8vV2gzMKXG+aOVMZyx7/5l+i6wpNmkm X-Received: by 10.52.9.228 with SMTP id d4mr33548544vdb.57.1433788420664; Mon, 08 Jun 2015 11:33:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.5.133 with HTTP; Mon, 8 Jun 2015 11:33:20 -0700 (PDT) In-Reply-To: References: From: Ian Maxon Date: Mon, 8 Jun 2015 11:33:20 -0700 Message-ID: Subject: Re: REST API error code question for Invalid Statements (API docs nitpick) To: asterixdb-users@googlegroups.com Cc: users@asterixdb.incubator.apache.org Content-Type: multipart/alternative; boundary=20cf303635457f4366051805e1ec X-Virus-Checked: Checked by ClamAV on apache.org --20cf303635457f4366051805e1ec Content-Type: text/plain; charset=UTF-8 Hey Eugenia, Good catch. This is certainly a bug. Regarding the classification of exceptions,HyracksException and HyracksDataException are pretty broad. It can be anything from network to disk to "this shouldn't happen" type of exceptions. It would be interesting to see if that erroneous query had it's exception casted into something else along the way, or if it just threw an exception that wasn't anticipated as one that would be returned for a bad query. - Ian On Mon, Jun 8, 2015 at 12:44 AM, Eugenia Gabrielova < genia.likes.science@gmail.com> wrote: > Hello! This is a docs/code matchup nitpick question. > > *Question: *Reality or docs: which is correct error-code for Invalid > Statements submitted to AsterixDB REST API? Why aren't Algebricks and > Hyracks Exceptions documented in the REST API, though they have their own > error-codes? > > *Version: *0.8.7 Master > > *Proposed Solutions: *Add an error code for instances of > AsterixException, and/or update API docs to reflect actual behavior. > > *Details: *Working on some test cases for errors for the JS SDK. > According to the REST API docs ( > https://asterixdb.ics.uci.edu/documentation/api.html), a REST API call > with an Invalid Statement should return error-code 1. > > When I submit a query statement to the DDL endpoint, I observe error code > 99. > > *use dataverse test_company;* > *for $ds in dataset Metadata.Dataset return $ds;* > [*99*, > 'Invalid statement: Non-DDL statement QUERY to the DDL API. > [AsterixException]' ] > > *What I've tried so far: *I noticed in > *asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java* that > an Invalid Statement error-code 1 is not set, so the 99 code I am observing > makes sense. I also noticed that Algebricks and Hyracks exceptions are not > *210 public static void apiErrorHandler(PrintWriter out, Exception e) > {* > *211 int errorCode = 99;* > *212 if (e instanceof ParseException) {* > *213 errorCode = 2;* > *214 } else if (e instanceof AlgebricksException) {* > *215 errorCode = 3;* > *216 } else if (e instanceof HyracksDataException) {* > *217 errorCode = 4;* > *218 }* > > Thanks! > Eugenia > > -- > You received this message because you are subscribed to the Google Groups > "asterixdb-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to asterixdb-users+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > --20cf303635457f4366051805e1ec Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hey Eugenia,

Good catch. This is certai= nly a bug.=C2=A0
Regarding the classification of exceptions,Hyrac= ksException and HyracksDataException are pretty broad. It can be anything f= rom network to disk to "this shouldn't happen" type of except= ions.=C2=A0
It would be interesting to see if that erroneous quer= y had it's exception casted into something else along the way, or if it= just threw an exception that wasn't anticipated as one that would be r= eturned for a bad query.

- Ian

On Mon, Jun 8, 2015 at 12= :44 AM, Eugenia Gabrielova <genia.likes.science@gmail.com&= gt; wrote:
Hello!= This is a docs/code matchup nitpick question.

Questi= on: Reality or docs: which=C2=A0is correct error-code for Invalid State= ments submitted to AsterixDB REST API? Why aren't Algebricks and Hyrack= s Exceptions documented in the REST API, though they have their own error-c= odes?=C2=A0

Version: 0.8.7 Master

Proposed Solutions: Add an=C2=A0error code for insta= nces of AsterixException, and/or update API docs to reflect actual behavior= .

Details:=C2=A0Working on some test cases = for errors for the JS SDK. According to the REST API docs (https://= asterixdb.ics.uci.edu/documentation/api.html), a REST API call with an = Invalid Statement should return error-code 1.

= When I submit a query statement to the DDL endpoint, I observe error code 9= 9.

use dataverse test_company;
for $ds in dataset Metadata.Dataset return $ds;
<= div>=C2=A0[99,
=C2=A0 'Invalid statement: Non-DDL stat= ement QUERY to the DDL API. [AsterixException]' ]

<= /div>
What I've tried so far: I noticed in asterix-app/sr= c/main/java/edu/uci/ics/asterix/result/ResultUtils.java=C2=A0that an In= valid Statement error-code 1 is not set, so the 99 code I am observing make= s sense. I also noticed that Algebricks and Hyracks exceptions are not=C2= =A0
210 =C2=A0 =C2=A0 public static void apiErrorHandler(= PrintWriter out, Exception e) {
211 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 int errorCode =3D 99;
212 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 if (e instanceof ParseException) {
213 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 errorCode =3D 2;
214 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 } else if (e instanceof AlgebricksException) {
215 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 errorCode =3D 3;
216 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (e instanceof Hyra= cksDataException) {
217 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 errorCode =3D 4;
218 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }=

Thanks!
Eugenia

<= span class=3D"HOEnZb">

--
You received this message because you are subscribed to the Google Groups &= quot;asterixdb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to asterixdb-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--20cf303635457f4366051805e1ec--