phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Swaroopa Kadam (JIRA)" <j...@apache.org>
Subject [jira] [Created] (PHOENIX-5322) Upsert on a view with indexed table fails with ArrayIndexOutOfBound Exception
Date Fri, 07 Jun 2019 19:38:00 GMT
Swaroopa Kadam created PHOENIX-5322:
---------------------------------------

             Summary: Upsert on a view with indexed table fails with ArrayIndexOutOfBound
Exception
                 Key: PHOENIX-5322
                 URL: https://issues.apache.org/jira/browse/PHOENIX-5322
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.14.2
            Reporter: Swaroopa Kadam


{code:java}
// code placeholder
public void testUpstertOnViewWithIndexedTable() throws SQLException {

   Properties prop = new Properties();
   Connection conn = DriverManager.getConnection(getUrl(), prop);
   conn.setAutoCommit(true);
   conn.createStatement().execute("CREATE TABLE IF NOT EXISTS us_population (\n" +
         "      state CHAR(2) NOT NULL,\n" +
         "      city VARCHAR NOT NULL,\n" +
         "      population BIGINT,\n" +
         "      CONSTRAINT my_pk PRIMARY KEY (state, city)) COLUMN_ENCODED_BYTES=0");

   PreparedStatement ps = conn.prepareStatement("UPSERT INTO us_population VALUES('NY','New
York',8143197)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('CA','Los Angeles',3844829)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('IL','Chicago',2842518)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('TX','Houston',2016582)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('PA','Philadelphia',1463281)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('AZ','Phoenix',1461575)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('TX','San Antonio',1256509)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('CA','San Diego',1255540)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('TX','Dallas',1213825)");
   ps.executeUpdate();
   ps = conn.prepareStatement("UPSERT INTO us_population VALUES('CA','San Jose',912332)");
   ps.executeUpdate();

   conn.createStatement().execute("CREATE VIEW IF NOT EXISTS us_population_gv" +
         "(city_area INTEGER, avg_fam_size INTEGER) AS " +
         "SELECT * FROM us_population WHERE state = 'CA'");

   conn.createStatement().execute("CREATE INDEX IF NOT EXISTS us_population_gv_gi ON " +
         "us_population_gv (city_area) INCLUDE (population)");

   conn.createStatement().execute("CREATE INDEX IF NOT EXISTS us_population_gi ON " +
         "us_population (population)");
   ps = conn.prepareStatement("UPSERT INTO us_population_gv(state,city,population,city_area,avg_fam_size)
" +
            "VALUES('CA','Santa Barbara',912332,1300,4)");

   ps.executeUpdate();
}
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message