@@ -1319,6 +1319,23 @@ TEST_F(TestTable, Slice) {
13191319 *three->Slice (length + length / 3 , 2 * (length - length / 3 )));
13201320}
13211321
1322+ TEST_F (TestTable, SliceZeroColumns) {
1323+ const int64_t length = 10 ;
1324+ auto empty_columns_table = Table::Make (::arrow::schema ({}),std::vector<std::shared_ptr<ChunkedArray>>{}, length);
1325+ ASSERT_EQ (empty_columns_table->num_rows (), length);
1326+ ASSERT_EQ (empty_columns_table->Slice (3 )->num_rows (), length - 3 );
1327+ ASSERT_EQ (empty_columns_table->Slice (0 )->num_rows (), length);
1328+ ASSERT_EQ (empty_columns_table->Slice (3 , 100 )->num_rows (), length - 3 );
1329+ ASSERT_EQ (empty_columns_table->Slice (3 , 4 )->num_rows (), 4 );
1330+ ASSERT_EQ (empty_columns_table->Slice (length + 5 )->num_rows (), 0 );
1331+
1332+ MakeExample1 (length);
1333+ auto table = Table::Make (schema_, columns_);
1334+ ASSERT_OK_AND_ASSIGN (auto no_columns, table->SelectColumns ({}));
1335+ ASSERT_EQ (no_columns->Slice (1 )->num_rows (), table->Slice (1 )->num_rows ());
1336+ ASSERT_EQ (no_columns->Slice (1 , 4 )->num_rows (), 4 );
1337+ }
1338+
13221339TEST_F (TestTable, RemoveColumn) {
13231340 const int64_t length = 10 ;
13241341 MakeExample1 (length);
0 commit comments