presto-hive/src/main/java/io/prestosql/plugin/hive/GenericHiveRecordCursor.java/GenericHiveRecordCursor/parseStringColumn
class GenericHiveRecordCursor:    private void parseStringColumn(int column)
    {
        loaded[column] = true;

        Object fieldData = rowInspector.getStructFieldData(rowData, structFields[column]);

        if (fieldData == null) {
            nulls[column] = true;
        }
        else {
            Object fieldValue = ((PrimitiveObjectInspector) fieldInspectors[column]).getPrimitiveWritableObject(fieldData);
            checkState(fieldValue != null, "fieldValue should not be null");
            BinaryComparable hiveValue;
            if (fieldValue instanceof Text) {
                hiveValue = (Text) fieldValue;
            }
            else if (fieldValue instanceof BytesWritable) {
                hiveValue = (BytesWritable) fieldValue;
            }
            else if (fieldValue instanceof HiveVarcharWritable) {
                hiveValue = ((HiveVarcharWritable) fieldValue).getTextValue();
            }
            else if (fieldValue instanceof HiveCharWritable) {
                hiveValue = ((HiveCharWritable) fieldValue).getTextValue();
            }
            else {
                throw new IllegalStateException("unsupported string field type: " + fieldValue.getClass().getName());
            }

            // create a slice view over the hive value and trim to character limits
            Slice value = Slices.wrappedBuffer(hiveValue.getBytes(), 0, hiveValue.getLength());
            Type type = types[column];
            if (isVarcharType(type)) {
                value = truncateToLength(value, type);
            }
            if (isCharType(type)) {
                value = truncateToLengthAndTrimSpaces(value, type);
            }

            // store a copy of the bytes, since the hive reader can reuse the underlying buffer
            slices[column] = Slices.copyOf(value);
            nulls[column] = false;
        }
    }