Skip to content

Commit 1cda816

Browse files
committed
Address comments
1 parent ae10be6 commit 1cda816

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

databricks/koalas/indexing.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,19 +568,24 @@ def _select_rows(self, rows_sel):
568568
if (start is None and rows_sel.start is not None) or (
569569
stop is None and rows_sel.stop is not None
570570
):
571+
572+
inc = index_column.is_monotonic_increasing
573+
if inc is False:
574+
dec = index_column.is_monotonic_decreasing
575+
571576
if start is None and rows_sel.start is not None:
572577
start = rows_sel.start
573-
if index_column.is_monotonic_increasing is not False:
578+
if inc is not False:
574579
cond.append(index_column._scol >= F.lit(start).cast(index_data_type))
575-
elif index_column.is_monotonic_decreasing is not False:
580+
elif dec is not False:
576581
cond.append(index_column._scol <= F.lit(start).cast(index_data_type))
577582
else:
578583
raise KeyError(rows_sel.start)
579584
if stop is None and rows_sel.stop is not None:
580585
stop = rows_sel.stop
581-
if index_column.is_monotonic_increasing is not False:
586+
if inc is not False:
582587
cond.append(index_column._scol <= F.lit(stop).cast(index_data_type))
583-
elif index_column.is_monotonic_decreasing is not False:
588+
elif dec is not False:
584589
cond.append(index_column._scol >= F.lit(stop).cast(index_data_type))
585590
else:
586591
raise KeyError(rows_sel.stop)

0 commit comments

Comments
 (0)