[
https://issues.apache.org/jira/browse/PHOENIX-6583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17438516#comment-17438516
]
ASF GitHub Bot commented on PHOENIX-6583:
-----------------------------------------
stoty commented on a change in pull request #1342:
URL: https://github.com/apache/phoenix/pull/1342#discussion_r742576144
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/BinaryTypeIT.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+
+@Category(ParallelStatsDisabledTest.class)
+public class BinaryTypeIT extends ParallelStatsDisabledIT {
+
+ @Test
+ public void testBinaryNullAssignment() throws SQLException {
+ Properties props = new Properties();
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+
+ ResultSet rs;
+
+ try (Statement stmt = conn.createStatement()) {
+
+ String binTestTable=generateUniqueName();
+
+ stmt.execute("create table "+binTestTable+" (id integer not null,
text varchar(255), testbin binary(16), CONSTRAINT pk primary key (id))");
+ conn.commit();
+
+ String queryIsNull = "select id, text , testbin from
"+binTestTable+" where testbin is null";
+
+
+ // Let's see if without using it, it is stored as null
Review comment:
language: use "specifying" or "providing"
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/BinaryTypeIT.java
##########
@@ -0,0 +1,88 @@
+/*
Review comment:
This is a fairly minor test.
You should add it the existing NullIT test class (or some other appropriate
one) instead of creating a new class for it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
> 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)