Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-7109

[JS] Create table from Arrays

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • None
    • JavaScript
    • None

    Description

      I am trying to generate an arrow table from JS arrays and followed the example from [here | https://observablehq.com/@lmeyerov/manipulating-flat-arrays-arrow-style] but I am struggling to generate different schemas, most importantly how to provide a type different then 'floatingpoint'. Right now, I have:

      const data = Table.from({
        schema: {
          fields: [{name: 'a', nullable: false, children: Array(0), 
           type: {name: 'floatingpoint', precision: 'SINGLE'}}]    
          },    
        batches: [{        
         count: 10,        
         columns: [{ name: 'a', count: 10, VALIDITY: [], 
          DATA: Array.from({ length: 10 }, () => 'a') }]}]  
      })
      

      Which, of course is non-sense but I couldn't figure out how to provide the type (I tried type: Utf8 among others).  In general wouldn't it be a nice to have create Table from object function?

      On another note, are there any plans to make the docs a little bit more descriptive? Happy to contribute!

      Attachments

        1. image-2019-11-12-09-11-39-751.png
          264 kB
          Sascha Hofmann

        Issue Links

          Activity

            People

              domoritz Dominik Moritz
              saschahofmann Sascha Hofmann
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: