new PostIndexDDLCompiler(pConnection, new TableRef(pdataTable)); ddlCompiler.compile(pindexTable); final List<String> indexColumns = ddlCompiler.getIndexColumnNames(); final String selectQuery = ddlCompiler.getSelectQuery(); final String upsertQuery = QueryUtil.constructUpsertStatement(qIndexTable, indexColumns, Hint.NO_INDEX);
private MutationPlan getMutationPlanForBuildingIndex(PTable index, TableRef dataTableRef) throws SQLException { MutationPlan mutationPlan; if (index.getIndexType() == IndexType.LOCAL) { PostLocalIndexDDLCompiler compiler = new PostLocalIndexDDLCompiler(connection, getFullTableName(dataTableRef)); mutationPlan = compiler.compile(index); } else { PostIndexDDLCompiler compiler = new PostIndexDDLCompiler(connection, dataTableRef); mutationPlan = compiler.compile(index); } return mutationPlan; }
@Test public void testCompile() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { setupTables(conn); PhoenixConnection pConn = conn.unwrap(PhoenixConnection.class); PTable pDataTable = pConn.getTable(new PTableKey(null, "T")); PostIndexDDLCompiler compiler = new PostIndexDDLCompiler(pConn, new TableRef(pDataTable)); MutationPlan plan = compiler.compile(pConn.getTable(new PTableKey(null, "IDX"))); assertEquals("T", plan.getQueryPlan().getTableRef().getTable().getTableName().getString()); } }
new PostIndexDDLCompiler(pConnection, new TableRef(pdataTable)); ddlCompiler.compile(pindexTable); final List<String> indexColumns = ddlCompiler.getIndexColumnNames(); final String selectQuery = ddlCompiler.getSelectQuery(); final String upsertQuery = QueryUtil.constructUpsertStatement(qIndexTable, indexColumns, Hint.NO_INDEX);
private MutationPlan getMutationPlanForBuildingIndex(PTable index, TableRef dataTableRef) throws SQLException { MutationPlan mutationPlan; if (index.getIndexType() == IndexType.LOCAL) { PostLocalIndexDDLCompiler compiler = new PostLocalIndexDDLCompiler(connection, getFullTableName(dataTableRef)); mutationPlan = compiler.compile(index); } else { PostIndexDDLCompiler compiler = new PostIndexDDLCompiler(connection, dataTableRef); mutationPlan = compiler.compile(index); } return mutationPlan; }
new PostIndexDDLCompiler(pConnection, new TableRef(pdataTable)); ddlCompiler.compile(pindexTable); final List<String> indexColumns = ddlCompiler.getIndexColumnNames(); final String selectQuery = ddlCompiler.getSelectQuery(); final String upsertQuery = QueryUtil.constructUpsertStatement(qIndexTable, indexColumns, Hint.NO_INDEX);
private MutationPlan getMutationPlanForBuildingIndex(PTable index, TableRef dataTableRef) throws SQLException { MutationPlan mutationPlan; if (index.getIndexType() == IndexType.LOCAL) { PostLocalIndexDDLCompiler compiler = new PostLocalIndexDDLCompiler(connection, getFullTableName(dataTableRef)); mutationPlan = compiler.compile(index); } else { PostIndexDDLCompiler compiler = new PostIndexDDLCompiler(connection, dataTableRef); mutationPlan = compiler.compile(index); } return mutationPlan; }