Skip to content

Commit

Permalink
Migrate expressions to pylibcudf (#16056)
Browse files Browse the repository at this point in the history
xref #15162

Migrates expresions to use pylibcudf.

Authors:
  - Thomas Li (https://github.com/lithomas1)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Lawrence Mitchell (https://github.com/wence-)

URL: #16056
  • Loading branch information
lithomas1 authored Jul 16, 2024
1 parent 6219110 commit 6a954e2
Show file tree
Hide file tree
Showing 18 changed files with 335 additions and 237 deletions.
6 changes: 3 additions & 3 deletions docs/cudf/source/user_guide/api_docs/pylibcudf/datetime.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=======
copying
=======
========
datetime
========

.. automodule:: cudf._lib.pylibcudf.datetime
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
===========
expressions
===========

.. automodule:: cudf._lib.pylibcudf.expressions
:members:
1 change: 1 addition & 0 deletions docs/cudf/source/user_guide/api_docs/pylibcudf/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This page provides API documentation for pylibcudf.
concatenate
copying
datetime
expressions
filling
gpumemoryview
groupby
Expand Down
1 change: 0 additions & 1 deletion python/cudf/cudf/_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ set(cython_sources
copying.pyx
csv.pyx
datetime.pyx
expressions.pyx
filling.pyx
groupby.pyx
hash.pyx
Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
import numpy as np

from . import (
Expand All @@ -8,7 +8,6 @@
copying,
csv,
datetime,
expressions,
filling,
groupby,
hash,
Expand Down
156 changes: 0 additions & 156 deletions python/cudf/cudf/_lib/expressions.pyx

This file was deleted.

2 changes: 1 addition & 1 deletion python/cudf/cudf/_lib/parquet.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ cimport cudf._lib.pylibcudf.libcudf.io.data_sink as cudf_io_data_sink
cimport cudf._lib.pylibcudf.libcudf.io.types as cudf_io_types
cimport cudf._lib.pylibcudf.libcudf.types as cudf_types
from cudf._lib.column cimport Column
from cudf._lib.expressions cimport Expression
from cudf._lib.io.utils cimport (
make_sinks_info,
make_source_info,
update_struct_field_names,
)
from cudf._lib.pylibcudf.expressions cimport Expression
from cudf._lib.pylibcudf.io.datasource cimport NativeFileDatasource
from cudf._lib.pylibcudf.libcudf.expressions cimport expression
from cudf._lib.pylibcudf.libcudf.io.parquet cimport (
Expand Down
1 change: 1 addition & 0 deletions python/cudf/cudf/_lib/pylibcudf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(cython_sources
concatenate.pyx
copying.pyx
datetime.pyx
expressions.pyx
filling.pyx
gpumemoryview.pyx
groupby.pyx
Expand Down
1 change: 1 addition & 0 deletions python/cudf/cudf/_lib/pylibcudf/__init__.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from . cimport (
concatenate,
copying,
datetime,
expressions,
filling,
groupby,
join,
Expand Down
1 change: 1 addition & 0 deletions python/cudf/cudf/_lib/pylibcudf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
concatenate,
copying,
datetime,
expressions,
filling,
groupby,
interop,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
# Copyright (c) 2022-2024, NVIDIA CORPORATION.

from libc.stdint cimport int32_t, int64_t
# Copyright (c) 2024, NVIDIA CORPORATION.
from libcpp.memory cimport unique_ptr
from libcpp.string cimport string

from cudf._lib.pylibcudf.libcudf.expressions cimport (
column_reference,
ast_operator,
expression,
literal,
operation,
)
from cudf._lib.pylibcudf.libcudf.scalar.scalar cimport (
numeric_scalar,
scalar,
string_scalar,
timestamp_scalar,
table_reference,
)

from .scalar cimport Scalar


cdef class Expression:
cdef unique_ptr[expression] c_obj


cdef class Literal(Expression):
cdef unique_ptr[scalar] c_scalar

# Hold on to input scalar so it doesn't get gc'ed
cdef Scalar scalar

cdef class ColumnReference(Expression):
pass


cdef class Operation(Expression):
pass
# Hold on to the input expressions so
# they don't get gc'ed
cdef Expression right
cdef Expression left

cdef class ColumnNameReference(Expression):
pass
Loading

0 comments on commit 6a954e2

Please sign in to comment.