gjacoby126 commented on a change in pull request #672: PHOENIX-5658 IndexTool 
to verify index rows inline
URL: https://github.com/apache/phoenix/pull/672#discussion_r365377349
 
 

 ##########
 File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
 ##########
 @@ -366,6 +371,140 @@ public void testBuildSecondaryIndexAndScrutinize() 
throws Exception {
         }
     }
 
+    private Cell getErrorMessageFromIndexToolOutputTable(Connection conn, 
String dataTableFullName, String indexTableFullName)
+            throws Exception {
+        byte[] indexTableFullNameBytes = Bytes.toBytes(indexTableFullName);
+        byte[] dataTableFullNameBytes = Bytes.toBytes(dataTableFullName);
+        Table hIndexTable = 
conn.unwrap(PhoenixConnection.class).getQueryServices()
+                .getTable(IndexTool.OUTPUT_TABLE_NAME_BYTES);
+        Scan scan = new Scan();
+        ResultScanner scanner = hIndexTable.getScanner(scan);
+        boolean dataTableNameCheck = false;
+        boolean indexTableNameCheck = false;
+        Cell errorMessageCell = null;
+        Result result = scanner.next();
+        if (result != null) {
+            for (Cell cell : result.rawCells()) {
+                assertTrue(Bytes.compareTo(cell.getFamilyArray(), 
cell.getFamilyOffset(), cell.getFamilyLength(),
+                        IndexTool.OUTPUT_TABLE_COLUMN_FAMILY, 0,
+                        IndexTool.OUTPUT_TABLE_COLUMN_FAMILY.length) == 0);
+                if (Bytes.compareTo(cell.getQualifierArray(), 
cell.getQualifierOffset(), cell.getQualifierLength(),
+                        IndexTool.DATA_TABLE_NAME_BYTES, 0, 
IndexTool.DATA_TABLE_NAME_BYTES.length) == 0) {
+                    dataTableNameCheck = true;
+                    assertTrue(Bytes.compareTo(cell.getValueArray(), 
cell.getValueOffset(), cell.getValueLength(),
+                            dataTableFullNameBytes, 0, 
dataTableFullNameBytes.length) == 0);
+                } else if (Bytes.compareTo(cell.getQualifierArray(), 
cell.getQualifierOffset(), cell.getQualifierLength(),
+                        IndexTool.INDEX_TABLE_NAME_BYTES, 0, 
IndexTool.INDEX_TABLE_NAME_BYTES.length) == 0) {
+                    indexTableNameCheck = true;
+                    assertTrue(Bytes.compareTo(cell.getValueArray(), 
cell.getValueOffset(), cell.getValueLength(),
+                            indexTableFullNameBytes, 0, 
indexTableFullNameBytes.length) == 0);
+                } else if (Bytes.compareTo(cell.getQualifierArray(), 
cell.getQualifierOffset(), cell.getQualifierLength(),
+                        IndexTool.ERROR_MESSAGE_BYTES, 0, 
IndexTool.ERROR_MESSAGE_BYTES.length) == 0) {
+                    errorMessageCell = cell;
+
 
 Review comment:
   nit: extra line

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to