Ranganath Govardhanagiri created PHOENIX-7332:
-------------------------------------------------
Summary: Upsert Select with Array Projections with Autocommit set
to true fails
Key: PHOENIX-7332
URL: https://issues.apache.org/jira/browse/PHOENIX-7332
Project: Phoenix
Issue Type: Bug
Reporter: Ranganath Govardhanagiri
Fix For: 5.3.0
{code:java}
@Test
public void testServerArrayElementProjectionFailure() throws SQLException {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(true);
String table = generateUniqueName();
String ddl = "CREATE TABLE " + table + " (p INTEGER PRIMARY KEY, col1
INTEGER, arr1 INTEGER ARRAY, arr2 VARCHAR ARRAY)";
conn.createStatement().execute(ddl);
conn.close();
conn = DriverManager.getConnection(getUrl(), props);
PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + table + "
VALUES (1,0, ARRAY[1, 2], ARRAY['a', 'b'])");
stmt.execute();
conn.commit();
conn.close();
conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(true);
ResultSet rs;
stmt = conn.prepareStatement("UPSERT INTO " + table + "(p,col1) SELECT p,
arr1[1] FROM " + table);
stmt.execute();
}{code}
Executing the above IT will fail with the below error.
{code:java}
java.lang.IllegalArgumentException: No ExpressionType for class
org.apache.phoenix.compile.ProjectionCompiler$ArrayIndexExpression
at
org.apache.phoenix.expression.ExpressionType.valueOf(ExpressionType.java:226)
at
org.apache.phoenix.coprocessorclient.UngroupedAggregateRegionObserverHelper.serialize(UngroupedAggregateRegionObserverHelper.java:45)
at
org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:805)
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)