Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit fb333d9

Browse files
committed
Supplemental lint
1 parent dd5482c commit fb333d9

File tree

125 files changed

+2347
-2168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2347
-2168
lines changed

test/binder/binder_test.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ using std::make_tuple;
3636
namespace peloton {
3737
namespace test {
3838

39-
class BinderCorrectnessTestTests : public PelotonTest { virtual void SetUp() override {
39+
class BinderCorrectnessTestTests : public PelotonTest {
40+
virtual void SetUp() override {
4041
PelotonTest::SetUp();
4142
auto catalog = catalog::Catalog::GetInstance();
4243
catalog->Bootstrap();
@@ -318,7 +319,8 @@ TEST_F(BinderCorrectnessTest, BindDepthTest) {
318319
auto exists_sub_expr_select =
319320
dynamic_cast<const expression::SubqueryExpression *>(exists_sub_expr)
320321
->GetSubSelect();
321-
auto exists_sub_expr_select_where = exists_sub_expr_select->where_clause.get();
322+
auto exists_sub_expr_select_where =
323+
exists_sub_expr_select->where_clause.get();
322324
auto exists_sub_expr_select_ele =
323325
exists_sub_expr_select->select_list[0].get();
324326
auto in_tv_expr = in_expr->GetChild(0);

test/catalog/constraints_test.cpp

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ TEST_F(ConstraintsTests, NOTNULLTest) {
5454
// Set all of the columns to be NOT NULL
5555
std::vector<std::vector<catalog::Constraint>> constraints;
5656
for (int i = 0; i < CONSTRAINTS_NUM_COLS; i++) {
57-
constraints.push_back({ catalog::Constraint(ConstraintType::NOTNULL,
58-
"notnull_constraint") });
57+
constraints.push_back(
58+
{catalog::Constraint(ConstraintType::NOTNULL, "notnull_constraint")});
5959
}
6060
std::vector<catalog::MultiConstraint> multi_constraints;
6161
storage::DataTable *data_table =
62-
TestingConstraintsUtil::CreateAndPopulateTable(constraints, multi_constraints);
62+
TestingConstraintsUtil::CreateAndPopulateTable(constraints,
63+
multi_constraints);
6364

6465
// Bootstrap
6566
auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();
@@ -68,14 +69,12 @@ TEST_F(ConstraintsTests, NOTNULLTest) {
6869
type::ValueFactory::GetIntegerValue(1),
6970
type::ValueFactory::GetIntegerValue(22),
7071
type::ValueFactory::GetDecimalValue(3.33),
71-
type::ValueFactory::GetVarcharValue("4444")
72-
};
72+
type::ValueFactory::GetVarcharValue("4444")};
7373
std::vector<type::Value> null_values = {
7474
type::ValueFactory::GetNullValueByType(type::TypeId::INTEGER),
7575
type::ValueFactory::GetNullValueByType(type::TypeId::INTEGER),
7676
type::ValueFactory::GetNullValueByType(type::TypeId::DECIMAL),
77-
type::ValueFactory::GetNullValueByType(type::TypeId::VARCHAR)
78-
};
77+
type::ValueFactory::GetNullValueByType(type::TypeId::VARCHAR)};
7978

8079
// Test1: Insert a tuple with column that satisfies the requirement
8180
auto txn = txn_manager.BeginTransaction();
@@ -103,8 +102,8 @@ TEST_F(ConstraintsTests, NOTNULLTest) {
103102
}
104103
EXPECT_TRUE(hasException);
105104
txn_manager.CommitTransaction(txn);
106-
} // FOR
107-
105+
} // FOR
106+
108107
// free the database just created
109108
txn = txn_manager.BeginTransaction();
110109
catalog::Catalog::GetInstance()->DropDatabaseWithName(DEFAULT_DB_NAME, txn);
@@ -120,22 +119,23 @@ TEST_F(ConstraintsTests, DEFAULTTESTTest) {
120119
// COL_A
121120
if (i == 0) {
122121
constraints.push_back(
123-
{ catalog::Constraint(ConstraintType::PRIMARY, "pkey") });
122+
{catalog::Constraint(ConstraintType::PRIMARY, "pkey")});
124123
}
125124
// COL_B
126125
else if (i == 1) {
127126
catalog::Constraint default_const(ConstraintType::DEFAULT, "default");
128127
default_const.addDefaultValue(
129128
type::ValueFactory::GetIntegerValue(DEFAULT_VALUE));
130-
constraints.push_back({ });
129+
constraints.push_back({});
131130
}
132131
// COL_C + COL_D
133132
else {
134-
constraints.push_back({ });
133+
constraints.push_back({});
135134
}
136135
}
137136
std::vector<catalog::MultiConstraint> multi_constraints;
138-
TestingConstraintsUtil::CreateAndPopulateTable(constraints, multi_constraints);
137+
TestingConstraintsUtil::CreateAndPopulateTable(constraints,
138+
multi_constraints);
139139

140140
// Bootstrap
141141
std::vector<ResultValue> result;
@@ -146,17 +146,17 @@ TEST_F(ConstraintsTests, DEFAULTTESTTest) {
146146
// Test1: Insert a tuple without the second column defined
147147
// It should get set with the default value
148148
std::string sql = StringUtil::Format(
149-
"INSERT INTO %s (col_a, col_c, col_d) "
150-
"VALUES (9999, 2.2, 'xxx');", CONSTRAINTS_TEST_TABLE);
151-
auto status = TestingSQLUtil::ExecuteSQLQuery(
152-
sql, result, tuple_descriptor, rows_affected, error_message
153-
);
149+
"INSERT INTO %s (col_a, col_c, col_d) "
150+
"VALUES (9999, 2.2, 'xxx');",
151+
CONSTRAINTS_TEST_TABLE);
152+
auto status = TestingSQLUtil::ExecuteSQLQuery(sql, result, tuple_descriptor,
153+
rows_affected, error_message);
154154
EXPECT_EQ(ResultType::SUCCESS, status);
155155

156156
sql = StringUtil::Format("SELECT col_d FROM %s WHERE col_a = 9999",
157157
CONSTRAINTS_TEST_TABLE);
158-
status = TestingSQLUtil::ExecuteSQLQuery(
159-
sql, result, tuple_descriptor, rows_affected, error_message);
158+
status = TestingSQLUtil::ExecuteSQLQuery(sql, result, tuple_descriptor,
159+
rows_affected, error_message);
160160
EXPECT_EQ(ResultType::SUCCESS, status);
161161
std::string resultStr = TestingSQLUtil::GetResultValueAsString(result, 0);
162162
LOG_INFO("OUTPUT:\n%s", resultStr.c_str());
@@ -179,7 +179,8 @@ TEST_F(ConstraintsTests, CHECKTest) {
179179
type::Value tmp_value = type::ValueFactory::GetIntegerValue(0);
180180
constraints.AddCheck(ExpressionType::COMPARE_GREATERTHAN, tmp_value);
181181
column1.AddConstraint(constraints);
182-
LOG_DEBUG("%s %s", peloton::DOUBLE_STAR.c_str(), constraints.GetInfo().c_str());
182+
LOG_DEBUG("%s %s", peloton::DOUBLE_STAR.c_str(),
183+
constraints.GetInfo().c_str());
183184
catalog::Schema *table_schema = new catalog::Schema({column1});
184185
std::string table_name("TEST_TABLE");
185186
bool own_schema = true;
@@ -230,7 +231,8 @@ TEST_F(ConstraintsTests, UNIQUETest) {
230231

231232
auto constraints = catalog::Constraint(ConstraintType::UNIQUE, "unique1");
232233
column1.AddConstraint(constraints);
233-
LOG_DEBUG("%s %s", peloton::DOUBLE_STAR.c_str(), constraints.GetInfo().c_str());
234+
LOG_DEBUG("%s %s", peloton::DOUBLE_STAR.c_str(),
235+
constraints.GetInfo().c_str());
234236
std::unique_ptr<catalog::Schema> table_schema(
235237
new catalog::Schema({column1, column2}));
236238
std::string table_name("TEST_TABLE");
@@ -288,7 +290,7 @@ TEST_F(ConstraintsTests, UNIQUETest) {
288290
}
289291
#endif
290292

291-
//TEST_F(ConstraintsTests, MULTIUNIQUETest) {
293+
// TEST_F(ConstraintsTests, MULTIUNIQUETest) {
292294
// auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();
293295
// auto catalog = catalog::Catalog::GetInstance();
294296
// auto txn = txn_manager.BeginTransaction();
@@ -368,7 +370,7 @@ TEST_F(ConstraintsTests, UNIQUETest) {
368370
// txn_manager.CommitTransaction(txn);
369371
//}
370372

371-
//TEST_F(ConstraintsTests, ForeignKeySingleInsertTest) {
373+
// TEST_F(ConstraintsTests, ForeignKeySingleInsertTest) {
372374
// // First, initial 2 tables like following
373375
// // TABLE A -- src table TABLE B -- sink table
374376
// // a int(primary, ref B) b int b int(primary) c int
@@ -393,7 +395,8 @@ TEST_F(ConstraintsTests, UNIQUETest) {
393395
//
394396
// auto constraints = catalog::Constraint(ConstraintType::PRIMARY, "primary1");
395397
// column1.AddConstraint(constraints);
396-
// LOG_DEBUG("%s %s", peloton::DOUBLE_STAR.c_str(), constraints.GetInfo().c_str());
398+
// LOG_DEBUG("%s %s", peloton::DOUBLE_STAR.c_str(),
399+
// constraints.GetInfo().c_str());
397400
// std::unique_ptr<catalog::Schema> tableA_schema(
398401
// new catalog::Schema({column1, column2}));
399402
//
@@ -413,8 +416,10 @@ TEST_F(ConstraintsTests, UNIQUETest) {
413416
// auto table_b = catalog->GetTableWithName(db_name, table_b_name);
414417
//
415418
// oid_t sink_table_id = table_b->GetOid();
416-
// std::vector<oid_t> sink_col_ids = { table_b->GetSchema()->GetColumnID("b") };
417-
// std::vector<oid_t> source_col_ids = { table_a->GetSchema()->GetColumnID("a") };
419+
// std::vector<oid_t> sink_col_ids = { table_b->GetSchema()->GetColumnID("b")
420+
// };
421+
// std::vector<oid_t> source_col_ids = { table_a->GetSchema()->GetColumnID("a")
422+
// };
418423
// catalog::ForeignKey *foreign_key = new catalog::ForeignKey(
419424
// sink_table_id, sink_col_ids, source_col_ids,
420425
// FKConstrActionType::NOACTION,
@@ -463,7 +468,7 @@ TEST_F(ConstraintsTests, UNIQUETest) {
463468
// delete foreign_key;
464469
//}
465470

466-
//TEST_F(ConstraintsTests, ForeignKeyMultiInsertTest) {
471+
// TEST_F(ConstraintsTests, ForeignKeyMultiInsertTest) {
467472
// // First, initial 2 tables like following
468473
// // TABLE A -- src table TABLE B -- sink table
469474
// // a int(primary, ref B) b int b int(primary) c int
@@ -498,7 +503,8 @@ TEST_F(ConstraintsTests, UNIQUETest) {
498503
// cols.push_back(0);
499504
// cols.push_back(1);
500505
// auto mc =
501-
// catalog::MultiConstraint(ConstraintType::PRIMARY, "multiprimary1", cols);
506+
// catalog::MultiConstraint(ConstraintType::PRIMARY, "multiprimary1",
507+
// cols);
502508
// LOG_DEBUG("%s MULTI CONSTRAINTS %s %s", peloton::DOUBLE_STAR.c_str(),
503509
// peloton::DOUBLE_STAR.c_str(), mc.GetInfo().c_str());
504510
//
@@ -514,8 +520,10 @@ TEST_F(ConstraintsTests, UNIQUETest) {
514520
//
515521
// // Create foreign key tableA.B -> tableB.B
516522
// oid_t sink_table_id = table_b->GetOid();
517-
// std::vector<oid_t> sink_col_ids = { table_b->GetSchema()->GetColumnID("b") };
518-
// std::vector<oid_t> source_col_ids = { table_a->GetSchema()->GetColumnID("b") };
523+
// std::vector<oid_t> sink_col_ids = { table_b->GetSchema()->GetColumnID("b")
524+
// };
525+
// std::vector<oid_t> source_col_ids = { table_a->GetSchema()->GetColumnID("b")
526+
// };
519527
// catalog::ForeignKey *foreign_key = new catalog::ForeignKey(
520528
// sink_table_id, sink_col_ids, source_col_ids,
521529
// FKConstrActionType::RESTRICT,

test/catalog/manager_test.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
1413
#include "common/harness.h"
1514

1615
#include "common/macros.h"
@@ -29,7 +28,6 @@ namespace test {
2928
class ManagerTests : public PelotonTest {};
3029

3130
void AddTileGroup(UNUSED_ATTRIBUTE uint64_t thread_id) {
32-
3331
// TILES
3432
std::vector<std::string> tile_column_names;
3533
std::vector<std::vector<std::string>> column_names;
@@ -41,8 +39,9 @@ void AddTileGroup(UNUSED_ATTRIBUTE uint64_t thread_id) {
4139
std::vector<catalog::Column> columns;
4240

4341
// SCHEMA
44-
catalog::Column column1(type::TypeId::INTEGER, type::Type::GetTypeSize(type::TypeId::INTEGER),
45-
"A", true);
42+
catalog::Column column1(type::TypeId::INTEGER,
43+
type::Type::GetTypeSize(type::TypeId::INTEGER), "A",
44+
true);
4645
columns.push_back(column1);
4746

4847
std::unique_ptr<catalog::Schema> schema1(new catalog::Schema(columns));
@@ -52,8 +51,10 @@ void AddTileGroup(UNUSED_ATTRIBUTE uint64_t thread_id) {
5251
column_map[0] = std::make_pair(0, 0);
5352

5453
for (oid_t txn_itr = 0; txn_itr < 100; txn_itr++) {
55-
std::unique_ptr<storage::TileGroup> tile_group(storage::TileGroupFactory::GetTileGroup(
56-
INVALID_OID, INVALID_OID, INVALID_OID, nullptr, schemas, column_map, 3));
54+
std::unique_ptr<storage::TileGroup> tile_group(
55+
storage::TileGroupFactory::GetTileGroup(INVALID_OID, INVALID_OID,
56+
INVALID_OID, nullptr, schemas,
57+
column_map, 3));
5758
}
5859
}
5960

0 commit comments

Comments
 (0)