@@ -313,50 +313,50 @@ private void AddMetadata(int i, ColumnMetadataInfo colMetaInfo)
313313 {
314314 if ( typeNames != null )
315315 {
316- MetadataUtils . MetadataGetter < VBuffer < DvText > > getter = ( int col , ref VBuffer < DvText > dst ) =>
316+ MetadataUtils . MetadataGetter < VBuffer < ReadOnlyMemory < char > > > getter = ( int col , ref VBuffer < ReadOnlyMemory < char > > dst ) =>
317317 {
318318 InputSchema . GetMetadata ( MetadataUtils . Kinds . KeyValues , srcCol , ref dst ) ;
319319 } ;
320- var info = new MetadataInfo < VBuffer < DvText > > ( typeNames , getter ) ;
320+ var info = new MetadataInfo < VBuffer < ReadOnlyMemory < char > > > ( typeNames , getter ) ;
321321 colMetaInfo . Add ( MetadataUtils . Kinds . SlotNames , info ) ;
322322 }
323323 }
324324 else
325325 {
326326 if ( typeNames != null && _types [ i ] . IsKnownSizeVector )
327327 {
328- MetadataUtils . MetadataGetter < VBuffer < DvText > > getter = ( int col , ref VBuffer < DvText > dst ) =>
328+ MetadataUtils . MetadataGetter < VBuffer < ReadOnlyMemory < char > > > getter = ( int col , ref VBuffer < ReadOnlyMemory < char > > dst ) =>
329329 {
330330 GetSlotNames ( i , ref dst ) ;
331331 } ;
332- var info = new MetadataInfo < VBuffer < DvText > > ( new VectorType ( TextType . Instance , _types [ i ] ) , getter ) ;
332+ var info = new MetadataInfo < VBuffer < ReadOnlyMemory < char > > > ( new VectorType ( TextType . Instance , _types [ i ] ) , getter ) ;
333333 colMetaInfo . Add ( MetadataUtils . Kinds . SlotNames , info ) ;
334334 }
335335 }
336336
337337 if ( ! _parent . _columns [ i ] . Bag && srcType . ValueCount > 0 )
338338 {
339- MetadataUtils . MetadataGetter < VBuffer < DvInt4 > > getter = ( int col , ref VBuffer < DvInt4 > dst ) =>
339+ MetadataUtils . MetadataGetter < VBuffer < int > > getter = ( int col , ref VBuffer < int > dst ) =>
340340 {
341341 GetCategoricalSlotRanges ( i , ref dst ) ;
342342 } ;
343- var info = new MetadataInfo < VBuffer < DvInt4 > > ( MetadataUtils . GetCategoricalType ( _infos [ i ] . TypeSrc . ValueCount ) , getter ) ;
343+ var info = new MetadataInfo < VBuffer < int > > ( MetadataUtils . GetCategoricalType ( _infos [ i ] . TypeSrc . ValueCount ) , getter ) ;
344344 colMetaInfo . Add ( MetadataUtils . Kinds . CategoricalSlotRanges , info ) ;
345345 }
346346
347347 if ( ! _parent . _columns [ i ] . Bag || srcType . ValueCount == 1 )
348348 {
349- MetadataUtils . MetadataGetter < DvBool > getter = ( int col , ref DvBool dst ) =>
349+ MetadataUtils . MetadataGetter < bool > getter = ( int col , ref bool dst ) =>
350350 {
351351 dst = true ;
352352 } ;
353- var info = new MetadataInfo < DvBool > ( BoolType . Instance , getter ) ;
353+ var info = new MetadataInfo < bool > ( BoolType . Instance , getter ) ;
354354 colMetaInfo . Add ( MetadataUtils . Kinds . IsNormalized , info ) ;
355355 }
356356 }
357357
358358 // Combines source key names and slot names to produce final slot names.
359- private void GetSlotNames ( int iinfo , ref VBuffer < DvText > dst )
359+ private void GetSlotNames ( int iinfo , ref VBuffer < ReadOnlyMemory < char > > dst )
360360 {
361361 Host . Assert ( 0 <= iinfo && iinfo < _infos . Length ) ;
362362 Host . Assert ( _types [ iinfo ] . IsKnownSizeVector ) ;
@@ -367,7 +367,7 @@ private void GetSlotNames(int iinfo, ref VBuffer<DvText> dst)
367367 Host . Assert ( typeSrc . VectorSize > 1 ) ;
368368
369369 // Get the source slot names, defaulting to empty text.
370- var namesSlotSrc = default ( VBuffer < DvText > ) ;
370+ var namesSlotSrc = default ( VBuffer < ReadOnlyMemory < char > > ) ;
371371 InputSchema . TryGetColumnIndex ( _infos [ iinfo ] . Source , out int srcCol ) ;
372372 Host . Assert ( srcCol >= 0 ) ;
373373 var typeSlotSrc = InputSchema . GetMetadataTypeOrNull ( MetadataUtils . Kinds . SlotNames , srcCol ) ;
@@ -377,31 +377,31 @@ private void GetSlotNames(int iinfo, ref VBuffer<DvText> dst)
377377 Host . Check ( namesSlotSrc . Length == typeSrc . VectorSize ) ;
378378 }
379379 else
380- namesSlotSrc = VBufferUtils . CreateEmpty < DvText > ( typeSrc . VectorSize ) ;
380+ namesSlotSrc = VBufferUtils . CreateEmpty < ReadOnlyMemory < char > > ( typeSrc . VectorSize ) ;
381381
382382 int keyCount = typeSrc . ItemType . ItemType . KeyCount ;
383383 int slotLim = _types [ iinfo ] . VectorSize ;
384384 Host . Assert ( slotLim == ( long ) typeSrc . VectorSize * keyCount ) ;
385385
386386 // Get the source key names, in an array (since we will use them multiple times).
387- var namesKeySrc = default ( VBuffer < DvText > ) ;
387+ var namesKeySrc = default ( VBuffer < ReadOnlyMemory < char > > ) ;
388388 InputSchema . GetMetadata ( MetadataUtils . Kinds . KeyValues , srcCol , ref namesKeySrc ) ;
389389 Host . Check ( namesKeySrc . Length == keyCount ) ;
390- var keys = new DvText [ keyCount ] ;
390+ var keys = new ReadOnlyMemory < char > [ keyCount ] ;
391391 namesKeySrc . CopyTo ( keys ) ;
392392
393393 var values = dst . Values ;
394394 if ( Utils . Size ( values ) < slotLim )
395- values = new DvText [ slotLim ] ;
395+ values = new ReadOnlyMemory < char > [ slotLim ] ;
396396
397397 var sb = new StringBuilder ( ) ;
398398 int slot = 0 ;
399399 foreach ( var kvpSlot in namesSlotSrc . Items ( all : true ) )
400400 {
401401 Contracts . Assert ( slot == ( long ) kvpSlot . Key * keyCount ) ;
402402 sb . Clear ( ) ;
403- if ( kvpSlot . Value . HasChars )
404- kvpSlot . Value . AddToStringBuilder ( sb ) ;
403+ if ( ! kvpSlot . Value . IsEmpty )
404+ ReadOnlyMemoryUtils . AddToStringBuilder ( kvpSlot . Value , sb ) ;
405405 else
406406 sb . Append ( '[' ) . Append ( kvpSlot . Key ) . Append ( ']' ) ;
407407 sb . Append ( '.' ) ;
@@ -410,24 +410,24 @@ private void GetSlotNames(int iinfo, ref VBuffer<DvText> dst)
410410 foreach ( var key in keys )
411411 {
412412 sb . Length = len ;
413- key . AddToStringBuilder ( sb ) ;
414- values [ slot ++ ] = new DvText ( sb . ToString ( ) ) ;
413+ ReadOnlyMemoryUtils . AddToStringBuilder ( key , sb ) ;
414+ values [ slot ++ ] = sb . ToString ( ) . AsMemory ( ) ;
415415 }
416416 }
417417 Host . Assert ( slot == slotLim ) ;
418418
419- dst = new VBuffer < DvText > ( slotLim , values , dst . Indices ) ;
419+ dst = new VBuffer < ReadOnlyMemory < char > > ( slotLim , values , dst . Indices ) ;
420420 }
421421
422- private void GetCategoricalSlotRanges ( int iinfo , ref VBuffer < DvInt4 > dst )
422+ private void GetCategoricalSlotRanges ( int iinfo , ref VBuffer < int > dst )
423423 {
424424 Host . Assert ( 0 <= iinfo && iinfo < _infos . Length ) ;
425425
426426 var info = _infos [ iinfo ] ;
427427
428428 Host . Assert ( info . TypeSrc . ValueCount > 0 ) ;
429429
430- DvInt4 [ ] ranges = new DvInt4 [ info . TypeSrc . ValueCount * 2 ] ;
430+ int [ ] ranges = new int [ info . TypeSrc . ValueCount * 2 ] ;
431431 int size = info . TypeSrc . ItemType . KeyCount ;
432432
433433 ranges [ 0 ] = 0 ;
@@ -438,7 +438,7 @@ private void GetCategoricalSlotRanges(int iinfo, ref VBuffer<DvInt4> dst)
438438 ranges [ i + 1 ] = ranges [ i ] + size - 1 ;
439439 }
440440
441- dst = new VBuffer < DvInt4 > ( ranges . Length , ranges ) ;
441+ dst = new VBuffer < int > ( ranges . Length , ranges ) ;
442442 }
443443
444444 protected override Delegate MakeGetter ( IRow input , int iinfo , out Action disposer )
@@ -834,7 +834,7 @@ public OutVectorColumn(Vector<Key<TKey>> input, bool bag)
834834 Input = input ;
835835 Bag = bag ;
836836 }
837-
837+
838838 public OutVectorColumn ( VarVector < Key < TKey > > input )
839839 : base ( Reconciler . Inst , input )
840840 {
0 commit comments