@@ -795,6 +795,9 @@ class Frame_cursor : public Sql_alloc
795
795
perform_no_action= true ;
796
796
}
797
797
798
+ /* Retrieves the row number that this cursor currently points at. */
799
+ virtual ha_rows get_curr_rownum ()= 0;
800
+
798
801
protected:
799
802
inline void add_value_to_items ()
800
803
{
@@ -988,6 +991,11 @@ class Frame_range_n_top : public Frame_cursor
988
991
walk_till_non_peer ();
989
992
}
990
993
994
+ ha_rows get_curr_rownum ()
995
+ {
996
+ return cursor.get_rownum ();
997
+ }
998
+
991
999
private:
992
1000
void walk_till_non_peer ()
993
1001
{
@@ -1110,6 +1118,11 @@ class Frame_range_n_bottom: public Frame_cursor
1110
1118
walk_till_non_peer ();
1111
1119
}
1112
1120
1121
+ ha_rows get_curr_rownum ()
1122
+ {
1123
+ return cursor.get_rownum ();
1124
+ }
1125
+
1113
1126
private:
1114
1127
void walk_till_non_peer ()
1115
1128
{
@@ -1200,6 +1213,11 @@ class Frame_range_current_row_bottom: public Frame_cursor
1200
1213
walk_till_non_peer ();
1201
1214
}
1202
1215
1216
+ ha_rows get_curr_rownum ()
1217
+ {
1218
+ return cursor.get_rownum ();
1219
+ }
1220
+
1203
1221
private:
1204
1222
void walk_till_non_peer ()
1205
1223
{
@@ -1299,6 +1317,11 @@ class Frame_range_current_row_top : public Frame_cursor
1299
1317
while (1 );
1300
1318
}
1301
1319
}
1320
+
1321
+ ha_rows get_curr_rownum ()
1322
+ {
1323
+ return cursor.get_rownum ();
1324
+ }
1302
1325
};
1303
1326
1304
1327
@@ -1322,15 +1345,25 @@ class Frame_unbounded_preceding : public Frame_cursor
1322
1345
void next_partition (ha_rows rownum)
1323
1346
{
1324
1347
/*
1325
- UNBOUNDED PRECEDING frame end just stays on the first row.
1326
- We are top of the frame, so we don't need to update the sum function.
1348
+ UNBOUNDED PRECEDING frame end just stays on the first row of the
1349
+ partition. We are top of the frame, so we don't need to update the sum
1350
+ function.
1327
1351
*/
1352
+ curr_rownum= rownum;
1328
1353
}
1329
1354
1330
1355
void next_row ()
1331
1356
{
1332
1357
/* Do nothing, UNBOUNDED PRECEDING frame end doesn't move. */
1333
1358
}
1359
+
1360
+ ha_rows get_curr_rownum ()
1361
+ {
1362
+ return curr_rownum;
1363
+ }
1364
+
1365
+ private:
1366
+ ha_rows curr_rownum;
1334
1367
};
1335
1368
1336
1369
@@ -1380,6 +1413,11 @@ class Frame_unbounded_following : public Frame_cursor
1380
1413
{
1381
1414
/* Do nothing, UNBOUNDED FOLLOWING frame end doesn't move */
1382
1415
}
1416
+
1417
+ ha_rows get_curr_rownum ()
1418
+ {
1419
+ return cursor.get_rownum ();
1420
+ }
1383
1421
};
1384
1422
1385
1423
@@ -1415,6 +1453,11 @@ class Frame_unbounded_following_set_count : public Frame_unbounded_following
1415
1453
item_with_row_count->set_row_count (num_rows_in_partition);
1416
1454
}
1417
1455
}
1456
+
1457
+ ha_rows get_curr_rownum ()
1458
+ {
1459
+ return cursor.get_rownum ();
1460
+ }
1418
1461
};
1419
1462
1420
1463
// ///////////////////////////////////////////////////////////////////////////
@@ -1492,6 +1535,11 @@ class Frame_n_rows_preceding : public Frame_cursor
1492
1535
else
1493
1536
add_value_to_items ();
1494
1537
}
1538
+
1539
+ ha_rows get_curr_rownum ()
1540
+ {
1541
+ return cursor.get_rownum ();
1542
+ }
1495
1543
};
1496
1544
1497
1545
@@ -1506,17 +1554,33 @@ class Frame_rows_current_row_bottom : public Frame_cursor
1506
1554
{
1507
1555
public:
1508
1556
1557
+ Frame_rows_current_row_bottom () : curr_rownum(0 ) {}
1558
+
1509
1559
void pre_next_partition (ha_rows rownum)
1510
1560
{
1511
1561
add_value_to_items ();
1512
1562
}
1563
+
1513
1564
void next_partition (ha_rows rownum) {}
1565
+
1514
1566
void pre_next_row ()
1515
1567
{
1516
1568
/* Temp table's current row is current_row. Add it to the window func */
1517
1569
add_value_to_items ();
1518
1570
}
1519
- void next_row () {};
1571
+
1572
+ void next_row ()
1573
+ {
1574
+ curr_rownum++;
1575
+ };
1576
+
1577
+ ha_rows get_curr_rownum ()
1578
+ {
1579
+ return curr_rownum;
1580
+ }
1581
+
1582
+ private:
1583
+ ha_rows curr_rownum;
1520
1584
};
1521
1585
1522
1586
@@ -1611,6 +1675,11 @@ class Frame_n_rows_following : public Frame_cursor
1611
1675
next_row_intern ();
1612
1676
}
1613
1677
1678
+ ha_rows get_curr_rownum ()
1679
+ {
1680
+ return cursor.get_rownum ();
1681
+ }
1682
+
1614
1683
private:
1615
1684
bool next_row_intern ()
1616
1685
{
0 commit comments