jpisaac commented on a change in pull request #766:
URL: https://github.com/apache/phoenix/pull/766#discussion_r413131190



##########
File path: 
phoenix-core/src/test/java/org/apache/phoenix/query/PhoenixTestBuilder.java
##########
@@ -212,66 +254,142 @@ private static String getFQColumnsAsString(List<String> 
columns, List<String> fa
 
         void setTargetEntity(String targetEntity);
 
+        // returns the columns that is set asthe pk/unique key for this data 
set,
+        List<String> getRowKeyColumns();
+
+        void setRowKeyColumns(List<String> rowKeyColumns);
+
         // return the data provider for this writer
         DataSupplier getTestDataSupplier();
 
-        // template method to upsert rows using the above info.
-        void upsertRow(int rowIndex) throws SQLException;
-
         void setDataSupplier(DataSupplier dataSupplier);
+
+        // template method to upsert a single row using the above info.
+        List<Object> upsertRow(int rowIndex) throws SQLException;
+
+        // template method to upsert a batch of rows using the above info.
+        void upsertRows(int numRows) throws SQLException;
+
+        // Get the data that was written as a Table
+        Table<String, String, Object> getDataTable();
     }
 
-    /**
-     * Test SchemaBuilder defaults.
-     */
-    public static class DDLDefaults {
-        public static final int MAX_ROWS = 10000;
-        public static List<String> TABLE_PK_TYPES = asList("CHAR(15)", 
"CHAR(3)");
-        public static List<String> GLOBAL_VIEW_PK_TYPES = asList("CHAR(15)");
-        public static List<String> TENANT_VIEW_PK_TYPES = asList("CHAR(15)");
+    // Provides template method for returning result set
+    public static abstract class AbstractDataReader implements DataReader {
+        Table<String, String, Object> dataTable = TreeBasedTable.create();
 
-        public static List<String> COLUMN_TYPES = asList("VARCHAR", "VARCHAR", 
"VARCHAR");
-        public static List<String> TABLE_COLUMNS = asList("COL1", "COL2", 
"COL3");
-        public static List<String> GLOBAL_VIEW_COLUMNS = asList("COL4", 
"COL5", "COL6");
-        public static List<String> TENANT_VIEW_COLUMNS = asList("COL7", 
"COL8", "COL9");
+        public Table<String, String, Object> getDataTable() {
+            return dataTable;
+        }
 
-        public static List<String> TABLE_COLUMN_FAMILIES = asList(null, null, 
null);
-        public static List<String> GLOBAL_VIEW_COLUMN_FAMILIES = asList(null, 
null, null);
-        public static List<String> TENANT_VIEW_COLUMN_FAMILIES = asList(null, 
null, null);
+        // Read batch of rows
+        public void readRows() throws SQLException {
+            dataTable.clear();
+            String sql = getDML();
+            Connection connection = getConnection();

Review comment:
       Since the connection object is set by user of this class (typically the 
tests cases), expect the caller to close the connection. Will add doc to that 
effect in the setConnection() setter method.




----------------------------------------------------------------
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]


Reply via email to