Skip to content

Commit

Permalink
Remove internal py::DataWindow class (#1529)
Browse files Browse the repository at this point in the history
- Internal method `frame.internal.window(row0, row1, col0, col1)` is removed. Same result can be achieved via `frame[row0:row1, col0:col1].to_list()`;
- Removed class `py::DataWindow` which used to handle the `.window()` call. This class has been around since the very early days of datatable, and grew useless over time;
- The `DT[i, j]` call is able to handle different row indices without problems, resolving issue #1527.

Closes #1527
  • Loading branch information
st-pasha authored Jan 10, 2019
1 parent 89f6a06 commit 0fbe4b8
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 391 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `DT.replace()` now throws an error if called with 0 or 1 argument (#1525).
Thanks to [Arno Candel][] for discovering this issue.

- Fixed crash when viewing a frame obtained by resizing a 0-row frame (#1527).
Thanks to [Nishant Kalonia][] for reporting.


### Changed

Expand Down Expand Up @@ -828,6 +831,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
[jonathan mckinney]: https://github.com/pseudotensor
[michael frasco]: https://github.com/mfrasco
[michal raška]: https://github.com/michal-raska
[nishant kalonia]: https://github.com/nkalonia1
[oleksiy kononenko]: https://github.com/oleksiyskononenko
[olivier]: https://github.com/goldentom42
[pasha stetsenko]: https://github.com/st-pasha
Expand Down
2 changes: 0 additions & 2 deletions c/datatablemodule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "py_column.h"
#include "py_columnset.h"
#include "py_datatable.h"
#include "py_datawindow.h"
#include "py_encodings.h"
#include "py_groupby.h"
#include "py_rowindex.h"
Expand Down Expand Up @@ -228,7 +227,6 @@ PyInit__datatable()
try {
// Initialize submodules
if (!init_py_types(m)) return nullptr;
if (!pydatawindow::static_init(m)) return nullptr;
if (!pycolumn::static_init(m)) return nullptr;
if (!pycolumnset::static_init(m)) return nullptr;
if (!pydatatable::static_init(m)) return nullptr;
Expand Down
16 changes: 0 additions & 16 deletions c/py_datatable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "frame/py_frame.h"
#include "py_column.h"
#include "py_columnset.h"
#include "py_datawindow.h"
#include "py_groupby.h"
#include "py_rowindex.h"
#include "py_types.h"
Expand Down Expand Up @@ -190,20 +189,6 @@ void _clear_types(obj* self) {
}


PyObject* window(obj* self, PyObject* args) {
int64_t row0, row1, col0, col1;
if (!PyArg_ParseTuple(args, "llll", &row0, &row1, &col0, &col1))
return nullptr;

PyObject* dwtype = reinterpret_cast<PyObject*>(&pydatawindow::type);
PyObject* nargs = Py_BuildValue("Ollll", self, row0, row1, col0, col1);
PyObject* res = PyObject_CallObject(dwtype, nargs);
Py_XDECREF(nargs);

return res;
}


PyObject* to_scalar(obj* self, PyObject*) {
DataTable* dt = self->ref;
if (dt->ncols == 1 && dt->nrows == 1) {
Expand Down Expand Up @@ -623,7 +608,6 @@ static void dealloc(obj* self) {
//==============================================================================

static PyMethodDef datatable_methods[] = {
METHODv(window),
METHOD0(to_scalar),
METHOD0(check),
METHODv(column),
Expand Down
5 changes: 0 additions & 5 deletions c/py_datatable.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ DECLARE_GETTER(

//---- Methods -----------------------------------------------------------------

DECLARE_METHOD(
window,
"window(row0, row1, col0, col1)\n\n"
"Retrieve DataTable's data within a window")

DECLARE_METHOD(
to_scalar,
"to_scalar()\n\n"
Expand Down
273 changes: 0 additions & 273 deletions c/py_datawindow.cc

This file was deleted.

Loading

0 comments on commit 0fbe4b8

Please sign in to comment.