[
https://issues.apache.org/jira/browse/PHOENIX-2925?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergey Soldatov updated PHOENIX-2925:
-------------------------------------
Attachment: PHOENIX-2925.patch
new implementation for column mapping - indexes doesn't depends on table name
now, the code for building column map is the same for mapper and reducer (later
need to move to a supporting class), empty record are kept as is.
Tested on different combinations similar to:
{noformat}
CREATE TABLE IF NOT EXISTS T1 (ID INTEGER PRIMARY KEY, I1 integer, i2 integer,
i3 integer, i4 integer);
CREATE INDEX I1 ON T1 (I1);
CREATE INDEX I11 ON T1 (I1) INCLUDE(I2,I3);
CREATE LOCAL INDEX L1 ON T1 (I2);
CREATE LOCAL INDEX L11 ON T1 (I2) INCLUDE(I3);
CREATE LOCAL INDEX L12 ON T1 (I2) INCLUDE(I3, I4);
CREATE LOCAL INDEX L2 ON T1 (I3);
CREATE LOCAL INDEX L3 ON T1 (i4);
CREATE LOCAL INDEX L21 ON T1 (i2,i3);
CREATE LOCAL INDEX L22 ON T1 (i2,i3) INCLUDE(i4);
CREATE LOCAL INDEX L31 ON T1 (i3,i4);
{noformat}
Tested on tables up to 500000 records.
> CsvBulkloadTool not working properly if there are multiple local indexes to
> the same table(After PHOENIX-1973)
> --------------------------------------------------------------------------------------------------------------
>
> Key: PHOENIX-2925
> URL: https://issues.apache.org/jira/browse/PHOENIX-2925
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.7.0
> Reporter: Rajeshbabu Chintaguntla
> Assignee: Rajeshbabu Chintaguntla
> Fix For: 4.8.0
>
> Attachments: PHOENIX-2925.patch, PHOENIX-2925.patch,
> PHOENIX-2925.patch, PHOENIX-2925_v2.patch
>
>
> When there are multiple local indexes then only for first index data is
> getting generated properly and other indexes doesn't have any data. Changing
> testImportWithLocalIndex test as below is failing. ping [~sergey.soldatov]?
> {noformat}
> @Test
> public void testImportWithLocalIndex() throws Exception {
> Statement stmt = conn.createStatement();
> stmt.execute("CREATE TABLE TABLE6 (ID INTEGER NOT NULL PRIMARY KEY, "
> +
> "FIRST_NAME VARCHAR, LAST_NAME VARCHAR) SPLIt ON (1,2)");
> String ddl = "CREATE LOCAL INDEX TABLE6_IDX ON TABLE6 "
> + " (FIRST_NAME ASC)";
> stmt.execute(ddl);
> ddl = "CREATE LOCAL INDEX TABLE6_IDX2 ON TABLE6 " + " (LAST_NAME
> ASC)";
> stmt.execute(ddl);
> FileSystem fs = FileSystem.get(getUtility().getConfiguration());
> FSDataOutputStream outputStream = fs.create(new
> Path("/tmp/input3.csv"));
> PrintWriter printWriter = new PrintWriter(outputStream);
> printWriter.println("1,FirstName 1,LastName 1");
> printWriter.println("2,FirstName 2,LastName 2");
> printWriter.close();
> CsvBulkLoadTool csvBulkLoadTool = new CsvBulkLoadTool();
> csvBulkLoadTool.setConf(getUtility().getConfiguration());
> int exitCode = csvBulkLoadTool.run(new String[] {
> "--input", "/tmp/input3.csv",
> "--table", "table6",
> "--zookeeper", zkQuorum});
> assertEquals(0, exitCode);
> ResultSet rs = stmt.executeQuery("SELECT id, FIRST_NAME FROM TABLE6
> where first_name='FirstName 2'");
> assertTrue(rs.next());
> assertEquals(2, rs.getInt(1));
> assertEquals("FirstName 2", rs.getString(2));
> rs = stmt.executeQuery("SELECT LAST_NAME FROM TABLE6 where
> last_name='LastName 1'");
> assertTrue(rs.next());
> assertEquals("LastName 1", rs.getString(1));
> rs.close();
> stmt.close();
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)