Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
HyukjinKwon committed Mar 20, 2020
1 parent ae10be6 commit 1cda816
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions databricks/koalas/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,19 +568,24 @@ def _select_rows(self, rows_sel):
if (start is None and rows_sel.start is not None) or (
stop is None and rows_sel.stop is not None
):

inc = index_column.is_monotonic_increasing
if inc is False:
dec = index_column.is_monotonic_decreasing

if start is None and rows_sel.start is not None:
start = rows_sel.start
if index_column.is_monotonic_increasing is not False:
if inc is not False:
cond.append(index_column._scol >= F.lit(start).cast(index_data_type))
elif index_column.is_monotonic_decreasing is not False:
elif dec is not False:
cond.append(index_column._scol <= F.lit(start).cast(index_data_type))
else:
raise KeyError(rows_sel.start)
if stop is None and rows_sel.stop is not None:
stop = rows_sel.stop
if index_column.is_monotonic_increasing is not False:
if inc is not False:
cond.append(index_column._scol <= F.lit(stop).cast(index_data_type))
elif index_column.is_monotonic_decreasing is not False:
elif dec is not False:
cond.append(index_column._scol >= F.lit(stop).cast(index_data_type))
else:
raise KeyError(rows_sel.stop)
Expand Down

0 comments on commit 1cda816

Please sign in to comment.