The output key of mapper needs to be comparable. In the scenarios that we need the orc record itself
to be the output key, this conversion will be necessary.
773576
protected OrcKey convertOrcStructToOrcKey(OrcStruct struct) {
    OrcKey orcKey = new OrcKey();
    orcKey.key = struct;
    return orcKey;
  }
65165
private static void buildHashTableStrict(
            Block keyBlock,
            int keyOffset,
            int keyCount,
            MethodHandle keyBlockEquals,
            MethodHandle keyBlockHashCode,
            int[] outputHashTable,
            int hashTableOffset,
            int hashTableSize)
            throws DuplicateMapKeyException
    {
        for (int i = 0; i < keyCount; i++) {
            int hash = getHashPosition(keyBlock, keyOffset + i, keyBlockHashCode, hashTableSize);
            while (true) {
                if (outputHashTable[hashTableOffset + hash] == -1) {
                    outputHashTable[hashTableOffset + hash] = i;
                    break;
                }

                Boolean isDuplicateKey;
                try {
                    // assuming maps with indeterminate keys are not supported
                    isDuplicateKey = (Boolean) keyBlockEquals.invokeExact(keyBlock, keyOffset + i, keyBlock, keyOffset + outputHashTable[hashTableOffset + hash]);
                }
                catch (RuntimeException e) {
                    throw e;
                }
                catch (Throwable throwable) {
                    throw new RuntimeException(throwable);
                }

                if (isDuplicateKey == null) {
                    throw new PrestoException(NOT_SUPPORTED, "map key cannot be null or contain nulls");
                }

                if (isDuplicateKey) {
                    throw new DuplicateMapKeyException(keyBlock, keyOffset + i);
                }

                hash++;
                if (hash == hashTableSize) {
                    hash = 0;
                }
            }
        }
    }
1085630
def _convert_key(self, key, is_setter=False):
        
        for a, i in zip(self.obj.axes, key):
            if not is_integer(i):
                raise ValueError("iAt based indexing can only have integer "
                                 "indexers")
        return key
382795
@SuppressWarnings({"unchecked"})
  public void map(Object key, Object value, OutputCollector output,
                  Reporter reporter) throws IOException {
    Mapper mapper = chain.getFirstMap();
    if (mapper != null) {
      mapper.map(key, value, chain.getMapperCollector(0, output, reporter),
                 reporter);
    }
  }
775584
def validate(cls, mapper_spec):
    
    if mapper_spec.output_writer_class() != cls:
      raise errors.BadWriterParamsError("Output writer class mismatch")
    params = output_writers._get_params(mapper_spec)
    # Bucket Name is required
    if cls.BUCKET_NAME_PARAM not in params:
      raise errors.BadWriterParamsError(
          "%s is required for the _HashingGCSOutputWriter" %
          cls.BUCKET_NAME_PARAM)
1357274
private static <T> boolean anyKeyGeneratable(
        final DynamoDBMapperTableModel<T> model,
        final T object,
        final SaveBehavior saveBehavior
    ) {
        for (final DynamoDBMapperFieldModel<T, Object> field : model.keys()) {
            if (canGenerate(model, object, saveBehavior, field)) {
                return true;
            }
        }
        return false;
    }
1262206
def initial_key_to_master_key(initial_key):
    
    b = initial_key.encode("utf8")
    orig_input = b
    for i in range(100000):
        b = hashlib.sha256(b + orig_input).digest()
    return from_bytes_32(b)
33341
private boolean isConvertable(Mapping mapping) {
    if (mapping == null || mapping.getProvider() != null || !(mapping instanceof PropertyMapping))
      return false;

    PropertyMapping propertyMapping = (PropertyMapping) mapping;
    boolean hasSupportConverter = converterStore.getFirstSupported(
        propertyMapping.getLastSourceProperty().getType(),
        mapping.getLastDestinationProperty().getType()) != null;
    boolean hasSupportTypeMap = typeMapStore.get(
        propertyMapping.getLastSourceProperty().getType(),
        mapping.getLastDestinationProperty().getType(),
        null) != null;

    return hasSupportConverter || hasSupportTypeMap;
  }
293496
@Override
	public void putNormalizedKey(BigDecimal record, MemorySegment target, int offset, int len) {
		final long signum = record.signum();

		// order of magnitude
		// smallest:
		// scale = Integer.MAX, precision = 1 => SMALLEST_MAGNITUDE
		// largest:
		// scale = Integer.MIN, precision = Integer.MAX => LARGEST_MAGNITUDE
		final long mag = ((long) record.scale()) - ((long) record.precision()) + 1;

		// normalize value range: from 0 to (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE)
		final long normMag = -1L * LARGEST_MAGNITUDE + mag;

		// normalize value range dependent on sign:
		// 0 to (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE)
		// OR (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE) to 0
		// --> uses at most 33 bit (5 least-significant bytes)
		long signNormMag = signum < 0 ? normMag : (SMALLEST_MAGNITUDE + -1L * LARGEST_MAGNITUDE - normMag);

		// zero has no magnitude
		// set 34th bit to flag zero
		if (signum == 0) {
			signNormMag = 0L;
			signNormMag |= (1L << 34);
		}
		// set 35th bit to flag positive sign
		else if (signum > 0) {
			signNormMag |= (1L << 35);
		}

		// add 5 least-significant bytes that contain value to target
		for (int i = 0; i < 5 && len > 0; i++, len--) {
			final byte b = (byte) (signNormMag >>> (8 * (4 - i)));
			target.put(offset++, b);
		}
	}
349971
@Override
    public void map(GenericData.Record record,
                    AvroCollector<Pair<ByteBuffer, ByteBuffer>> collector,
                    Reporter reporter) throws IOException {

        byte[] keyBytes = null;
        byte[] valBytes = null;
        Object keyRecord = null;
        Object valRecord = null;
        try {
            keyRecord = record.get(keyField);
            valRecord = record.get(valField);
            keyBytes = keySerializer.toBytes(keyRecord);
            valBytes = valueSerializer.toBytes(valRecord);

            this.collectorWrapper.setCollector(collector);
            this.mapper.map(keyBytes, valBytes, this.collectorWrapper);

            recordCounter++;
        } catch (OutOfMemoryError oom) {
            logger.error(oomErrorMessage(reporter));
            if (keyBytes == null) {
                logger.error("keyRecord caused OOM!");
            } else {
                logger.error("keyRecord: " + keyRecord);
                logger.error("valRecord: " + (valBytes == null ? "caused OOM" : valRecord));
            }
            throw new VoldemortException(oomErrorMessage(reporter), oom);
        }
    }
1066035
def related_records2marc(self, key, value):
    
    if value.get('relation_freetext'):
        return {
            'i': value.get('relation_freetext'),
            'w': get_recid_from_ref(value.get('record')),
        }
    elif value.get('relation') == 'successor':
        self.setdefault('78502', []).append({
            'i': 'superseded by',
            'w': get_recid_from_ref(value.get('record')),
        })
    elif value.get('relation') == 'predecessor':
        self.setdefault('78002', []).append({
            'i': 'supersedes',
            'w': get_recid_from_ref(value.get('record')),
        })
    else:
        raise NotImplementedError(u"Unhandled relation in related_records: {}".format(value.get('relation')))
1157128
public <S, T> ToMarshaller<S, T> findMarshaller(ConverterKey<S,T> key) {

		Converter<S,T> converter = findConverter(key);
		
		if (converter == null) {
			return null;
		}
		
		if (ToMarshallerConverter.class.isAssignableFrom(converter.getClass())) {
			return ((ToMarshallerConverter<S, T>)converter).getMarshaller();
		} else {
			return new ConverterToMarshaller<S, T>(converter);
		}
	}
767911
def _init_map(self, record_types=None, **kwargs):
        """"""
        osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
        self._my_map['url'] = self._url_default
        self._my_map['data'] = self._data_default
        self._my_map['accessibilityTypeId'] = self._accessibility_type_default
        self._my_map['assignedRepositoryIds'] = [str(kwargs['repository_id'])]
        self._my_map['assetId'] = str(kwargs['asset_id'])
180425
def _convert_key(self, key, is_setter=False):
        

        # allow arbitrary setting
        if is_setter:
            return list(key)

        for ax, i in zip(self.obj.axes, key):
            if ax.is_integer():
                if not is_integer(i):
                    raise ValueError("At based indexing on an integer index "
                                     "can only have integer indexers")
            else:
                if is_integer(i) and not ax.holds_integer():
                    raise ValueError("At based indexing on an non-integer "
                                     "index can only have non-integer "
                                     "indexers")
        return key
1295133
def to_map
      map = alg.to_map(fields)
      if b64 == false or b64 == true
        map = map.put('b64', b64)
      end
      return map
    end
1184135
private static String mappingKey(Map<String, String> mapping, String fieldName) {
		if (MapUtil.isEmpty(mapping)) {
			return fieldName;
		}
		return ObjectUtil.defaultIfNull(mapping.get(fieldName), fieldName);
	}
1028545
public String getKeyType(UniqueKeyDefinition key){
        String tType;

        List<ColumnDefinition> keyColumns = key.getKeyColumns();

        if (keyColumns.size() == 1) {
            tType = getJavaType(keyColumns.get(0).getType());
        }
        else if (keyColumns.size() <= Constants.MAX_ROW_DEGREE) {
            String generics = "";
            String separator = "";

            for (ColumnDefinition column : keyColumns) {
                generics += separator + (getJavaType(column.getType()));
                separator = ", ";
            }

            tType = Record.class.getName() + keyColumns.size() + "<" + generics + ">";
        }
        else {
            tType = Record.class.getName();
        }

        return tType;
    }