@Test public void testGetOutputTableUpsert() throws Exception { IndexColumnNames columnNames = new IndexColumnNames(pDataTable, pIndexTable); String outputTableUpsert = IndexScrutinyTableOutput.constructOutputTableUpsert( columnNames.getDynamicDataCols(), columnNames.getDynamicIndexCols(), conn); conn.prepareStatement(outputTableUpsert); assertEquals("UPSERT INTO PHOENIX_INDEX_SCRUTINY (\"SOURCE_TABLE\", \"TARGET_TABLE\", \"SCRUTINY_EXECUTE_TIME\", \"SOURCE_ROW_PK_HASH\", \"SOURCE_TS\", \"TARGET_TS\", \"HAS_TARGET_ROW\", \"ID\" INTEGER, \"PK_PART2\" TINYINT, \"NAME\" VARCHAR, \"ZIP\" BIGINT, \":ID\" INTEGER, \":PK_PART2\" TINYINT, \"0:NAME\" VARCHAR, \"0:ZIP\" BIGINT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", outputTableUpsert); }
public static String constructOutputTableUpsert(List<String> sourceDynamicCols, List<String> targetDynamicCols, Connection connection) throws SQLException { List<String> outputTableColumns = getOutputTableColumns(connection); List<String> upsertCols = Lists.newArrayList( Iterables.concat(outputTableColumns, sourceDynamicCols, targetDynamicCols)); String upsertStmt = QueryUtil.constructUpsertStatement(IndexScrutinyTableOutput.OUTPUT_TABLE_NAME, upsertCols, null); return upsertStmt; }
IndexScrutinyTableOutput { public static String constructOutputTableUpsert(List<String> sourceDynamicCols, List<String> targetDynamicCols, Connection connection) throws SQLException { List<String> outputTableColumns = getOutputTableColumns(connection); List<String> upsertCols = Lists.newArrayList( Iterables.concat(outputTableColumns, sourceDynamicCols, targetDynamicCols)); String upsertStmt = QueryUtil.constructUpsertStatement(IndexScrutinyTableOutput.OUTPUT_TABLE_NAME, upsertCols, null); return upsertStmt; } }
IndexScrutinyTableOutput { public static String constructOutputTableUpsert(List<String> sourceDynamicCols, List<String> targetDynamicCols, Connection connection) throws SQLException { List<String> outputTableColumns = getOutputTableColumns(connection); List<String> upsertCols = Lists.newArrayList( Iterables.concat(outputTableColumns, sourceDynamicCols, targetDynamicCols)); String upsertStmt = QueryUtil.constructUpsertStatement(IndexScrutinyTableOutput.OUTPUT_TABLE_NAME, upsertCols, null); return upsertStmt; }  }
IndexScrutinyTableOutput { public static String constructOutputTableUpsert(List<String> sourceDynamicCols, List<String> targetDynamicCols, Connection connection) throws SQLException { List<String> outputTableColumns = getOutputTableColumns(connection); List<String> upsertCols = Lists.newArrayList( Iterables.concat(outputTableColumns, sourceDynamicCols, targetDynamicCols)); String upsertStmt = QueryUtil.constructUpsertStatement(IndexScrutinyTableOutput.OUTPUT_TABLE_NAME, upsertCols, null); return upsertStmt; }  static String constructOutputTableUpsert(List<String> sourceDynamicCols,
            List<String> targetDynamicCols, Connection connection); static String getSqlQueryAllInvalidRows(Connection conn,
            SourceTargetColumnNames columnNames, long scrutinyTimeMillis); static String getSqlQueryMissingTargetRows(Connection conn,
            SourceTargetColumnNames columnNames, long scrutinyTimeMillis); static String getSqlQueryBadCoveredColVal(Connection conn,
            SourceTargetColumnNames columnNames, long scrutinyTimeMillis); static ResultSet queryMetadata(Connection conn, List<String> selectCols,
            String qSourceTableName, String qTargetTableName, long scrutinyTimeMillis); static ResultSet queryAllMetadata(Connection conn, String qSourceTableName,
            String qTargetTableName, long scrutinyTimeMillis); static void writeJobResults(Connection conn, String[] cmdLineArgs, List<Job> completedJobs); }
IndexScrutinyTableOutput { public static String constructOutputTableUpsert(List<String> sourceDynamicCols, List<String> targetDynamicCols, Connection connection) throws SQLException { List<String> outputTableColumns = getOutputTableColumns(connection); List<String> upsertCols = Lists.newArrayList( Iterables.concat(outputTableColumns, sourceDynamicCols, targetDynamicCols)); String upsertStmt = QueryUtil.constructUpsertStatement(IndexScrutinyTableOutput.OUTPUT_TABLE_NAME, upsertCols, null); return upsertStmt; }  static String constructOutputTableUpsert(List<String> sourceDynamicCols,
            List<String> targetDynamicCols, Connection connection); static String getSqlQueryAllInvalidRows(Connection conn,
            SourceTargetColumnNames columnNames, long scrutinyTimeMillis); static String getSqlQueryMissingTargetRows(Connection conn,
            SourceTargetColumnNames columnNames, long scrutinyTimeMillis); static String getSqlQueryBadCoveredColVal(Connection conn,
            SourceTargetColumnNames columnNames, long scrutinyTimeMillis); static ResultSet queryMetadata(Connection conn, List<String> selectCols,
            String qSourceTableName, String qTargetTableName, long scrutinyTimeMillis); static ResultSet queryAllMetadata(Connection conn, String qSourceTableName,
            String qTargetTableName, long scrutinyTimeMillis); static void writeJobResults(Connection conn, String[] cmdLineArgs, List<Job> completedJobs); static String OUTPUT_TABLE_NAME; static final String SCRUTINY_EXECUTE_TIME_COL_NAME; static final String TARGET_TABLE_COL_NAME; static final String SOURCE_TABLE_COL_NAME; static final String OUTPUT_TABLE_DDL; static final String OUTPUT_METADATA_TABLE_NAME; static final String OUTPUT_METADATA_DDL; static final String UPSERT_METADATA_SQL; }