You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Istvan Toth (Jira)" <ji...@apache.org> on 2021/10/28 15:06:00 UTC

[jira] [Comment Edited] (PHOENIX-6583) in binary fields, if upsert with null, dont insert null, it insert 0 byte array

    [ https://issues.apache.org/jira/browse/PHOENIX-6583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17435482#comment-17435482 ] 

Istvan Toth edited comment on PHOENIX-6583 at 10/28/21, 3:05 PM:
-----------------------------------------------------------------

Fixes are very welcome.

See https://phoenix.apache.org/contributing.html

It's a bit outdated, don't bother with patch files, 

just open a pull request in github for the apache/phoenix project with the fix. The first line of the commit message should be the same as ticket number and summary.

i.e "PHOENIX-6583 in binary fields, if upsert with null, dont insert null, it insert 0 byte array"

Don't forget to add a test case for the fix, you can look at the existing tests for inspiration.


was (Author: stoty):
Fixes are very welcome.

You should also add a test case for the error.

See https://phoenix.apache.org/contributing.html

It's a bit outdated, don't bother with patch files, 

just open a pull request in github for the apache/phoenix project with the fix. The first line of the commit message should be the same as ticket number and summary.

i.e "PHOENIX-6583 in binary fields, if upsert with null, dont insert null, it insert 0 byte array"

Don't forget to add a test case for the fix, you can look at the existing tests for inspiration.

> in binary fields, if upsert with null, dont insert null, it insert 0 byte array
> -------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6583
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6583
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 5.1.2
>            Reporter: Alejandro Anadon
>            Priority: Critical
>
> In binary fields, if I use upsert with null value, it "insert" the field with 0x00 0x00 bytes vaules.
> Example:
> create table DUMMYTABLE (id integer not null, text varchar(255), testbin binary(16), CONSTRAINT pk primary key (id));
> 1)
> upsert into DUMMYTABLE (id,text) values (1,'null in testBinary');
> select id,text,LENGTH(TEXT),TESTBIN,OCTET_LENGTH(TESTBIN) from DUMMYTABLE;
> result--> TESTBIN => null, OCTET_LENGTH(TESTBIN) => null  . that's ok.
> 2)
> upsert into DUMMYTABLE (id,text,testbin) values (2,'IT DO NOT null in testBinary',null);
> select id,text,LENGTH(TEXT),TESTBIN,OCTET_LENGTH(TESTBIN) from DUMMYTABLE;
> result in seconf row-> TESTBIN => NOT NULL, OCTET_LENGTH(TESTBIN) => 16  . that's an error.
>  
> I verified it in hbase and actually reserves empty data (it should not):
> hbase(main):001:0> scan 'DUMMYTABLE'
> ROW COLUMN+CELL
>  \x80\x00\x00\x01 column=0:\x00\x00\x00\x00, timestamp=1635365632081, value=x
>  \x80\x00\x00\x01 column=0:\x80\x0B, timestamp=1635365632081, value=null in testBinary
>  \x80\x00\x00\x02 column=0:\x00\x00\x00\x00, timestamp=1635365696139, value=x
>  \x80\x00\x00\x02 column=0:\x80\x0B, timestamp=1635365696139, value=IT DO NOT null in testBinary
>  \x80\x00\x00\x02 column=0:\x80\x0C, timestamp=1635365696139, value=\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
> 2 row(s)
> Took 0.5030 seconds
>  
> And now, it is imposible to delete that files:
> upsert into DUMMYTABLE (id,testbin) values (2,null); 
> it does not removes the data.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)