Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS] Add generic to Table for column names #19151

Closed
asfimport opened this issue Jun 30, 2018 · 3 comments
Closed

[JS] Add generic to Table for column names #19151

asfimport opened this issue Jun 30, 2018 · 3 comments

Comments

@asfimport
Copy link

Requested by @domoritz
Something like:

class Table<ColName extends string = string> {
    ...
    getColumn(name: ColName): Vector<any> {
    }
    ...
}

It would be even better if we could find a way to map the column names to the actual vector data types, but one thing at a time.

Reporter: Brian Hulette / @TheNeuralBit
Assignee: Brian Hulette / @TheNeuralBit

PRs and other links:

Note: This issue was originally created as ARROW-2767. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Dominik Moritz / @domoritz:
One thing I realized later is that the getColumn(name) function can then guarantee to return a column rather than returning Column | null.

@asfimport
Copy link
Author

Brian Hulette / @TheNeuralBit:
We could also do

class Table<T extends {[name: string]: any}> {
    ...
    getColumn(name: keyof T): Vector<T[name]> {
    }
    ...
}

Although I'm not sure the T[name] lookup will actually work.

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Issue resolved by pull request 2256
#2256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants