@@ -24,6 +24,7 @@ import {
2424  Int32 , 
2525  Int8 , 
2626  tableToIPC , 
27+   Struct , 
2728}  from  'apache-arrow' ; 
2829import  {  Scatterplot  }  from  './scatterplot' ; 
2930import  {  wrapArrowTable  }  from  './wrap_arrow' ; 
@@ -34,6 +35,8 @@ import type {
3435  IdSelectParams , 
3536}  from  './selection' ; 
3637import  {  DataSelection  }  from  './selection' ; 
38+ import  {  Some ,  TupleMap  }  from  './utilityFunctions' ; 
39+ import  {  getNestedVector  }  from  './regl_rendering' ; 
3740
3841type  TransformationStatus  =  'queued'  |  'in progress'  |  'complete'  |  'failed' ; 
3942
@@ -70,7 +73,8 @@ export class Deeptable {
7073    ...defaultTransformations , 
7174  } ; 
7275  public  _plot : Scatterplot  |  null ; 
73-   private  extents : Record < string ,  [ number ,  number ]  |  [ Date ,  Date ] >  =  { } ; 
76+   private  extents : TupleMap < string ,  [ number ,  number ]  |  [ Date ,  Date ] >  = 
77+     new  TupleMap ( ) ; 
7478  // A 3d identifier for the tile. Usually [z, x, y] 
7579  private  _extent ?: Rectangle ; 
7680  public  _ix_seed  =  0 ; 
@@ -134,6 +138,9 @@ export class Deeptable {
134138    this . root_tile  =  new  Tile ( defaultManifest ,  null ,  this ) ; 
135139    const  preProcessRootTile  =  this . root_tile . preprocessRootTileInfo ( ) ; 
136140
141+     // At instantiation, the deeptable isn't ready; only once this 
142+     // async stuff is done can the deeptable be used. 
143+     // TODO: Add an async static method as the preferred initialization method. 
137144    this . promise  =  preProcessRootTile . then ( async  ( )  =>  { 
138145      const  batch  =  await  this . root_tile . get_arrow ( null ) ; 
139146      const  schema  =  batch . schema ; 
@@ -341,13 +348,24 @@ export class Deeptable {
341348
342349  domain < T  extends  [ number ,  number ]  |  [ string ,  Date ]  =  [ number ,  number ] > ( 
343350    columnName : string , 
351+     subfield ?: string [ ] , 
344352  ) : [ T [ 1 ] ,  T [ 1 ] ]  { 
345-     if  ( this . extents [ columnName ] )  { 
346-       return  this . extents [ columnName ] ; 
353+     const  key  =  [ columnName ,  ...( subfield  ||  [ ] ) ]  as  Some < string > ; 
354+     if  ( this . extents . get ( key ) )  { 
355+       return  this . extents . get ( key ) ; 
356+     } 
357+ 
358+     // First -- look at the schema metadata. 
359+     let  dim  =  this . _schema ?. fields . find ( ( d )  =>  d . name  ===  columnName ) ; 
360+     for  ( const  sub  in  subfield )  { 
361+       if  ( dim  ===  undefined )  { 
362+         continue ; 
363+       } 
364+       console . log ( {  dim } ) ; 
365+       dim  =  ( dim  as  Field < Struct < any > > ) . type . children . find ( 
366+         ( d )  =>  d . name  ===  sub , 
367+       ) ; 
347368    } 
348-     const  dim  =  this . _schema ?. fields . find ( 
349-       ( d )  =>  d . name  ===  columnName , 
350-     )  as  Field < DS . SupportedArrowTypes > ; 
351369    if  ( dim  !==  undefined )  { 
352370      let  min : T [ 0 ]  |  undefined  =  undefined ; 
353371      let  max : T [ 0 ]  |  undefined  =  undefined ; 
@@ -370,24 +388,30 @@ export class Deeptable {
370388            'Date field extents in metadata must be passed as strings' , 
371389          ) ; 
372390        } 
373-         return  ( this . extents [ columnName ]  =  [ new  Date ( min ) ,  new  Date ( max ) ] ) ; 
391+         this . extents . set ( key ,  [ new  Date ( min ) ,  new  Date ( max ) ] ) ; 
392+         return  this . extents . get ( key ) ; 
374393      } 
375394      if  ( typeof  max  ===  'string' )  { 
376395        throw  new  Error ( 'Failed to parse min-max as numbers' ) ; 
377396      } 
378397      if  ( min  !==  undefined )  { 
379-         return   ( this . extents [ columnName ]   =  [ min  as  T [ 1 ] ,  max  as  T [ 1 ] ]  as 
398+         this . extents . set ( key ,  [ min  as  T [ 1 ] ,  max  as  T [ 1 ] ]  as 
380399          |  [ number ,  number ] 
381400          |  [ Date ,  Date ] ) ; 
401+         return  this . extents . get ( key ) ; 
382402      } 
383403    } 
404+ 
384405    const  vectors : Vector [ ]  =  this . map ( ( tile )  =>  tile ) 
385406      . filter ( ( d )  =>  d . hasLoadedColumn ( columnName ) ) 
386-       . map ( ( d )  =>  d . record_batch . getChild ( columnName )  as  Vector < Float32 > ) ; 
407+       . map ( ( d )  =>  getNestedVector ( d ,  [ columnName ,  ...( subfield  ||  [ ] ) ] ) ) ; 
408+ 
387409    const  extented  =  extent ( [ ...new  Vector ( vectors ) ] )  as  [ T [ 1 ] ,  T [ 1 ] ]  as 
388410      |  [ number ,  number ] 
389411      |  [ Date ,  Date ] ; 
390-     return  ( this . extents [ columnName ]  =  extented ) ; 
412+ 
413+     this . extents . set ( key ,  extented ) ; 
414+     return  this . extents . get ( key ) ; 
391415  } 
392416
393417  * points ( bbox : Rectangle  |  undefined ,  max_ix  =  1e99 )  { 
0 commit comments