You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/12/03 23:17:54 UTC

[GitHub] [phoenix] gjacoby126 commented on a change in pull request #993: Phoenix 6219 GlobalIndexChecker doesn't work for SingleCell indexes

gjacoby126 commented on a change in pull request #993:
URL: https://github.com/apache/phoenix/pull/993#discussion_r535709164



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
##########
@@ -287,7 +301,7 @@ public void testBuildDisabledIndex() throws Exception {
             Table hIndexTable = conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(physicalTableNameOfIndex));
 
             stmt.execute(
-                    String.format("CREATE INDEX %s ON %s (UPPER(NAME, 'en_US')) ", indexName,
+                    String.format("CREATE INDEX %s ON %s (UPPER(NAME, 'en_US')) " + this.indexDDLOptions, indexName,

Review comment:
       ditto, String.format vs concatenation

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SingleCellIndexIT.java
##########
@@ -303,6 +303,37 @@ public void testTenantViewIndexes() throws Exception {
         }
     }
 
+    @Test
+    public void testUpsertSelect() throws Exception {
+        String tableName = generateUniqueName();
+        String idxName = "IDX_" + generateUniqueName();
+
+        try (Connection conn = DriverManager.getConnection(getUrl(), testProps)) {
+            conn.setAutoCommit(true);
+            createTableAndIndex(conn, tableName, idxName, null, true, 2);
+            assertMetadata(conn, ONE_CELL_PER_COLUMN, NON_ENCODED_QUALIFIERS, tableName);
+            assertMetadata(conn, SINGLE_CELL_ARRAY_WITH_OFFSETS, TWO_BYTE_QUALIFIERS, idxName);
+
+            // this delete will be issued at a timestamp later than the above timestamp of the index table
+            conn.createStatement().execute("delete from " + tableName + " where pk1 = 'PK1'");
+            conn.commit();
+            String
+                    sql =
+                    "UPSERT /*+ NO_INDEX */ INTO " + idxName + "(\":PK1\",\":INT_PK\",\"0:V1\",\"0:V2\",\"0:V4\")  SELECT /*+ NO_INDEX */ PK1,INT_PK, V1, V2,V4 FROM "

Review comment:
       Does a NO_INDEX hint in an upsert clause do anything?

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
##########
@@ -139,7 +153,7 @@ public void testMutableIndexWithUpdates() throws Exception {
             IndexToolIT.upsertRow(stmt1, id++);
             conn.commit();
             
-            stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC ", indexTableName,dataTableFullName));
+            stmt.execute(String.format("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX %s ON %s (UPPER(NAME, 'en_US')) ASYNC " + this.indexDDLOptions, indexTableName,dataTableFullName));

Review comment:
       nit: can use String.format parameter rather than concatenating indexDDLOptions

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SingleCellIndexIT.java
##########
@@ -303,6 +303,37 @@ public void testTenantViewIndexes() throws Exception {
         }
     }
 
+    @Test
+    public void testUpsertSelect() throws Exception {
+        String tableName = generateUniqueName();
+        String idxName = "IDX_" + generateUniqueName();
+
+        try (Connection conn = DriverManager.getConnection(getUrl(), testProps)) {
+            conn.setAutoCommit(true);
+            createTableAndIndex(conn, tableName, idxName, null, true, 2);
+            assertMetadata(conn, ONE_CELL_PER_COLUMN, NON_ENCODED_QUALIFIERS, tableName);
+            assertMetadata(conn, SINGLE_CELL_ARRAY_WITH_OFFSETS, TWO_BYTE_QUALIFIERS, idxName);
+
+            // this delete will be issued at a timestamp later than the above timestamp of the index table
+            conn.createStatement().execute("delete from " + tableName + " where pk1 = 'PK1'");
+            conn.commit();
+            String
+                    sql =
+                    "UPSERT /*+ NO_INDEX */ INTO " + idxName + "(\":PK1\",\":INT_PK\",\"0:V1\",\"0:V2\",\"0:V4\")  SELECT /*+ NO_INDEX */ PK1,INT_PK, V1, V2,V4 FROM "

Review comment:
       nit: overly long 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:
users@infra.apache.org