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

no error when grouping by [column] not in dataset #445

Open
orbit-stabilizer opened this issue Jan 14, 2025 · 1 comment
Open

no error when grouping by [column] not in dataset #445

orbit-stabilizer opened this issue Jan 14, 2025 · 1 comment

Comments

@orbit-stabilizer
Copy link

orbit-stabilizer commented Jan 14, 2025

Currently, we have the following, which is correct:

(-> (tc/dataset {:a []})
    (tc/group-by :b)
;; (err) Column not found: :b

However, when we run the following, we get an empty dataset and not an error:

(-> (tc/dataset {:a []})
    (tc/group-by [:b])
;; _unnamed [0 0]

Using group-by in this way should also return an error.

@cnuernber
Copy link
Collaborator

Great bug report and we agree this is the desired behavior!

tablecloth is built on TMD and we it appears in these situations TMD has reasonable responses thus far:

tech.v3.dataset-test> (ds/group-by->indexes (ds/empty-dataset) :a)
                       
{}
tech.v3.dataset-test> (ds/group-by-column->indexes (ds/empty-dataset) :a)
                       
Execution error at tech.v3.dataset.impl.dataset.Dataset/column (dataset.clj:308).
Column not found: :a
tech.v3.dataset-test> (ds/group-by-column->indexes (ds/->dataset {:a []}) :a)
                       
{}

Potentially the last case - {:a []} should return {:a (ds/empty-dataset)}.

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

No branches or pull requests

2 participants