Skip to content

Commit

Permalink
Small speedup tpcds generator (#10424)
Browse files Browse the repository at this point in the history
  • Loading branch information
iddqdex authored Oct 15, 2024
1 parent d14474e commit 6bd8708
Show file tree
Hide file tree
Showing 44 changed files with 109 additions and 68 deletions.
49 changes: 24 additions & 25 deletions ydb/library/workload/tpcds/data_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,35 +135,34 @@ TTpcdsWorkloadDataInitializerGenerator::TBulkDataGenerator::TDataPortions TTpcds
ctxs.emplace_back(*this, tdef->nParam);
}

with_lock(Lock) {
ds_key_t firstRow;
ds_key_t rowCount;
split_work(TableNum, &firstRow, &rowCount);
if (!Generated) {
ui32 toSkip = firstRow - 1;
if (!!Owner.StateProcessor && Owner.StateProcessor->GetState().contains(GetName())) {
Generated = Owner.StateProcessor->GetState().at(TString(GetName())).Position;
toSkip += Generated;
}
if (toSkip) {
row_skip(TableNum, toSkip);
if (tdef->flags & FL_PARENT) {
row_skip(tdef->nParam, toSkip);
}
}
if (tdef->flags & FL_SMALL) {
resetCountCount();
auto g = Guard(Lock);
ds_key_t firstRow;
ds_key_t rowCount;
split_work(TableNum, &firstRow, &rowCount);
if (!Generated) {
ui32 toSkip = firstRow - 1;
if (!!Owner.StateProcessor && Owner.StateProcessor->GetState().contains(GetName())) {
Generated = Owner.StateProcessor->GetState().at(TString(GetName())).Position;
toSkip += Generated;
}
if (toSkip) {
row_skip(TableNum, toSkip);
if (tdef->flags & FL_PARENT) {
row_skip(tdef->nParam, toSkip);
}
}
const auto count = TableSize > Generated ? std::min(ui64(TableSize - Generated), Owner.Params.BulkSize) : 0;
if (!count) {
return result;
if (tdef->flags & FL_SMALL) {
resetCountCount();
}
ctxs.front().SetCount(count);
ctxs.front().SetStart(firstRow + Generated);
Generated += count;
GenerateRows(ctxs);
}
const auto count = TableSize > Generated ? std::min(ui64(TableSize - Generated), Owner.Params.BulkSize) : 0;
if (!count) {
return result;
}
ctxs.front().SetCount(count);
ctxs.front().SetStart(firstRow + Generated);
Generated += count;
GenerateRows(ctxs, std::move(g));
for(auto& ctx: ctxs) {
ctx.AppendPortions(result);
}
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/data_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TTpcdsWorkloadDataInitializerGenerator: public TWorkloadDataInitializerBas

using TContexts = TVector<TContext>;

virtual void GenerateRows(TContexts& ctxs) = 0;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) = 0;

int TableNum;
ui64 Generated = 0;
Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_call_center.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ TTpcDSGeneratorCallCenter::TTpcDSGeneratorCallCenter(const TTpcdsWorkloadDataIni
: TBulkDataGenerator(owner, CALL_CENTER)
{}

void TTpcDSGeneratorCallCenter::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorCallCenter::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<CALL_CENTER_TBL> callCenterList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_call_center(NULL, ctxs.front().GetStart() + i);
callCenterList[i] = g_w_call_center;
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<CALL_CENTER_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, cc_call_center_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_STRING(writer, cc_call_center_id);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_call_center.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorCallCenter : public TTpcdsWorkloadDataInitializerGenerator:
explicit TTpcDSGeneratorCallCenter(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorCallCenter> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_catalog_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ TTpcDSGeneratorCatalogPage::TTpcDSGeneratorCatalogPage(const TTpcdsWorkloadDataI
: TBulkDataGenerator(owner, CATALOG_PAGE)
{}

void TTpcDSGeneratorCatalogPage::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorCatalogPage::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<CATALOG_PAGE_TBL> catalogPageList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_catalog_page(NULL, ctxs.front().GetStart() + i);
catalogPageList[i] = g_w_catalog_page;
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<CATALOG_PAGE_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, cp_catalog_page_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_STRING(writer, cp_catalog_page_id);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_catalog_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorCatalogPage : public TTpcdsWorkloadDataInitializerGenerator
explicit TTpcDSGeneratorCatalogPage(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorCatalogPage> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_catalog_sales.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ TTpcDSGeneratorCatalogSales::TTpcDSGeneratorCatalogSales(const TTpcdsWorkloadDat
: TBulkDataGenerator(owner, CATALOG_SALES)
{}

void TTpcDSGeneratorCatalogSales::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorCatalogSales::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_CATALOG_SALES_TBL> catalogSalesList;
TVector<W_CATALOG_RETURNS_TBL> catalogReturnsList;
catalogReturnsList.reserve(ctxs.front().GetCount() * 14);
Expand All @@ -115,6 +115,8 @@ void TTpcDSGeneratorCatalogSales::GenerateRows(TContexts& ctxs) {
}
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_CATALOG_SALES_TBL> writerSales(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_FIELD(writerSales, "cs_item_sk", cs_sold_item_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writerSales, cs_order_number);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_catalog_sales.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorCatalogSales : public TTpcdsWorkloadDataInitializerGenerato
explicit TTpcDSGeneratorCatalogSales(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorCatalogSales> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_customer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ TTpcDSGeneratorCustomer::TTpcDSGeneratorCustomer(const TTpcdsWorkloadDataInitial
: TBulkDataGenerator(owner, CUSTOMER)
{}

void TTpcDSGeneratorCustomer::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorCustomer::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_CUSTOMER_TBL> customerList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_customer(&customerList[i], ctxs.front().GetStart() + i);
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_CUSTOMER_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, c_customer_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_STRING(writer, c_customer_id);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_customer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorCustomer : public TTpcdsWorkloadDataInitializerGenerator::T
explicit TTpcDSGeneratorCustomer(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorCustomer> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_customer_address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ TTpcDSGeneratorCustomerAddress::TTpcDSGeneratorCustomerAddress(const TTpcdsWorkl
: TBulkDataGenerator(owner, CUSTOMER_ADDRESS)
{}

void TTpcDSGeneratorCustomerAddress::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorCustomerAddress::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_CUSTOMER_ADDRESS_TBL> customerAddressList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_customer_address(&customerAddressList[i], ctxs.front().GetStart() + i);
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_CUSTOMER_ADDRESS_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_FIELD_KEY(writer, "ca_address_sk", ca_addr_sk);
CSV_WRITER_REGISTER_FIELD_STRING(writer, "ca_address_id", ca_addr_id);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_customer_address.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorCustomerAddress : public TTpcdsWorkloadDataInitializerGener
explicit TTpcDSGeneratorCustomerAddress(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorCustomerAddress> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_customer_demographics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ TTpcDSGeneratorCustomerDemographics::TTpcDSGeneratorCustomerDemographics(const T
: TBulkDataGenerator(owner, CUSTOMER_DEMOGRAPHICS)
{}

void TTpcDSGeneratorCustomerDemographics::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorCustomerDemographics::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_CUSTOMER_DEMOGRAPHICS_TBL> customerDemoList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_customer_demographics(&customerDemoList[i], ctxs.front().GetStart() + i);
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_CUSTOMER_DEMOGRAPHICS_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, cd_demo_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_STRING(writer, cd_gender);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_customer_demographics.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorCustomerDemographics : public TTpcdsWorkloadDataInitializer
explicit TTpcDSGeneratorCustomerDemographics(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorCustomerDemographics> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_date_dim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ TTpcDSGeneratorDateDim::TTpcDSGeneratorDateDim(const TTpcdsWorkloadDataInitializ
: TBulkDataGenerator(owner, DATE)
{}

void TTpcDSGeneratorDateDim::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorDateDim::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_DATE_TBL> dateList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_date(NULL, ctxs.front().GetStart() + i);
dateList[i] = g_w_date;
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_DATE_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, d_date_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_STRING(writer, d_date_id);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_date_dim.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorDateDim : public TTpcdsWorkloadDataInitializerGenerator::TB
explicit TTpcDSGeneratorDateDim(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorDateDim> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_household_demographics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ TTpcDSGeneratorHouseholdDemographics::TTpcDSGeneratorHouseholdDemographics(const
: TBulkDataGenerator(owner, HOUSEHOLD_DEMOGRAPHICS)
{}

void TTpcDSGeneratorHouseholdDemographics::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorHouseholdDemographics::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_HOUSEHOLD_DEMOGRAPHICS_TBL> hhDemoList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_household_demographics(&hhDemoList[i], ctxs.front().GetStart() + i);
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_HOUSEHOLD_DEMOGRAPHICS_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, hd_demo_sk);
CSV_WRITER_REGISTER_FIELD_KEY(writer, "hd_income_band_sk", hd_income_band_id);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_household_demographics.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorHouseholdDemographics : public TTpcdsWorkloadDataInitialize
explicit TTpcDSGeneratorHouseholdDemographics(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorHouseholdDemographics> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_income_band.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ TTpcDSGeneratorIncomeBand::TTpcDSGeneratorIncomeBand(const TTpcdsWorkloadDataIni
: TBulkDataGenerator(owner, INCOME_BAND)
{}

void TTpcDSGeneratorIncomeBand::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorIncomeBand::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_INCOME_BAND_TBL> incomingBandList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_income_band(&incomingBandList[i], ctxs.front().GetStart() + i);
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_INCOME_BAND_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_FIELD(writer, "ib_income_band_sk", ib_income_band_id);
CSV_WRITER_REGISTER_SIMPLE_FIELD(writer, ib_lower_bound);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_income_band.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorIncomeBand : public TTpcdsWorkloadDataInitializerGenerator:
explicit TTpcDSGeneratorIncomeBand(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorIncomeBand> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ TTpcDSGeneratorInventory::TTpcDSGeneratorInventory(const TTpcdsWorkloadDataIniti
: TBulkDataGenerator(owner, INVENTORY)
{}

void TTpcDSGeneratorInventory::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorInventory::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_INVENTORY_TBL> inventoryList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_inventory(NULL, ctxs.front().GetStart() + i);
inventoryList[i] = g_w_inventory;
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_INVENTORY_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, inv_date_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, inv_item_sk);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorInventory : public TTpcdsWorkloadDataInitializerGenerator::
explicit TTpcDSGeneratorInventory(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorInventory> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ TTpcDSGeneratorItem::TTpcDSGeneratorItem(const TTpcdsWorkloadDataInitializerGene
: TBulkDataGenerator(owner, ITEM)
{}

void TTpcDSGeneratorItem::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorItem::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_ITEM_TBL> itemList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_item(&itemList[i], ctxs.front().GetStart() + i);
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_ITEM_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, i_item_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_STRING(writer, i_item_id);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorItem : public TTpcdsWorkloadDataInitializerGenerator::TBulk
explicit TTpcDSGeneratorItem(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorItem> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_promotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ TTpcDSGeneratorPromotion::TTpcDSGeneratorPromotion(const TTpcdsWorkloadDataIniti
: TBulkDataGenerator(owner, PROMOTION)
{}

void TTpcDSGeneratorPromotion::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorPromotion::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_PROMOTION_TBL> promotionList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_promotion(NULL, ctxs.front().GetStart() + i);
promotionList[i] = g_w_promotion;
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_PROMOTION_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, p_promo_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_STRING(writer, p_promo_id);
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/workload/tpcds/dg_promotion.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TTpcDSGeneratorPromotion : public TTpcdsWorkloadDataInitializerGenerator::
explicit TTpcDSGeneratorPromotion(const TTpcdsWorkloadDataInitializerGenerator& owner);

protected:
virtual void GenerateRows(TContexts& ctxs) override;
virtual void GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) override;
static const TFactory::TRegistrator<TTpcDSGeneratorPromotion> Registrar;
};

Expand Down
4 changes: 3 additions & 1 deletion ydb/library/workload/tpcds/dg_reason.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ TTpcDSGeneratorReason::TTpcDSGeneratorReason(const TTpcdsWorkloadDataInitializer
: TBulkDataGenerator(owner, REASON)
{}

void TTpcDSGeneratorReason::GenerateRows(TContexts& ctxs) {
void TTpcDSGeneratorReason::GenerateRows(TContexts& ctxs, TGuard<TAdaptiveLock>&& g) {
TVector<W_REASON_TBL> reasonList(ctxs.front().GetCount());
for (ui64 i = 0; i < ctxs.front().GetCount(); ++i) {
mk_w_reason(NULL, ctxs.front().GetStart() + i);
reasonList[i] = g_w_reason;
tpcds_row_stop(TableNum);
}
g.Release();

TCsvItemWriter<W_REASON_TBL> writer(ctxs.front().GetCsv().Out);
CSV_WRITER_REGISTER_SIMPLE_FIELD_KEY(writer, r_reason_sk);
CSV_WRITER_REGISTER_SIMPLE_FIELD_STRING(writer, r_reason_id);
Expand Down
Loading

0 comments on commit 6bd8708

Please sign in to comment.