Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHOENIX-6239: NullPointerException when index table does not use COLU… #994

Merged
merged 1 commit into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import java.util.Collection;
import java.util.Properties;

import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand All @@ -74,10 +73,10 @@ public class AlterAddCascadeIndexIT extends ParallelStatsDisabledIT {

public AlterAddCascadeIndexIT(boolean isViewIndex, boolean mutable) {
this.isViewIndex = isViewIndex;
StringBuilder optionBuilder = new StringBuilder();
StringBuilder optionBuilder = new StringBuilder("COLUMN_ENCODED_BYTES=0");
if (!mutable) {

optionBuilder.append(" IMMUTABLE_ROWS=true");
optionBuilder.append(", IMMUTABLE_ROWS=true, IMMUTABLE_STORAGE_SCHEME='ONE_CELL_PER_COLUMN'");
}
this.mutable = mutable;
this.tableDDLOptions = optionBuilder.toString();
Expand Down Expand Up @@ -160,7 +159,7 @@ public void testAlterDBOAddCascadeIndexAllUpsert() throws Exception {
assertNumberOfHBaseCells( "_IDX_"+fullTableName,6);
}
else {
assertNumberOfHBaseCells( "_IDX_"+fullTableName,4);
assertNumberOfHBaseCells( "_IDX_"+fullTableName,6);
}
} else {
assertDBODefinition(conn, phoenixObjectName, PTableType.TABLE, 4, columnArray, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4201,7 +4201,9 @@ private HashMap<PTable, PColumn> getPTablePColumnHashMapForCascade(List<PTable>
for (PTable index : indexesPTable) {
int iPos = indexToColumnSizeMap.get(index);
EncodedCQCounter cqCounterToUse = index.getEncodedCQCounter();
Integer encodedCQ = index.isAppendOnlySchema() ? Integer.valueOf(ENCODED_CQ_COUNTER_INITIAL_VALUE + iPos) : cqCounterToUse.getNextQualifier(familyName) + iPos;
int baseCount = 0;
baseCount = (cqCounterToUse != null && cqCounterToUse.getNextQualifier(familyName)!=null) ? cqCounterToUse.getNextQualifier(familyName) : 0 ;
Integer encodedCQ = index.isAppendOnlySchema() ? Integer.valueOf(ENCODED_CQ_COUNTER_INITIAL_VALUE + iPos) : baseCount + iPos;
byte[] columnQualifierBytes = EncodedColumnsUtil.getColumnQualifierBytes(indexColDef.getColumnDefName().getColumnName(), encodedCQ, index, indexColDef.isPK());
PColumn iColumn = newColumn(iPos, indexColDef, null, index.getDefaultFamilyName() == null ? null : index.getDefaultFamilyName().getString(), false, columnQualifierBytes, willBeImmutableRows);
indexColumn.put(index, iColumn);
Expand Down