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

Commit f502f2c

Browse files
committed
lint
1 parent a7f9bc0 commit f502f2c

File tree

107 files changed

+1763
-1674
lines changed

Some content is hidden

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

107 files changed

+1763
-1674
lines changed

test/binder/binder_test.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ TEST_F(BinderCorrectnessTests, SelectStatementTest) {
127127

128128
oid_t db_oid =
129129
catalog_ptr->GetDatabaseWithName(default_database_name, txn)->GetOid();
130-
oid_t tableA_oid = catalog_ptr
131-
->GetTableWithName(default_database_name,
132-
DEFAULT_SCHEMA_NAME, "a", txn)
133-
->GetOid();
134-
oid_t tableB_oid = catalog_ptr
135-
->GetTableWithName(default_database_name,
136-
DEFAULT_SCHEMA_NAME, "b", txn)
137-
->GetOid();
130+
oid_t tableA_oid =
131+
catalog_ptr->GetTableWithName(default_database_name, DEFAULT_SCHEMA_NAME,
132+
"a", txn)
133+
->GetOid();
134+
oid_t tableB_oid =
135+
catalog_ptr->GetTableWithName(default_database_name, DEFAULT_SCHEMA_NAME,
136+
"b", txn)
137+
->GetOid();
138138
txn_manager.CommitTransaction(txn);
139139

140140
// Check select_list
@@ -260,10 +260,10 @@ TEST_F(BinderCorrectnessTests, DeleteStatementTest) {
260260
auto txn = txn_manager.BeginTransaction();
261261
oid_t db_oid =
262262
catalog_ptr->GetDatabaseWithName(default_database_name, txn)->GetOid();
263-
oid_t tableB_oid = catalog_ptr
264-
->GetTableWithName(default_database_name,
265-
DEFAULT_SCHEMA_NAME, "b", txn)
266-
->GetOid();
263+
oid_t tableB_oid =
264+
catalog_ptr->GetTableWithName(default_database_name, DEFAULT_SCHEMA_NAME,
265+
"b", txn)
266+
->GetOid();
267267

268268
string deleteSQL = "DELETE FROM b WHERE 1 = b1 AND b2 = 'str'";
269269
unique_ptr<binder::BindNodeVisitor> binder(

test/brain/tensorflow_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ TEST_F(TensorflowTests, SineWavePredictionTest) {
4646
int NUM_WAVES = 3;
4747
matrix_eig data = matrix_eig::Zero(NUM_SAMPLES, NUM_WAVES);
4848
for (int i = 0; i < NUM_WAVES; i++) {
49-
data.col(i).setLinSpaced(NUM_SAMPLES, NUM_SAMPLES * i,
50-
NUM_SAMPLES * (i + 1) - 1);
49+
data.col(i)
50+
.setLinSpaced(NUM_SAMPLES, NUM_SAMPLES * i, NUM_SAMPLES * (i + 1) - 1);
5151
data.col(i) = data.col(i).array().sin();
5252
}
5353

test/catalog/manager_test.cpp

Lines changed: 3 additions & 4 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 "catalog/manager.h"
@@ -30,7 +29,6 @@ namespace test {
3029
class ManagerTests : public PelotonTests {};
3130

3231
void AddTileGroup(UNUSED_ATTRIBUTE uint64_t thread_id) {
33-
3432
// TILES
3533
std::vector<std::string> tile_column_names;
3634
std::vector<std::vector<std::string>> column_names;
@@ -42,8 +40,9 @@ void AddTileGroup(UNUSED_ATTRIBUTE uint64_t thread_id) {
4240
std::vector<catalog::Column> columns;
4341

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

4948
std::unique_ptr<catalog::Schema> schema1(new catalog::Schema(columns));

test/catalog/tuple_schema_test.cpp

Lines changed: 47 additions & 33 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 "catalog/schema.h"
@@ -27,12 +26,15 @@ class TupleSchemaTests : public PelotonTests {};
2726
TEST_F(TupleSchemaTests, ColumnInfoTest) {
2827
std::vector<catalog::Column> columns;
2928

30-
catalog::Column column1(type::TypeId::INTEGER, type::Type::GetTypeSize(type::TypeId::INTEGER),
31-
"A", true);
32-
catalog::Column column2(type::TypeId::INTEGER, type::Type::GetTypeSize(type::TypeId::INTEGER),
33-
"B", true);
34-
catalog::Column column3(type::TypeId::TINYINT, type::Type::GetTypeSize(type::TypeId::TINYINT),
35-
"C", true);
29+
catalog::Column column1(type::TypeId::INTEGER,
30+
type::Type::GetTypeSize(type::TypeId::INTEGER), "A",
31+
true);
32+
catalog::Column column2(type::TypeId::INTEGER,
33+
type::Type::GetTypeSize(type::TypeId::INTEGER), "B",
34+
true);
35+
catalog::Column column3(type::TypeId::TINYINT,
36+
type::Type::GetTypeSize(type::TypeId::TINYINT), "C",
37+
true);
3638

3739
columns.push_back(column1);
3840
columns.push_back(column2);
@@ -48,12 +50,15 @@ TEST_F(TupleSchemaTests, ColumnInfoTest) {
4850
TEST_F(TupleSchemaTests, TupleSchemaFilteringTest) {
4951
std::vector<catalog::Column> columns;
5052

51-
catalog::Column column1(type::TypeId::INTEGER, type::Type::GetTypeSize(type::TypeId::INTEGER),
52-
"A", true);
53-
catalog::Column column2(type::TypeId::INTEGER, type::Type::GetTypeSize(type::TypeId::INTEGER),
54-
"B", true);
55-
catalog::Column column3(type::TypeId::TINYINT, type::Type::GetTypeSize(type::TypeId::TINYINT),
56-
"C", true);
53+
catalog::Column column1(type::TypeId::INTEGER,
54+
type::Type::GetTypeSize(type::TypeId::INTEGER), "A",
55+
true);
56+
catalog::Column column2(type::TypeId::INTEGER,
57+
type::Type::GetTypeSize(type::TypeId::INTEGER), "B",
58+
true);
59+
catalog::Column column3(type::TypeId::TINYINT,
60+
type::Type::GetTypeSize(type::TypeId::TINYINT), "C",
61+
true);
5762
catalog::Column column4(type::TypeId::VARCHAR, 24, "D", false);
5863

5964
columns.push_back(column1);
@@ -70,39 +75,42 @@ TEST_F(TupleSchemaTests, TupleSchemaFilteringTest) {
7075
///////////////////////////////////////////////////////////////////
7176
// Tests basic filterng
7277
///////////////////////////////////////////////////////////////////
73-
78+
7479
std::vector<oid_t> subset{0, 2};
75-
std::unique_ptr<catalog::Schema> schema3_p(catalog::Schema::FilterSchema(&schema2, subset));
80+
std::unique_ptr<catalog::Schema> schema3_p(
81+
catalog::Schema::FilterSchema(&schema2, subset));
7682
LOG_INFO("%s", schema3_p->GetInfo().c_str());
7783

7884
EXPECT_NE(schema1, (*schema3_p));
79-
85+
8086
///////////////////////////////////////////////////////////////////
8187
// Tests out of order filtering (should not affected by order)
8288
///////////////////////////////////////////////////////////////////
83-
89+
8490
subset = {2, 0};
85-
std::unique_ptr<catalog::Schema> schema4_p(catalog::Schema::FilterSchema(&schema2, subset));
91+
std::unique_ptr<catalog::Schema> schema4_p(
92+
catalog::Schema::FilterSchema(&schema2, subset));
8693
LOG_INFO("%s", schema4_p->GetInfo().c_str());
8794

8895
EXPECT_EQ((*schema4_p), (*schema3_p));
89-
96+
9097
///////////////////////////////////////////////////////////////////
9198
// Tests duplicated indices & out of bound indices
9299
///////////////////////////////////////////////////////////////////
93-
100+
94101
subset = {666, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 2, 100, 101};
95-
96-
std::unique_ptr<catalog::Schema> schema5_p(catalog::Schema::FilterSchema(&schema2, subset));
102+
103+
std::unique_ptr<catalog::Schema> schema5_p(
104+
catalog::Schema::FilterSchema(&schema2, subset));
97105
LOG_INFO("%s", schema5_p->GetInfo().c_str());
98106

99107
EXPECT_EQ(schema5_p->GetColumnCount(), 2);
100108
EXPECT_EQ((*schema5_p), (*schema4_p));
101-
109+
102110
///////////////////////////////////////////////////////////////////
103111
// All tests finished
104112
///////////////////////////////////////////////////////////////////./t
105-
113+
106114
return;
107115
}
108116

@@ -112,12 +120,15 @@ TEST_F(TupleSchemaTests, TupleSchemaFilteringTest) {
112120
TEST_F(TupleSchemaTests, TupleSchemaCopyTest) {
113121
std::vector<catalog::Column> columns;
114122

115-
catalog::Column column1(type::TypeId::INTEGER, type::Type::GetTypeSize(type::TypeId::INTEGER),
116-
"A", true);
117-
catalog::Column column2(type::TypeId::INTEGER, type::Type::GetTypeSize(type::TypeId::INTEGER),
118-
"B", true);
119-
catalog::Column column3(type::TypeId::TINYINT, type::Type::GetTypeSize(type::TypeId::TINYINT),
120-
"C", true);
123+
catalog::Column column1(type::TypeId::INTEGER,
124+
type::Type::GetTypeSize(type::TypeId::INTEGER), "A",
125+
true);
126+
catalog::Column column2(type::TypeId::INTEGER,
127+
type::Type::GetTypeSize(type::TypeId::INTEGER), "B",
128+
true);
129+
catalog::Column column3(type::TypeId::TINYINT,
130+
type::Type::GetTypeSize(type::TypeId::TINYINT), "C",
131+
true);
121132
catalog::Column column4(type::TypeId::VARCHAR, 24, "D", false);
122133

123134
columns.push_back(column1);
@@ -132,7 +143,8 @@ TEST_F(TupleSchemaTests, TupleSchemaCopyTest) {
132143
///////////////////////////////////////////////////////////////////
133144

134145
std::vector<oid_t> subset{0, 2};
135-
std::unique_ptr<catalog::Schema> schema3_p(catalog::Schema::CopySchema(&schema1, subset));
146+
std::unique_ptr<catalog::Schema> schema3_p(
147+
catalog::Schema::CopySchema(&schema1, subset));
136148
LOG_INFO("%s", schema3_p->GetInfo().c_str());
137149

138150
EXPECT_NE(schema1, (*schema3_p));
@@ -142,7 +154,8 @@ TEST_F(TupleSchemaTests, TupleSchemaCopyTest) {
142154
///////////////////////////////////////////////////////////////////
143155

144156
subset = {2, 0};
145-
std::unique_ptr<catalog::Schema> schema4_p(catalog::Schema::CopySchema(&schema1, subset));
157+
std::unique_ptr<catalog::Schema> schema4_p(
158+
catalog::Schema::CopySchema(&schema1, subset));
146159
LOG_INFO("%s", schema4_p->GetInfo().c_str());
147160

148161
EXPECT_NE((*schema4_p), (*schema3_p));
@@ -153,7 +166,8 @@ TEST_F(TupleSchemaTests, TupleSchemaCopyTest) {
153166

154167
subset = {0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 2, 1};
155168

156-
std::unique_ptr<catalog::Schema> schema5_p(catalog::Schema::CopySchema(&schema1, subset));
169+
std::unique_ptr<catalog::Schema> schema5_p(
170+
catalog::Schema::CopySchema(&schema1, subset));
157171
LOG_INFO("%s", schema5_p->GetInfo().c_str());
158172

159173
EXPECT_EQ(schema5_p->GetColumnCount(), subset.size());

test/codegen/block_nested_loop_join_translator_test.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,10 @@ void BlockNestedLoopJoinTranslatorTest::PerformTest(
6464
const std::vector<oid_t> &right_join_cols,
6565
std::vector<codegen::WrappedTuple> &results) {
6666
// Output all columns
67-
DirectMapList direct_map_list = {{0, std::make_pair(0, 0)},
68-
{1, std::make_pair(0, 1)},
69-
{2, std::make_pair(0, 2)},
70-
{3, std::make_pair(1, 0)},
71-
{4, std::make_pair(1, 1)},
72-
{5, std::make_pair(1, 2)}};
67+
DirectMapList direct_map_list = {
68+
{0, std::make_pair(0, 0)}, {1, std::make_pair(0, 1)},
69+
{2, std::make_pair(0, 2)}, {3, std::make_pair(1, 0)},
70+
{4, std::make_pair(1, 1)}, {5, std::make_pair(1, 2)}};
7371
std::unique_ptr<planner::ProjectInfo> projection{
7472
new planner::ProjectInfo(TargetList{}, std::move(direct_map_list))};
7573

test/codegen/bloom_filter_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ TEST_F(BloomFilterCodegenTests, FalsePositiveRateTest) {
167167

168168
ASSERT_TRUE(code_context.Compile());
169169

170-
typedef void (*ftype)(codegen::util::BloomFilter * bloom_filter, int *, int,
170+
typedef void (*ftype)(codegen::util::BloomFilter *bloom_filter, int *, int,
171171
int *);
172172
ftype f = (ftype)code_context.GetRawFunctionPointer(func.GetFunction());
173173

test/codegen/case_translator_test.cpp

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,17 @@ TEST_F(CaseTranslatorTests, SimpleCaseTest) {
8989
const auto &results = buffer.GetOutputTuples();
9090
EXPECT_EQ(NumRowsInTestTable(), results.size());
9191
EXPECT_TRUE(results[0].GetValue(0).CompareEquals(
92-
type::ValueFactory::GetBigIntValue(0)) ==
93-
CmpBool::CmpTrue);
92+
type::ValueFactory::GetBigIntValue(0)) == CmpBool::CmpTrue);
9493
EXPECT_TRUE(results[0].GetValue(1).CompareEquals(
95-
type::ValueFactory::GetBigIntValue(0)) ==
96-
CmpBool::CmpTrue);
94+
type::ValueFactory::GetBigIntValue(0)) == CmpBool::CmpTrue);
9795
EXPECT_TRUE(results[1].GetValue(0).CompareEquals(
98-
type::ValueFactory::GetBigIntValue(10)) ==
99-
CmpBool::CmpTrue);
96+
type::ValueFactory::GetBigIntValue(10)) == CmpBool::CmpTrue);
10097
EXPECT_TRUE(results[1].GetValue(1).CompareEquals(
101-
type::ValueFactory::GetBigIntValue(1)) ==
102-
CmpBool::CmpTrue);
98+
type::ValueFactory::GetBigIntValue(1)) == CmpBool::CmpTrue);
10399

104100
for (uint32_t i = 2; i < NumRowsInTestTable(); i++) {
105101
EXPECT_TRUE(results[i].GetValue(1).CompareEquals(
106-
type::ValueFactory::GetBigIntValue(0)) ==
107-
CmpBool::CmpTrue);
102+
type::ValueFactory::GetBigIntValue(0)) == CmpBool::CmpTrue);
108103
}
109104
}
110105

@@ -159,23 +154,17 @@ TEST_F(CaseTranslatorTests, SimpleCaseMoreWhenTest) {
159154
const auto &results = buffer.GetOutputTuples();
160155
EXPECT_EQ(NumRowsInTestTable(), results.size());
161156
EXPECT_TRUE(results[0].GetValue(0).CompareEquals(
162-
type::ValueFactory::GetBigIntValue(0)) ==
163-
CmpBool::CmpTrue);
157+
type::ValueFactory::GetBigIntValue(0)) == CmpBool::CmpTrue);
164158
EXPECT_TRUE(results[0].GetValue(1).CompareEquals(
165-
type::ValueFactory::GetBigIntValue(0)) ==
166-
CmpBool::CmpTrue);
159+
type::ValueFactory::GetBigIntValue(0)) == CmpBool::CmpTrue);
167160
EXPECT_TRUE(results[1].GetValue(0).CompareEquals(
168-
type::ValueFactory::GetBigIntValue(10)) ==
169-
CmpBool::CmpTrue);
161+
type::ValueFactory::GetBigIntValue(10)) == CmpBool::CmpTrue);
170162
EXPECT_TRUE(results[1].GetValue(1).CompareEquals(
171-
type::ValueFactory::GetBigIntValue(1)) ==
172-
CmpBool::CmpTrue);
163+
type::ValueFactory::GetBigIntValue(1)) == CmpBool::CmpTrue);
173164
EXPECT_TRUE(results[2].GetValue(0).CompareEquals(
174-
type::ValueFactory::GetBigIntValue(20)) ==
175-
CmpBool::CmpTrue);
165+
type::ValueFactory::GetBigIntValue(20)) == CmpBool::CmpTrue);
176166
EXPECT_TRUE(results[2].GetValue(1).CompareEquals(
177-
type::ValueFactory::GetBigIntValue(2)) ==
178-
CmpBool::CmpTrue);
167+
type::ValueFactory::GetBigIntValue(2)) == CmpBool::CmpTrue);
179168
}
180169

181170
} // namespace test

test/codegen/function_builder_test.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ TEST_F(FunctionBuilderTests, ConstructSingleFunctionTest) {
3131
codegen::CodeContext code_context;
3232
codegen::CodeGen cg{code_context};
3333
codegen::FunctionBuilder func{code_context, "test", cg.Int32Type(), {}};
34-
{
35-
func.ReturnAndFinish(cg.Const32(magic_num));
36-
}
34+
{ func.ReturnAndFinish(cg.Const32(magic_num)); }
3735

3836
ASSERT_TRUE(code_context.Compile());
3937

4038
typedef int (*func_t)(void);
41-
func_t fn = (func_t) code_context.GetRawFunctionPointer(func.GetFunction());
39+
func_t fn = (func_t)code_context.GetRawFunctionPointer(func.GetFunction());
4240
ASSERT_EQ(fn(), magic_num);
4341
}
4442

@@ -83,7 +81,7 @@ TEST_F(FunctionBuilderTests, ConstructNestedFunctionTest) {
8381
ASSERT_TRUE(code_context.Compile());
8482

8583
typedef int (*func_t)(uint32_t);
86-
func_t fn = (func_t) code_context.GetRawFunctionPointer(main.GetFunction());
84+
func_t fn = (func_t)code_context.GetRawFunctionPointer(main.GetFunction());
8785
ASSERT_EQ(fn(1), 44);
8886
}
8987

test/codegen/group_by_translator_test.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ TEST_F(GroupByTranslatorTests, SingleColumnGroupingTest) {
9090
// Each group should have a count of one (since the grouping column is unique)
9191
type::Value const_one = type::ValueFactory::GetIntegerValue(1);
9292
for (const auto &tuple : results) {
93-
EXPECT_TRUE(tuple.GetValue(1).CompareEquals(const_one) ==
94-
CmpBool::CmpTrue);
93+
EXPECT_TRUE(tuple.GetValue(1).CompareEquals(const_one) == CmpBool::CmpTrue);
9594
}
9695
}
9796

@@ -239,9 +238,8 @@ TEST_F(GroupByTranslatorTests, AggregationWithOutputPredicateTest) {
239238
new expression::TupleValueExpression(type::TypeId::DECIMAL, 0, 1);
240239
auto *const_50 = new expression::ConstantValueExpression(
241240
type::ValueFactory::GetDecimalValue(50.0));
242-
ExpressionPtr x_gt_50{
243-
new expression::ComparisonExpression(ExpressionType::COMPARE_GREATERTHAN,
244-
x_exp, const_50)};
241+
ExpressionPtr x_gt_50{new expression::ComparisonExpression(
242+
ExpressionType::COMPARE_GREATERTHAN, x_exp, const_50)};
245243

246244
// 6) Finally, the aggregation node
247245
std::unique_ptr<planner::AbstractPlan> agg_plan{new planner::AggregatePlan(
@@ -380,8 +378,7 @@ TEST_F(GroupByTranslatorTests, SingleCountStarTest) {
380378
const auto &results = buffer.GetOutputTuples();
381379
EXPECT_EQ(1, results.size());
382380
EXPECT_TRUE(results[0].GetValue(0).CompareEquals(
383-
type::ValueFactory::GetBigIntValue(10)) ==
384-
CmpBool::CmpTrue);
381+
type::ValueFactory::GetBigIntValue(10)) == CmpBool::CmpTrue);
385382
}
386383

387384
TEST_F(GroupByTranslatorTests, MinAndMaxTest) {
@@ -445,14 +442,12 @@ TEST_F(GroupByTranslatorTests, MinAndMaxTest) {
445442
// maximum row ID is equal to # inserted - 1. Therefore:
446443
// MAX(a) = (# inserted - 1) * 10 = (10 - 1) * 10 = 9 * 10 = 90
447444
EXPECT_TRUE(results[0].GetValue(0).CompareEquals(
448-
type::ValueFactory::GetBigIntValue(90)) ==
449-
CmpBool::CmpTrue);
445+
type::ValueFactory::GetBigIntValue(90)) == CmpBool::CmpTrue);
450446

451447
// The values of 'b' are equal to the (zero-indexed) row ID * 10 + 1. The
452448
// minimum row ID is 0. Therefore: MIN(b) = 0 * 10 + 1 = 1
453449
EXPECT_TRUE(results[0].GetValue(1).CompareEquals(
454-
type::ValueFactory::GetBigIntValue(1)) ==
455-
CmpBool::CmpTrue);
450+
type::ValueFactory::GetBigIntValue(1)) == CmpBool::CmpTrue);
456451
}
457452

458453
} // namespace test

0 commit comments

Comments
 (0)