This repository has been archived by the owner on Sep 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cardinality estimate to AbstractPlan object (#1475)
* Clarified variable name * Added cardinality and test * Add optimizer testing class * Remove debugging code * Revert default estimate to fix broken test * Formatting * Removed unecessary override in Cardinality test * More comments and clean up tests
- Loading branch information
1 parent
e738acb
commit 1fc8b55
Showing
14 changed files
with
254 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Peloton | ||
// | ||
// cardinality_test.cpp | ||
// | ||
// Identification: test/optimizer/cardinality_test.cpp | ||
// | ||
// Copyright (c) 2015-2018, Carnegie Mellon University Database Group | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "optimizer_test_util.cpp" | ||
#include <chrono> | ||
|
||
|
||
namespace peloton { | ||
namespace test { | ||
|
||
class CardinalityTest : public OptimizerTestUtil {}; | ||
|
||
TEST_F(CardinalityTest, EstimatedCardinalityTest) { | ||
|
||
const std::string test_table_name = "testtable"; | ||
const int num_rows = 10; | ||
OptimizerTestUtil::CreateTable(test_table_name, num_rows); | ||
|
||
auto plan = GeneratePlan("SELECT a from " + test_table_name + ";"); | ||
|
||
EXPECT_EQ(num_rows, plan->GetCardinality()); | ||
} | ||
|
||
TEST_F(CardinalityTest, EstimatedCardinalityTestWithPredicate) { | ||
|
||
const std::string test_table_name = "testtable"; | ||
const int num_rows = 10; | ||
OptimizerTestUtil::CreateTable(test_table_name, num_rows); | ||
|
||
auto plan = GeneratePlan("SELECT a from " + test_table_name + " WHERE " + "a < 10;"); | ||
|
||
EXPECT_GE(num_rows, plan->GetCardinality()); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.