You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/11/02 19:42:00 UTC
[jira] [Commented] (PHOENIX-6583) Inserting explicit Null into a
(fixed length) binary field is stored as an array of zeroes
[ https://issues.apache.org/jira/browse/PHOENIX-6583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17437551#comment-17437551 ]
ASF GitHub Bot commented on PHOENIX-6583:
-----------------------------------------
alejandro-anadon opened a new pull request #1342:
URL: https://github.com/apache/phoenix/pull/1342
PHOENIX-6583 Inserting explicit Null into a (fixed length) binary field is stored as an array of zeroes
In the test BinaryTypeIT:
1) it create the table
2) it make a simple upsert without using the binary field and test if it is null.
3)it makes an upsert to the binary field but with a null value. Without the change, it stores a 0x00 array of bytes instead of a null.
4) it makes an upsert to the binary field but now with a value.
5)it makes an upsert to the binary field again with a null. Without the change, it does not remove the data and it is not a null value.
IMPORTANT: while I was doing the tests, I tried to pass all the test, but failed in the test "org.apache.phoenix.end2end.DefaultColumnValueIT.testDefaultAllDataTypesKeyValueCol" , but in my opinion the fail is regarding what I have explained it in JIRA PHOENIX-6585 report. This is the stack trace of the test:
[ERROR] Tests run: 24, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 230.567 s <<< FAILURE! - in org.apache.phoenix.end2end.DefaultColumnValueIT
[ERROR] org.apache.phoenix.end2end.DefaultColumnValueIT.testDefaultAllDataTypesKeyValueCol Time elapsed: 4.806 s <<< FAILURE!
arrays first differed at element [4]; expected:<0> but was:<2>
at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:78)
at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:28)
at org.junit.Assert.internalArrayEquals(Assert.java:534)
at org.junit.Assert.assertArrayEquals(Assert.java:343)
at org.junit.Assert.assertArrayEquals(Assert.java:354)
at org.apache.phoenix.end2end.DefaultColumnValueIT.testDefaultAllDataTypes(DefaultColumnValueIT.java:581)
at org.apache.phoenix.end2end.DefaultColumnValueIT.testDefaultAllDataTypesKeyValueCol(DefaultColumnValueIT.java:506)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
> Inserting explicit Null into a (fixed length) binary field is stored as an array of zeroes
> ------------------------------------------------------------------------------------------
>
> 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: Major
>
> 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)