Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-4535

Index in array data type is inconsistent.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.13.0, 5.0.0
    • None
    • None

    Description

      We allow using zero indexes for elements in array column and returns null by accident.
      A simple test case to reproduce:

              Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
              Connection conn = DriverManager.getConnection(getUrl(), props);
              conn.createStatement().execute("create table A(ID INTEGER PRIMARY KEY, array_id VARCHAR[])");
              conn.createStatement().execute("upsert into A values (1, ARRAY['test','test2','test3'])");
              conn.commit();
              ResultSet rs = conn.createStatement().executeQuery("select array_id[0], array_id[1] from A");
              while(rs.next()) {
                  System.out.println(rs.getString(1));
                  System.out.println(rs.getString(2));
      
              }
      

      The result for 4.x branches would be

      {null, 'test'}

      and it would fail with an exception for 5.x.

      Attachments

        Activity

          People

            Unassigned Unassigned
            romil.choksi Romil Choksi
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: