microsoft / microsoft/SandDance

Inference on rows

Open
#233 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
573
Avg merge
8d 9h
Merged PRs (30d)
4

Description

Is there a way to force SandDance to perform inference on all rows instead of just a sample, without reinventing the wheel here?

There's getColumnsFromData, but this samples just the first row. Our rows don't all have the same data and the first row is pretty light.

/**
 * Derive column metadata from the data array.
 * @param data Array of data objects.
 */
export function getColumnsFromData(data, columnTypes) {
    const sample = data[0];
    const fields = sample ? Object.keys(sample) : [];
    const inferences = Object.assign(Object.assign({}, VegaDeckGl.base.vega.inferTypes(data, fields)), columnTypes);
    const columns = fields.map(name => {
        const column = {
            name,
            type: inferences[name]
        };
        return column;
    });
    inferAll(columns, data);
    return columns;
}

I could just run getColumnsFromData on every row, I guess, and then pass them into like #158?

Just curious if there's a more elegant way of going about it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at getColumnsFromData and inspect VegaDeckGl.base.vega.inferTypes, inferAll, and the approach discussed in issue #158. Determine how inference should account for fields across all rows rather than only the first sample, and clarify the expected behavior before implementing and testing it.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.