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

Added drop operator #313

Merged
merged 4 commits into from Nov 21, 2023
Merged

Added drop operator #313

merged 4 commits into from Nov 21, 2023

Conversation

javiber
Copy link
Collaborator

@javiber javiber commented Nov 16, 2023

Behind the scenes, it just uses the select implementation.

I am not sure about the dependencies in the build files, it's working but it was the result of many trial-and-error

Copy link

Coverage report

Main: 91.13% | PR: 91.14% | Diff: 0.01 ✅

Copy link
Collaborator

@ianspektor ianspektor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! LGTM after comments are addressed and tests fixed :)

@typecheck
@compile
def drop(
input: EventSetOrNode, feature_names: str | List[str]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The | syntax for type union was only introduced in 3.10, and temporian supports 3.8 and up (which is why the tests GH action is failing on py3.8) - we need to use Union

raise TypeError(
"Features"
f" {[fn for fn in feature_names if fn not in input_features]} are"
" not present in the input features"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not present in the input.

Comment on lines 457 to 464
deps = [
":base",
"//temporian/core:operator_lib",
"//temporian/core/data:node",
"//temporian/core/data:schema",
"//temporian/proto:core_py_proto",
],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two don't seem necessary:

"//temporian/core/data:schema",
"//temporian/proto:core_py_proto",

and these seem missing:

"//temporian/core:compilation",
"//temporian/core:typing",
"//temporian/core/operators:select",

try running the python tools/build_cleaner.py (though its weird these tests passed with missing deps)

Comment on lines 18 to 25
from typing import List
from temporian.core import operator_lib
from temporian.core.compilation import compile
from temporian.core.data.node import (
EventSetNode,
create_node_new_features_new_sampling,
)
from temporian.core.operators.base import Operator
from temporian.core.typing import EventSetOrNode
from temporian.proto import core_pb2 as pb
from temporian.utils.typecheck import typecheck
from temporian.core.operators.select import select
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

several unused imports - please install pylint and address the unused import warnings (maybe add it to the workspace's recommended extensions too while you're at it)

deps = [
"//temporian/implementation/numpy/data:io",
"//temporian/test:utils",
"//temporian/core/operators:drop",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneeded (you're calling drop from the EventSet, not importing it from its module)

Copy link

Coverage report

Main: 91.10% | PR: 91.12% | Diff: 0.01 ✅

Also added pylint to recommended extesions
Copy link

Coverage report

Main: 91.10% | PR: 91.11% | Diff: 0.01 ✅

@javiber javiber mentioned this pull request Nov 20, 2023
Copy link

Coverage report

Main: 91.10% | PR: 91.10% | Diff: 0.00 ✅

Copy link

Coverage report

Main: 91.10% | PR: 91.10% | Diff: 0.00 ✅

@javiber javiber merged commit 3a41e32 into main Nov 21, 2023
19 checks passed
@javiber javiber deleted the drop-operator branch November 21, 2023 18:09
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

Successfully merging this pull request may close these issues.

None yet

2 participants