Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
None
-
None
-
None
-
None
Description
After PHOENIX-3547 and PHOENIX-5104 querying after local index creation on the table having data is failing because of the view index id type mismatches.
The client is sending the SMALLINT as view index id data type.
private PDataType getViewIndexDataType() throws SQLException { boolean supportsLongViewIndexId = connection.getQueryServices().getProps().getBoolean( QueryServices.LONG_VIEW_INDEX_ENABLED_ATTRIB, QueryServicesOptions.DEFAULT_LONG_VIEW_INDEX_ENABLED); return supportsLongViewIndexId ? MetaDataUtil.getViewIndexIdDataType() : MetaDataUtil.getLegacyViewIndexIdDataType(); }
But in the create index api in endpoint impl is considering LONG as view index id data type.
PDataType dataType = MetaDataUtil.getViewIndexIdDataType(); Object val = dataType.toObject(seqValue, PLong.INSTANCE); byte[] bytes = new byte[dataType.getByteSize() + 1]; dataType.toBytes(val, bytes, 0); Cell indexIdCell = PhoenixKeyValueUtil.newKeyValue(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(), VIEW_INDEX_ID_BYTES, 0, VIEW_INDEX_ID_BYTES.length, cell.getTimestamp(), bytes, 0, bytes.length, cell.getType());
if (indexId != null) { builder.setViewIndexId(indexId); builder.setViewIndexIdType(PLong.INSTANCE.getSqlType()); }
Most of the local index tests failing If we set false value to the following configuration.
<property>
<!--
We have some hardcoded viewIndex ids in the IT tests which assumes viewIndexId is of type Long.
However the default viewIndexId type is set to "short" by default until we upgrade all clients to support
long viewIndex ids.
-->
<name>phoenix.index.longViewIndex.enabled</name>
<value>false</value>
</property>
Attachments
Attachments
Issue Links
- is duplicated by
-
PHOENIX-5559 Fix remaining issues with Long viewIndexIds
- Closed