phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Belousov <sergey.belou...@gmail.com>
Subject Re: Problem with UNSIGNED_LONG ARRAY[] datatype.
Date Sat, 07 Mar 2015 13:46:00 GMT
Thank you Nick

I tried BIGINT (I guess that what you meant by (signed) long. I do not have
an error on upsert and here is what I got in HBase.

\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\ column=0:_0,
timestamp=1425734566865, value=

 x01\x80\x00\x00\x00\x00\x00\x00\x01\x80\x00\x


 00\x00\x00\x00\x00\x02

so values(1,1,ARRAY[1,2]); become (I added space for better read)

\x00\x00\x00\x01 \x00\x00\x00\x00\x00\x00\x00\x01\
x80\x00\x00\x00\x00\x00\x00\x01 \x80\x00\x00\x00\x00\x00\x00\x02

It almost what I need except thouse \x80. What are thouse some sort of
separators? Why do we need it here with fixed length types?
I am trying to model key that look almost like what I got but without \x80

I am not sure I can convert it explicitly either.

upsert into dev.t1 (f_int,f_long,f_array) values(1,1,ARRAY [CAST(1 AS
USINGNED_LONG),CAST( 2 AS UNSIGNED_LONG)]);
Error: ERROR 201 (22000): Illegal data. Unsupported sql type: USINGNED_LONG
(state=22000,code=201)

upsert into dev.t1 (f_int,f_long,f_array) values(1,1,CAST(ARRAY[1,2] AS
UNSIGNED_LONG ARRAY[]));
Syntax error. Unexpected input. Expecting "LPAREN", got "CAST" at line 1,
column 54. (state=42P00,code=603)

Thx

On Sat, Mar 7, 2015 at 1:55 AM, Nick Dimiduk <ndimiduk@gmail.com> wrote:

> It seems ARRAY[1,2] is not being implicitly cast to a unsigned long array.
> Can you try an explicit cast? What if you declare f_array as (signed) long
> array? Will have a look at code and get back to you.
>
> On Thursday, March 5, 2015, Sergey Belousov <sergey.belousov@gmail.com>
> wrote:
>
> > Hi all
> >
> > I keep banging my head against the wall and kind of out of ideas at this
> > point so I hope someone can give me little helping hand.
> > It safe to say that I am using almost 4.3 (build just before it released)
> >
> > Here is what I having problem with
> >
> > CREATE TABLE IF NOT EXISTS dev.t1
> > (
> >    f_int UNSIGNED_INT NOT NULL,
> >    f_long UNSIGNED_LONG NOT NULL,
> >    f_array UNSIGNED_LONG ARRAY[] NOT NULL,
> >
> > CONSTRAINT pk PRIMARY KEY (f_int, f_long, f_array)
> > );
> >
> > upsert into dev.t1 (f_int,f_long,f_array) values(1,1,ARRAY[1,2]);
> >
> > and getting
> >
> > Error: ERROR 203 (22005): Type mismatch. INTEGER ARRAY and UNSIGNED_LONG
> > ARRAY for expression:
> >
> org.apache.phoenix.schema.types.PhoenixArray$PrimitiveIntPhoenixArray@d32d5
> > in column F_ARRAY (state=22005,code=203)
> >
> > I tried ARRAY[2] and having same problem
> >
> > !describe dev.t1;
> >
> >
> +-------------------+--------------------+--------------------+---------------------+---------+
> > |      TABLE_CAT    |      TABLE_SCHEM   |       TABLE_NAME   |
> > COLUMN_NAME |         |
> >
> >
> +-------------------+--------------------+--------------------+---------------------+---------+
> > | null              | DEV                | T1                 | F_INT
> >         | 4       |
> > | null              | DEV                | T1                 | F_LONG
> >          | -5      |
> > | null              | DEV                | T1                 | F_ARRAY
> >         | 2003    |
> >
> >
> +-------------------+--------------------+--------------------+---------------------+---------+
> >
> > Any idea what I am doing wrong ?
> >
> > Thank you
> > S
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message