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

Commit 3451aef

Browse files
authored
Merge pull request #1252 from zhaoguoquan94/new_standardize_macro
Standardize macro names. PL_* -> PELOTON_*.
2 parents 28c1eb0 + b9b54a4 commit 3451aef

File tree

271 files changed

+1506
-1506
lines changed

Some content is hidden

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

271 files changed

+1506
-1506
lines changed

script/coding_style.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Another measure of the function is the number of local variables. They shouldn'
2121

2222
**PRINTF** Refrain from using `printf` and `std::cout`. Instead use the logging macros, such as LOG_LEVEL_INFO, in `common/logger.h`.
2323

24-
**DON'T REINVENT THE MACROS** Use `PL_ASSERT` in `common/macros.h` instead of regular `assert`. This header file icontains a number of macros that you should use, rather than explicitly coding some variant of them yourself.
24+
**DON'T REINVENT THE MACROS** Use `PELOTON_ASSERT` in `common/macros.h` instead of regular `assert`. This header file icontains a number of macros that you should use, rather than explicitly coding some variant of them yourself.
2525

2626
**PLAFORM-SPECIFIC CODE** Add platform-specific code only to `common/platform.h`.
2727

@@ -53,7 +53,7 @@ The example above illustrates a valid use of the `inline` keyword for the defini
5353
5454
**EDITOR MODELINES** Some editors can interpret configuration information embedded in source files, indicated with special markers. For example, emacs interprets lines marked like this: -*- mode: c -*-. Do NOT include any of these in source files. People have their own personal editor configurations, and your source files should not override them.
5555
56-
**ALLOCATING MEMORY** Use `PL_MEMCPY` macro in `common/macros.h`. Always use smart pointers, such as `std::unique_ptr`, to simplify memory management.
56+
**ALLOCATING MEMORY** Use `PELOTON_MEMCPY` macro in `common/macros.h`. Always use smart pointers, such as `std::unique_ptr`, to simplify memory management.
5757
5858
**PRINTING PELOTON MESSAGES** Peloton developers like to be seen as literate. Do mind the spelling of messages to make a good impression. Do not use crippled words like "dont"; use "do not" or "don't" instead. Make the messages concise, clear, and unambiguous. Use appropriate log levels, such as LOG_LEVEL_TRACE, in `common/logger.h`. Coming up with good debugging messages can be quite a challenge; and once you have them, they can be a huge help for troubleshooting.
5959

src/binder/bind_node_visitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void BindNodeVisitor::Visit(expression::TupleValueExpression *expr) {
233233
context_, table_name, col_name, value_type, depth))
234234
throw Exception("Invalid table reference " + expr->GetTableName());
235235
}
236-
PL_ASSERT(!expr->GetIsBound());
236+
PELOTON_ASSERT(!expr->GetIsBound());
237237
expr->SetDepth(depth);
238238
expr->SetColName(col_name);
239239
expr->SetValueType(value_type);

src/brain/cluster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void Cluster::UpdateCentroid(
3939
std::map<std::string, std::vector<double>> &features) {
4040
int num_features = centroid_.size();
4141
std::fill(centroid_.begin(), centroid_.end(), 0);
42-
PL_ASSERT(templates_.size() != 0);
42+
PELOTON_ASSERT(templates_.size() != 0);
4343

4444
for (auto fingerprint : templates_) {
4545
auto feature = features[fingerprint];

src/brain/tf_session_entity/tf_session_entity.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void TFSE_TYPE::ImportGraph(const std::string &filename) {
5656
TF_GraphImportGraphDef(graph_, graph_def, opts, status_);
5757
TF_DeleteImportGraphDefOptions(opts);
5858
TF_DeleteBuffer(graph_def);
59-
PL_ASSERT(IsStatusOk());
59+
PELOTON_ASSERT(IsStatusOk());
6060
}
6161

6262
TFSE_TEMPLATE_ARGUMENTS
@@ -118,7 +118,7 @@ OutputType *TFSE_TYPE::Eval(
118118
&(outs.at(0)), &(out_vals.at(0)), outs.size(), // Outputs
119119
nullptr, 0, // Operations
120120
nullptr, status_);
121-
PL_ASSERT(TF_GetCode(status_) == TF_OK);
121+
PELOTON_ASSERT(TF_GetCode(status_) == TF_OK);
122122
return static_cast<OutputType *>(TF_TensorData(out_vals.at(0)));
123123
}
124124

@@ -140,7 +140,7 @@ void TFSE_TYPE::Eval(const std::vector<TfSessionEntityInput<InputType>>& helper_
140140
nullptr, nullptr, 0, // Outputs
141141
&op, 1, // Operations
142142
nullptr, status_);
143-
PL_ASSERT(TF_GetCode(status_) == TF_OK);
143+
PELOTON_ASSERT(TF_GetCode(status_) == TF_OK);
144144
}
145145

146146
/*

src/brain/tf_session_entity/tf_session_entity_input.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ TFSEIN_TYPE::TfSessionEntityInput(const InputType& input, const std::string &op)
2222
this->tensor_ =
2323
TF_AllocateTensor(this->data_type_, nullptr, 0, sizeof(InputType));
2424
auto buff = (InputType *)TF_TensorData(this->tensor_);
25-
PL_MEMCPY(buff, &input_for_tf, sizeof(InputType));
25+
PELOTON_MEMCPY(buff, &input_for_tf, sizeof(InputType));
2626
}
2727

2828
// 1d vector
@@ -36,7 +36,7 @@ TFSEIN_TYPE::TfSessionEntityInput(const std::vector<InputType> &input,
3636
this->tensor_ =
3737
TF_AllocateTensor(this->data_type_, dims, 1, dims[0] * sizeof(InputType));
3838
auto buff = (InputType *)TF_TensorData(this->tensor_);
39-
PL_MEMCPY(buff, input_for_tf, dims[0] * sizeof(InputType));
39+
PELOTON_MEMCPY(buff, input_for_tf, dims[0] * sizeof(InputType));
4040
}
4141

4242
// 2d vector
@@ -51,7 +51,7 @@ TFSEIN_TYPE::TfSessionEntityInput(const std::vector<std::vector<InputType>>& inp
5151
this->tensor_ = TF_AllocateTensor(this->data_type_, dims, 2,
5252
dims[0] * dims[1] * sizeof(InputType));
5353
auto buff = (InputType *)TF_TensorData(this->tensor_);
54-
PL_MEMCPY(buff, input_for_tf, dims[0] * dims[1] * sizeof(InputType));
54+
PELOTON_MEMCPY(buff, input_for_tf, dims[0] * dims[1] * sizeof(InputType));
5555
}
5656

5757
// raw flattened input
@@ -68,7 +68,7 @@ TFSEIN_TYPE::TfSessionEntityInput(InputType *input, const std::vector<int64_t>&
6868
this->tensor_ = TF_AllocateTensor(this->data_type_, dims.data(), dims.size(),
6969
num_elems * sizeof(InputType));
7070
auto buff = (InputType *)TF_TensorData(this->tensor_);
71-
PL_MEMCPY(buff, input_for_tf, num_elems * sizeof(InputType));
71+
PELOTON_MEMCPY(buff, input_for_tf, num_elems * sizeof(InputType));
7272
}
7373

7474
// Flattens 2d inputs

src/catalog/abstract_catalog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ bool AbstractCatalog::DeleteWithIndexScan(
125125
// Index scan as child node
126126
std::vector<oid_t> column_offsets; // No projection
127127
auto index = catalog_table_->GetIndex(index_offset);
128-
PL_ASSERT(index != nullptr);
128+
PELOTON_ASSERT(index != nullptr);
129129
std::vector<oid_t> key_column_offsets =
130130
index->GetMetadata()->GetKeySchema()->GetIndexedColumns();
131-
PL_ASSERT(values.size() == key_column_offsets.size());
131+
PELOTON_ASSERT(values.size() == key_column_offsets.size());
132132
std::vector<ExpressionType> expr_types(values.size(),
133133
ExpressionType::COMPARE_EQUAL);
134134
std::vector<expression::AbstractExpression *> runtime_keys;
@@ -173,7 +173,7 @@ AbstractCatalog::GetResultWithIndexScan(
173173
auto index = catalog_table_->GetIndex(index_offset);
174174
std::vector<oid_t> key_column_offsets =
175175
index->GetMetadata()->GetKeySchema()->GetIndexedColumns();
176-
PL_ASSERT(values.size() == key_column_offsets.size());
176+
PELOTON_ASSERT(values.size() == key_column_offsets.size());
177177
std::vector<ExpressionType> expr_types(values.size(),
178178
ExpressionType::COMPARE_EQUAL);
179179
std::vector<expression::AbstractExpression *> runtime_keys;

src/catalog/catalog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ ResultType Catalog::DropIndex(const std::string &index_name,
639639
storage::Database *Catalog::GetDatabaseWithName(
640640
const std::string &database_name,
641641
concurrency::TransactionContext *txn) const {
642-
PL_ASSERT(txn != nullptr);
642+
PELOTON_ASSERT(txn != nullptr);
643643

644644
// Check in pg_database using txn
645645
auto database_object =
@@ -660,7 +660,7 @@ storage::Database *Catalog::GetDatabaseWithName(
660660
storage::DataTable *Catalog::GetTableWithName(
661661
const std::string &database_name, const std::string &table_name,
662662
concurrency::TransactionContext *txn) {
663-
PL_ASSERT(txn != nullptr);
663+
PELOTON_ASSERT(txn != nullptr);
664664

665665
LOG_TRACE("Looking for table %s in database %s", table_name.c_str(),
666666
database_name.c_str());

src/catalog/catalog_cache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ bool CatalogCache::EvictDatabaseObject(oid_t database_oid) {
6262
}
6363

6464
auto database_object = it->second;
65-
PL_ASSERT(database_object);
65+
PELOTON_ASSERT(database_object);
6666
database_objects_cache.erase(it);
6767
database_name_cache.erase(database_object->GetDatabaseName());
6868
return true;
@@ -79,7 +79,7 @@ bool CatalogCache::EvictDatabaseObject(const std::string &database_name) {
7979
}
8080

8181
auto database_object = it->second;
82-
PL_ASSERT(database_object);
82+
PELOTON_ASSERT(database_object);
8383
database_name_cache.erase(it);
8484
database_objects_cache.erase(database_object->GetDatabaseOid());
8585
return true;

src/catalog/column_catalog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ ColumnCatalog::GetColumnObjects(oid_t table_oid,
226226
// try get from cache
227227
auto table_object =
228228
TableCatalog::GetInstance()->GetTableObject(table_oid, txn);
229-
PL_ASSERT(table_object && table_object->GetTableOid() == table_oid);
229+
PELOTON_ASSERT(table_object && table_object->GetTableOid() == table_oid);
230230
auto column_objects = table_object->GetColumnObjects(true);
231231
if (column_objects.size() != 0) return column_objects;
232232

src/catalog/column_stats_catalog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ std::unique_ptr<std::vector<type::Value>> ColumnStatsCatalog::GetColumnStats(
140140
auto result_tiles =
141141
GetResultWithIndexScan(column_ids, index_offset, values, txn);
142142

143-
PL_ASSERT(result_tiles->size() <= 1); // unique
143+
PELOTON_ASSERT(result_tiles->size() <= 1); // unique
144144
if (result_tiles->size() == 0) {
145145
return nullptr;
146146
}
147147

148148
auto tile = (*result_tiles)[0].get();
149-
PL_ASSERT(tile->GetTupleCount() <= 1);
149+
PELOTON_ASSERT(tile->GetTupleCount() <= 1);
150150
if (tile->GetTupleCount() == 0) {
151151
return nullptr;
152152
}
@@ -190,7 +190,7 @@ size_t ColumnStatsCatalog::GetTableStats(
190190
auto result_tiles =
191191
GetResultWithIndexScan(column_ids, index_offset, values, txn);
192192

193-
PL_ASSERT(result_tiles->size() <= 1); // unique
193+
PELOTON_ASSERT(result_tiles->size() <= 1); // unique
194194
if (result_tiles->size() == 0) {
195195
return 0;
196196
}

0 commit comments

Comments
 (0)