implydata / plywood

A toolkit for querying and interacting with Big Data
https://plywood.imply.io
Apache License 2.0
384 stars 61 forks source link

Dataset.fromJs creates an empty Set if type is SET #311

Open denniswieczorek opened 6 months ago

denniswieczorek commented 6 months ago

Currently, creation of datums via .fromJs ignores the attribute type if the value is an empty array

const dataset = Dataset.fromJs({
  attributes: [ { name: 'x', type: 'SET }]
  data: [ { x: [] }, { x: ['foo'] } ]
})

// dataset.data[0] is a Dataset
// dataset.data[1] is a Set

This fix checks attribute type so that there aren't a mix of types on .data