You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@asterixdb.apache.org by Magnus Kongshem <ko...@online.ntnu.no> on 2016/03/16 10:14:40 UTC

Unusable asterix instance and setting unique primary key

Hey,

Im testing AsterixDB for my master thesis and I have some issues.

First, all of the sudden, my asterix instance became unusable. I have tried
to delete it to create a new one, but I am not allowed. How do one solve
this?

Second, I have a data set with no unique primary key. I understood on Heri,
one of the developers, that there is an option for generating a unique
primary key, but I can't find it anywhere in the documentation. Can someone
point me in the right direction?

Last, I am using the REST API to access the instance and perform queries on
it. But I am having issues with the url string encoder. When I write a
query and try to encode it to UTF-8 I get a different url string than what
is accepted by Asterix. Example below:

This is an example query I want to perform:
"query=use dataverse bigd;count(for $l in dataset('posdata') return $l);"

This is the query when UTF-8 encoded:
"query%3Duse+dataverse+bigd%3Bcount%28for+%24l+in+dataset%28%27posdata%27%29+return+%24l%29%3B"

This is what AsterixDB accepts:
"query=use%20dataverse%20bigd;count(for%20$l%20in%20dataset(%27posdata%27)%20return%20$l);"

Why is there a difference between what AsterixDB accepts and the standard
UTF-8 encoding? I'm using java and URLEncoder to encode the URL.

URLEncoder.encode(query, "UTF-8")

Thanks in advance

-- 

Mvh

Magnus Alderslyst Kongshem
+47 415 65 906

Re: Unusable asterix instance and setting unique primary key

Posted by "Mehul Jain, IDD M Tech, Computer Sci. & Engg., IIT (BHU) Varanasi" <me...@iitbhu.ac.in>.
this link may help :
http://stackoverflow.com/questions/2793150/using-java-net-urlconnection-to-fire-and-handle-http-requests
On Mar 16, 2016 6:09 PM, "Wail Alkowaileet" <wa...@gmail.com> wrote:

> Answers inlined.
>
>
>
> On Wed, Mar 16, 2016 at 12:14 PM, Magnus Kongshem <kongshem@online.ntnu.no
> > wrote:
>
>> Hey,
>>
>> Im testing AsterixDB for my master thesis and I have some issues.
>>
>> First, all of the sudden, my asterix instance became unusable. I have
>> tried to delete it to create a new one, but I am not allowed. How do one
>> solve this?
>>
>> This can be a misleading message. If your queries work, you shouldn't be
> worry about it.
>
>
>> Second, I have a data set with no unique primary key. I understood on
>> Heri, one of the developers, that there is an option for generating a
>> unique primary key, but I can't find it anywhere in the documentation. Can
>> someone point me in the right direction?
>>
>> create type eleType as closed{
> b: int32,
> c: int32
> }
> create type jsonType as open{
> id: uuid,
> a: [eleType]
> }
>
> create dataset json(jsonType)
> primary key id *autogenerated*;
>
>
>
>> Last, I am using the REST API to access the instance and perform queries
>> on it. But I am having issues with the url string encoder. When I write a
>> query and try to encode it to UTF-8 I get a different url string than what
>> is accepted by Asterix. Example below:
>>
>> This is an example query I want to perform:
>> "query=use dataverse bigd;count(for $l in dataset('posdata') return $l);"
>>
>> This is the query when UTF-8 encoded:
>>
>> "query%3Duse+dataverse+bigd%3Bcount%28for+%24l+in+dataset%28%27posdata%27%29+return+%24l%29%3B"
>>
>> This is what AsterixDB accepts:
>>
>> "query=use%20dataverse%20bigd;count(for%20$l%20in%20dataset(%27posdata%27)%20return%20$l);"
>>
>> Why is there a difference between what AsterixDB accepts and the standard
>> UTF-8 encoding? I'm using java and URLEncoder to encode the URL.
>>
>> URLEncoder.encode(query, "UTF-8")
>>
>> Maybe someone else better explains this .. But I would suggest using
> Apache HttpComponents: https://hc.apache.org/ .
>
>> Thanks in advance
>>
>> --
>>
>> Mvh
>>
>> Magnus Alderslyst Kongshem
>> +47 415 65 906
>>
>
>
>
> --
>
> *Regards,*
> Wail Alkowaileet
>

Re: Unusable asterix instance and setting unique primary key

Posted by Wail Alkowaileet <wa...@gmail.com>.
Answers inlined.



On Wed, Mar 16, 2016 at 12:14 PM, Magnus Kongshem <ko...@online.ntnu.no>
wrote:

> Hey,
>
> Im testing AsterixDB for my master thesis and I have some issues.
>
> First, all of the sudden, my asterix instance became unusable. I have
> tried to delete it to create a new one, but I am not allowed. How do one
> solve this?
>
> This can be a misleading message. If your queries work, you shouldn't be
worry about it.


> Second, I have a data set with no unique primary key. I understood on
> Heri, one of the developers, that there is an option for generating a
> unique primary key, but I can't find it anywhere in the documentation. Can
> someone point me in the right direction?
>
> create type eleType as closed{
b: int32,
c: int32
}
create type jsonType as open{
id: uuid,
a: [eleType]
}

create dataset json(jsonType)
primary key id *autogenerated*;



> Last, I am using the REST API to access the instance and perform queries
> on it. But I am having issues with the url string encoder. When I write a
> query and try to encode it to UTF-8 I get a different url string than what
> is accepted by Asterix. Example below:
>
> This is an example query I want to perform:
> "query=use dataverse bigd;count(for $l in dataset('posdata') return $l);"
>
> This is the query when UTF-8 encoded:
>
> "query%3Duse+dataverse+bigd%3Bcount%28for+%24l+in+dataset%28%27posdata%27%29+return+%24l%29%3B"
>
> This is what AsterixDB accepts:
>
> "query=use%20dataverse%20bigd;count(for%20$l%20in%20dataset(%27posdata%27)%20return%20$l);"
>
> Why is there a difference between what AsterixDB accepts and the standard
> UTF-8 encoding? I'm using java and URLEncoder to encode the URL.
>
> URLEncoder.encode(query, "UTF-8")
>
> Maybe someone else better explains this .. But I would suggest using
Apache HttpComponents: https://hc.apache.org/ .

> Thanks in advance
>
> --
>
> Mvh
>
> Magnus Alderslyst Kongshem
> +47 415 65 906
>



-- 

*Regards,*
Wail Alkowaileet