Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-2565 Store data for immutable tables in single KeyValue
  3. PHOENIX-3295

Remove ReplaceArrayColumnWithKeyValueColumnExpressionVisitor

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      ReplaceArrayColumnWithKeyValueColumnExpressionVisitor is only used in one place in IndexUtil.generateIndexData because we use a ValueGetter to get the value of the data table column using the original data table column reference. This is also why ArrayColumnExpression needs to keep track of the original key value column expression.
      If we don't replace the array column expression with the original column expression when it looks up the column by the qualifier it won't find it.

      ValueGetter valueGetter = new ValueGetter() {
                          	
                          	@Override
                              public byte[] getRowKey() {
                          		return dataMutation.getRow();
                          	}
              
                              @Override
                              public ImmutableBytesWritable getLatestValue(ColumnReference ref) {
                                  // Always return null for our empty key value, as this will cause the index
                                  // maintainer to always treat this Put as a new row.
                                  if (isEmptyKeyValue(table, ref)) {
                                      return null;
                                  }
                                  byte[] family = ref.getFamily();
                                  byte[] qualifier = ref.getQualifier();
                                  RowMutationState rowMutationState = valuesMap.get(ptr);
                                  PColumn column = null;
                                  try {
                                      column = table.getColumnFamily(family).getPColumnForColumnQualifier(qualifier);
                                  } catch (ColumnNotFoundException e) {
                                  } catch (ColumnFamilyNotFoundException e) {
                                  }
                                  if (rowMutationState!=null && column!=null) {
                                      byte[] value = rowMutationState.getColumnValues().get(column);
                                      ImmutableBytesPtr ptr = new ImmutableBytesPtr();
                                      ptr.set(value==null ? ByteUtil.EMPTY_BYTE_ARRAY : value);
                                      SchemaUtil.padData(table.getName().getString(), column, ptr);
                                      return ptr;
                                  }
                                  return null;
                              }
                              
                          };
      

      Attachments

        1. PHOENIX-3295.patch
          12 kB
          Thomas D'Silva
        2. PHOENIX-3295-v2.patch
          29 kB
          Thomas D'Silva
        3. PHOENIX-3295-v3.patch
          12 kB
          Thomas D'Silva

        Issue Links

          Activity

            People

              tdsilva Thomas D'Silva
              tdsilva Thomas D'Silva
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: