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 2021/09/07 07:24:30 UTC
[GitHub] [phoenix] stoty commented on a change in pull request #1287: PHOENIX-5072 Cursor Query Loops Eternally with Local Index, Returns F…
stoty commented on a change in pull request #1287:
URL: https://github.com/apache/phoenix/pull/1287#discussion_r703243027
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/CursorWithRowValueConstructorIT.java
##########
@@ -669,4 +672,94 @@ public void testCursorsWithColsOfTypesTinyintSmallintFloatDouble() throws Except
conn.close();
}
}
+
+ @Test
+ public void testCursorWithIndex() throws Exception {
+ Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+
+ Statement stmt = conn.createStatement();
+
+ stmt.execute("DROP TABLE IF EXISTS SOME_NUMBERS");
+ String createTable = "CREATE TABLE IF NOT EXISTS SOME_NUMBERS\n" +
+ "( \n" +
+ " ID VARCHAR NOT NULL,\n" +
+ " NAME VARCHAR ,\n" +
+ " ANOTHER_VALUE VARCHAR ,\n" +
+ " TRANSACTION_TIME TIMESTAMP ,\n" +
+ " CONSTRAINT pk PRIMARY KEY(ID)\n" +
+ ") " +
+ "IMMUTABLE_STORAGE_SCHEME=ONE_CELL_PER_COLUMN,\n" +
+ "UPDATE_CACHE_FREQUENCY=900000,\n" +
Review comment:
I believe that these options are not relevent.
It'd best to remove them for clarity.
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/CursorWithRowValueConstructorIT.java
##########
@@ -669,4 +672,94 @@ public void testCursorsWithColsOfTypesTinyintSmallintFloatDouble() throws Except
conn.close();
}
}
+
+ @Test
+ public void testCursorWithIndex() throws Exception {
+ Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+
+ Statement stmt = conn.createStatement();
+
+ stmt.execute("DROP TABLE IF EXISTS SOME_NUMBERS");
+ String createTable = "CREATE TABLE IF NOT EXISTS SOME_NUMBERS\n" +
+ "( \n" +
+ " ID VARCHAR NOT NULL,\n" +
+ " NAME VARCHAR ,\n" +
+ " ANOTHER_VALUE VARCHAR ,\n" +
+ " TRANSACTION_TIME TIMESTAMP ,\n" +
+ " CONSTRAINT pk PRIMARY KEY(ID)\n" +
+ ") " +
+ "IMMUTABLE_STORAGE_SCHEME=ONE_CELL_PER_COLUMN,\n" +
+ "UPDATE_CACHE_FREQUENCY=900000,\n" +
+ "COLUMN_ENCODED_BYTES=NONE,\n" +
+ "IMMUTABLE_ROWS=true";
+ stmt.execute(createTable);
+
+ //Creating an index
+ String createIndex = "CREATE LOCAL INDEX index_01 ON SOME_NUMBERS(NAME, TRANSACTION_TIME DESC) INCLUDE(ANOTHER_VALUE)";
Review comment:
Please don't hardcode the index name either.
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/CursorWithRowValueConstructorIT.java
##########
@@ -669,4 +672,94 @@ public void testCursorsWithColsOfTypesTinyintSmallintFloatDouble() throws Except
conn.close();
}
}
+
+ @Test
+ public void testCursorWithIndex() throws Exception {
+ Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+
+ Statement stmt = conn.createStatement();
+
+ stmt.execute("DROP TABLE IF EXISTS SOME_NUMBERS");
Review comment:
Please use the same table name generation that we use in the other tests.
It reduces the risk accidental table name clashes later, and is a bit faster.
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/DeclareCursorCompiler.java
##########
@@ -48,7 +48,13 @@
public DeclareCursorCompiler(PhoenixStatement statement, Operation operation, QueryPlan queryPlan) {
this.statement = statement;
this.operation = operation;
- this.queryPlan = queryPlan;
+ QueryPlan compilePlan = queryPlan;
+ try {
+ compilePlan = statement.getConnection().getQueryServices().getOptimizer().optimize(statement, queryPlan);
+ } catch (SQLException e) {
+ e.printStackTrace();
Review comment:
I'm pretty sure we shouldn't just swallow this exception
--
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