should be it
This commit is contained in:
242
external/duckdb/third_party/tpce-tool/include/main/AddressTable.h
vendored
Normal file
242
external/duckdb/third_party/tpce-tool/include/main/AddressTable.h
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Contains class definition to generate Address table.
|
||||
* Address table contains addresses for exchanges, companies, and customers.
|
||||
*/
|
||||
#ifndef ADDRESS_TABLE_H
|
||||
#define ADDRESS_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CAddressTable : public TableTemplate<ADDRESS_ROW> {
|
||||
private:
|
||||
CDateTime m_date_time;
|
||||
const CCompanyFile &m_companies;
|
||||
const StreetNameDataFile_t &m_Street;
|
||||
const StreetSuffixDataFile_t &m_StreetSuffix;
|
||||
const ZipCodeDataFile_t &m_ZipCode;
|
||||
TIdent m_iStartFromCustomer;
|
||||
TIdent m_iCustomerCount; // total # of customers for whom to generate addresses
|
||||
bool m_bCustomerAddressesOnly; // whether generating only customer addresses
|
||||
bool m_bCustomerAddress; // whether the currently generated row is for a
|
||||
// customer
|
||||
TIdent m_iCompanyCount; // total # of companies for which to generate addresses
|
||||
UINT m_iExchangeCount; // total # of exchanges for which to generate
|
||||
// addresses
|
||||
TIdent m_iTotalAddressCount; // total # of address rows to generate
|
||||
bool m_bCacheEnabled;
|
||||
int m_iCacheSize;
|
||||
TIdent m_iCacheOffset;
|
||||
int *m_CacheZipCode;
|
||||
const int INVALID_CACHE_ENTRY;
|
||||
|
||||
/*
|
||||
* Generate AD_LINE_1 and store it in the record structure.
|
||||
* Does not increment the number of rows generated.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAD_LINE_1();
|
||||
/*
|
||||
* Generate AD_LINE_2 and store it in the record structure.
|
||||
* Does not increment the number of rows generated.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAD_LINE_2();
|
||||
/*
|
||||
* For a given address id returns the same Threshold used to
|
||||
* select the town, division, zip, and country.
|
||||
* Needed to return a specific division/country for a given address id
|
||||
* (for customer tax rates).
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN ADID - address id
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
int GetTownDivisionZipCodeThreshold(TIdent ADID);
|
||||
/*
|
||||
* Return the country code code for a given zip code.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szZipCode - string with a US or Canada zip code
|
||||
*
|
||||
* RETURNS:
|
||||
* country code.
|
||||
*/
|
||||
UINT GetCountryCode(const char *pZipCode);
|
||||
/*
|
||||
* Generate zip code and country for the current address id
|
||||
* and store them in the record structure.
|
||||
* Does not increment the number of rows generated.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAD_ZC_CODE_CTRY();
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor for the ADDRESS table class.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN dfm - input flat files loaded in memory
|
||||
* IN iCustomerCount - number of customers to generate
|
||||
* IN iStartFromCustomer - ordinal position of the first
|
||||
* customer in the sequence (Note: 1-based) for whom to generate the
|
||||
* addresses. Used if generating customer addresses only. IN
|
||||
* bCustomerAddressesOnly - if true, generate only customer addresses if
|
||||
* false, generate exchange, company, and customer addresses (always start
|
||||
* from the first customer in this case) RETURNS: not applicable.
|
||||
*/
|
||||
CAddressTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer,
|
||||
bool bCustomerAddressesOnly = false, bool bCacheEnabled = false);
|
||||
|
||||
/*
|
||||
* Destructor for the ADDRESS table class.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
~CAddressTable();
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit();
|
||||
|
||||
/*
|
||||
* Generates the next A_ID value.
|
||||
* It is stored in the internal record structure and also returned.
|
||||
* The number of rows generated is incremented. This is why
|
||||
* this function cannot be called more than once for a record.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* next address id.
|
||||
*/
|
||||
TIdent GenerateNextAD_ID();
|
||||
|
||||
/*
|
||||
* Returns the address id of the customer specified by the customer id.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN C_ID - customer id (1-based)
|
||||
*
|
||||
* RETURNS:
|
||||
* address id.
|
||||
*/
|
||||
TIdent GetAD_IDForCustomer(TIdent C_ID); // return address id for the customer id
|
||||
|
||||
/*
|
||||
* Return a certain division/country code (from the input file) for a
|
||||
* given address id. Used in the loader to properly calculate tax on a
|
||||
* trade.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN AD_ID - address id
|
||||
* OUT iDivCode - division (state/province) code
|
||||
* OUT iCtryCode - country (USA/CANADA) code
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GetDivisionAndCountryCodesForAddress(TIdent AD_ID, UINT &iDivCode, UINT &iCtryCode);
|
||||
|
||||
/*
|
||||
* Return division and country codes for current address.
|
||||
* Used in generating customer taxrates.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT iDivCode - division (state/province) code
|
||||
* OUT iCtryCode - country (USA/CANADA) code
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GetDivisionAndCountryCodes(UINT &iDivCode, UINT &iCtryCode) {
|
||||
GetDivisionAndCountryCodesForAddress(m_row.AD_ID, iDivCode, iCtryCode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate all column values for the next row
|
||||
* and store them in the record structure.
|
||||
* Increment the number of rows generated.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* TRUE, if there are more records in the ADDRESS table; FALSE
|
||||
* othewise.
|
||||
*/
|
||||
bool GenerateNextRecord(); // generates the next table row
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // ADDRESS_TABLE_H
|
||||
126
external/duckdb/third_party/tpce-tool/include/main/BaseLoader.h
vendored
Normal file
126
external/duckdb/third_party/tpce-tool/include/main/BaseLoader.h
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Base interface for all loader classes.
|
||||
*/
|
||||
|
||||
#ifndef BASE_LOADER_H
|
||||
#define BASE_LOADER_H
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
template <typename T> class CBaseLoader {
|
||||
|
||||
public:
|
||||
/*
|
||||
* Virtual destructor. Provided so that a sponsor-specific
|
||||
* destructor can be called on destruction from the base-class pointer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
virtual ~CBaseLoader(){};
|
||||
|
||||
/*
|
||||
* This function is provided to reset the loader to
|
||||
* a clean state. "Clean state" here means a sequence of
|
||||
* WriteNextRecord(), followed by Commit(), followed by FinishLoad()
|
||||
* can be called.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void Init(){}; // default implementation is empty
|
||||
|
||||
/*
|
||||
* Receive a new record to be loaded into the database.
|
||||
* This is the main function that is called
|
||||
* for every generated record.
|
||||
*
|
||||
* Note: the records are not guaranteed to actually be inserted
|
||||
* into the database after this call. It is Commit() that ensures that
|
||||
* all records received by WriteNextRecord are persisted in the database.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN next_record - a pointer to a structure, containing
|
||||
* the record
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void WriteNextRecord(const T &next_record) {
|
||||
printf("BaseLoader - const ref\n");
|
||||
};
|
||||
|
||||
/*
|
||||
* Commit any records that might have been kept in temporary
|
||||
* storage to the database. After this call, all records received
|
||||
* by WriteNextRecord should be present in the database.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void Commit(){}; // default implementation is empty
|
||||
|
||||
/*
|
||||
* Release any resources held for loading.
|
||||
* Also, commit any records that might have been kept in temporary
|
||||
* storage to the database.
|
||||
* This function is called once, after the last record has been loaded.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void FinishLoad() = 0; // must be defined in subclasses
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // #ifndef BASE_LOADER_H
|
||||
465
external/duckdb/third_party/tpce-tool/include/main/BaseLoaderFactory.h
vendored
Normal file
465
external/duckdb/third_party/tpce-tool/include/main/BaseLoaderFactory.h
vendored
Normal file
@@ -0,0 +1,465 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Base interface for a loader class factory.
|
||||
* This class instantiates particular table loader classs.
|
||||
*/
|
||||
|
||||
#ifndef BASE_LOADER_FACTORY_H
|
||||
#define BASE_LOADER_FACTORY_H
|
||||
|
||||
#include "BaseLoader.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CBaseLoaderFactory {
|
||||
|
||||
public:
|
||||
/*
|
||||
* Virtual destructor. Provided so that a sponsor-specific
|
||||
* destructor can be called on destruction from the base-class pointer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
virtual ~CBaseLoaderFactory(){};
|
||||
|
||||
/*
|
||||
* Create loader class for ACCOUNT_PERMISSION table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<ACCOUNT_PERMISSION_ROW> *CreateAccountPermissionLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for ADDRESS table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<ADDRESS_ROW> *CreateAddressLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for BROKER table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<BROKER_ROW> *CreateBrokerLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for CASH_TRANSACTION table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<CASH_TRANSACTION_ROW> *CreateCashTransactionLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for CHARGE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<CHARGE_ROW> *CreateChargeLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for COMMISSION_RATE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<COMMISSION_RATE_ROW> *CreateCommissionRateLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for COMPANY_COMPETITOR table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<COMPANY_COMPETITOR_ROW> *CreateCompanyCompetitorLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for COMPANY table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<COMPANY_ROW> *CreateCompanyLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for CUSTOMER_ACCOUNT table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<CUSTOMER_ACCOUNT_ROW> *CreateCustomerAccountLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for CUSTOMER table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<CUSTOMER_ROW> *CreateCustomerLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for CUSTOMER_TAXRATE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<CUSTOMER_TAXRATE_ROW> *CreateCustomerTaxrateLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for DAILY_MARKET table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<DAILY_MARKET_ROW> *CreateDailyMarketLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for EXCHANGE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<EXCHANGE_ROW> *CreateExchangeLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for FINANCIAL table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<FINANCIAL_ROW> *CreateFinancialLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for HOLDING table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<HOLDING_ROW> *CreateHoldingLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for HOLDING_HISTORY table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<HOLDING_HISTORY_ROW> *CreateHoldingHistoryLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for HOLDING_SUMMARY table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<HOLDING_SUMMARY_ROW> *CreateHoldingSummaryLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for INDUSTRY table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<INDUSTRY_ROW> *CreateIndustryLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for LAST_TRADE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<LAST_TRADE_ROW> *CreateLastTradeLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for NEWS_ITEM table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<NEWS_ITEM_ROW> *CreateNewsItemLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for NEWS_XREF table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<NEWS_XREF_ROW> *CreateNewsXRefLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for SECTOR table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<SECTOR_ROW> *CreateSectorLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for SECURITY table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<SECURITY_ROW> *CreateSecurityLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for SETTLEMENT table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<SETTLEMENT_ROW> *CreateSettlementLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for STATUS_TYPE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<STATUS_TYPE_ROW> *CreateStatusTypeLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for TAXRATE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<TAX_RATE_ROW> *CreateTaxRateLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for TRADE_HISTORY table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<TRADE_HISTORY_ROW> *CreateTradeHistoryLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for TRADE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<TRADE_ROW> *CreateTradeLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for TRADE_REQUEST table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<TRADE_REQUEST_ROW> *CreateTradeRequestLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for TRADE_TYPE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<TRADE_TYPE_ROW> *CreateTradeTypeLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for WATCH_ITEM table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<WATCH_ITEM_ROW> *CreateWatchItemLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for WATCH_LIST table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<WATCH_LIST_ROW> *CreateWatchListLoader() = 0;
|
||||
|
||||
/*
|
||||
* Create loader class for ZIP_CODE table.
|
||||
* Should be defined in a subclass according to the subclass load type.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* Reference to the loader class.
|
||||
*/
|
||||
virtual CBaseLoader<ZIP_CODE_ROW> *CreateZipCodeLoader() = 0;
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // #ifndef BASE_LOADER_FACTORY_H
|
||||
84
external/duckdb/third_party/tpce-tool/include/main/BaseLogFormatter.h
vendored
Normal file
84
external/duckdb/third_party/tpce-tool/include/main/BaseLogFormatter.h
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Matt Emmerton
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This file implements the interface for
|
||||
* formatting logger entries.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BASE_LOG_FORMATTER_H
|
||||
#define BASE_LOG_FORMATTER_H
|
||||
|
||||
#include <string>
|
||||
#include "DriverParamSettings.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
enum eLogFormat { eLogTab, eLogCustom };
|
||||
|
||||
class CBaseLogFormatter {
|
||||
public:
|
||||
/*
|
||||
* Virtual destructor. Provided so that a sponsor-specific
|
||||
* destructor can be called on destruction from the base-class pointer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
virtual ~CBaseLogFormatter(){};
|
||||
|
||||
virtual string GetLogOutput(CBrokerVolumeSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CCustomerPositionSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CMarketWatchSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CSecurityDetailSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CTradeLookupSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CTradeOrderSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CTradeUpdateSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CTxnMixGeneratorSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CLoaderSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CDriverGlobalSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CDriverCESettings &parms) = 0;
|
||||
virtual string GetLogOutput(CDriverCEPartitionSettings &parms) = 0;
|
||||
virtual string GetLogOutput(CDriverMEESettings &parms) = 0;
|
||||
virtual string GetLogOutput(CDriverDMSettings &parms) = 0;
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // BASE_LOG_FORMATTER_H
|
||||
94
external/duckdb/third_party/tpce-tool/include/main/BaseLogger.h
vendored
Normal file
94
external/duckdb/third_party/tpce-tool/include/main/BaseLogger.h
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Matt Emmerton
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This file implements the interface for data logging.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BASE_LOGGER_H
|
||||
#define BASE_LOGGER_H
|
||||
|
||||
#include "utilities/EGenStandardTypes.h"
|
||||
#include "DriverTypes.h"
|
||||
#include "DriverParamSettings.h"
|
||||
#include "BaseLogFormatter.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
/********************************* Generic Logger Class
|
||||
* ************************************/
|
||||
|
||||
class CBaseLogger {
|
||||
private:
|
||||
char m_Prefix[64];
|
||||
CBaseLogFormatter *m_pLogFormatter;
|
||||
|
||||
bool SendToLogger(const char *szPrefix, const char *szMsg);
|
||||
|
||||
protected:
|
||||
CBaseLogger(eDriverType drvType, INT32 UniqueId, CBaseLogFormatter *pFormatter);
|
||||
virtual bool SendToLoggerImpl(const char *szPrefix, const char *szTimestamp, const char *szMsg) = 0;
|
||||
|
||||
public:
|
||||
// Destructor
|
||||
virtual ~CBaseLogger() {
|
||||
}
|
||||
|
||||
// Strings
|
||||
bool SendToLogger(const char *str);
|
||||
bool SendToLogger(string str);
|
||||
|
||||
// Parameter Structures
|
||||
bool SendToLogger(CLoaderSettings &parms);
|
||||
bool SendToLogger(CDriverGlobalSettings &parms);
|
||||
bool SendToLogger(CDriverCESettings &parms);
|
||||
bool SendToLogger(CDriverCEPartitionSettings &parms);
|
||||
bool SendToLogger(CDriverMEESettings &parms);
|
||||
bool SendToLogger(CDriverDMSettings &parms);
|
||||
bool SendToLogger(CBrokerVolumeSettings &parms);
|
||||
bool SendToLogger(CCustomerPositionSettings &parms);
|
||||
bool SendToLogger(CMarketWatchSettings &parms);
|
||||
bool SendToLogger(CSecurityDetailSettings &parms);
|
||||
bool SendToLogger(CTradeLookupSettings &parms);
|
||||
bool SendToLogger(CTradeOrderSettings &parms);
|
||||
bool SendToLogger(CTradeUpdateSettings &parms);
|
||||
bool SendToLogger(CTxnMixGeneratorSettings &parms);
|
||||
bool SendToLogger(TDriverCETxnSettings &parms);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // BASE_LOGGER_H
|
||||
278
external/duckdb/third_party/tpce-tool/include/main/Brokers.h
vendored
Normal file
278
external/duckdb/third_party/tpce-tool/include/main/Brokers.h
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Brokers table.
|
||||
*/
|
||||
#ifndef BROKERS_H
|
||||
#define BROKERS_H
|
||||
|
||||
#include <stdio.h> // for snprintf which is not part of the C++ headers
|
||||
#include "EGenTables_common.h"
|
||||
#include "CustomerAccountsAndPermissionsTable.h"
|
||||
#include "input/DataFileManager.h"
|
||||
#include "StatusTypeIDs.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
const TIdent iBrokerNameIDShift = 1000 * 1000; // starting ID to generate names from for brokers
|
||||
|
||||
const int iBrokerInitialTradesYTDMin = 10000;
|
||||
const int iBrokerInitialTradesYTDMax = 100000;
|
||||
|
||||
const double fBrokerInitialCommissionYTDMin = 10000.0;
|
||||
const double fBrokerInitialCommissionYTDMax = 100000.0;
|
||||
|
||||
class CBrokersTable : public TableTemplate<BROKER_ROW> {
|
||||
TIdent m_iTotalBrokers; // total number of brokers rows to generate
|
||||
TIdent m_iStartFromBroker;
|
||||
TIdent m_iStartFromCustomer;
|
||||
CPerson m_person;
|
||||
const StatusTypeDataFile_t &m_StatusTypeFile; // STATUS_TYPE table from the flat file
|
||||
int *m_pNumTrades; // array of B_NUM_TRADES values
|
||||
double *m_pCommTotal; // array of B_COMM_TOTAL values
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor for the BROKER table class.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN inputFiles - input flat files loaded in memory
|
||||
* IN iCustomerCount - customer count
|
||||
* IN iStartFromCustomer - starting customer id (1-based)
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CBrokersTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer)
|
||||
: TableTemplate<BROKER_ROW>(), m_iTotalBrokers(iCustomerCount / iBrokersDiv),
|
||||
m_iStartFromBroker((iStartFromCustomer / iBrokersDiv) + iStartingBrokerID + iTIdentShift),
|
||||
m_iStartFromCustomer(iStartFromCustomer), m_person(dfm, iBrokerNameIDShift, true),
|
||||
m_StatusTypeFile(dfm.StatusTypeDataFile()), m_pNumTrades(NULL), m_pCommTotal(NULL){};
|
||||
|
||||
/*
|
||||
* Destructor.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* not applicable.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
~CBrokersTable() {
|
||||
if (m_pNumTrades != NULL) {
|
||||
delete[] m_pNumTrades;
|
||||
}
|
||||
|
||||
if (m_pCommTotal != NULL) {
|
||||
delete[] m_pCommTotal;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialization method; required when generating data but not for
|
||||
* run-time.
|
||||
*
|
||||
* It is called by CTradeGen at the beginning of every load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN iCustomerCount - new customer count
|
||||
* IN iStartFromCustomer - new starting customer id (1-based)
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitForGen(TIdent iCustomerCount, TIdent iStartFromCustomer) {
|
||||
TIdent i;
|
||||
|
||||
if (m_iTotalBrokers != iCustomerCount / iBrokersDiv || m_pNumTrades == NULL || m_pCommTotal == NULL)
|
||||
|
||||
{
|
||||
// Reallocate arrays for the new number of brokers
|
||||
//
|
||||
|
||||
m_iTotalBrokers = iCustomerCount / iBrokersDiv;
|
||||
|
||||
if (m_pNumTrades != NULL) {
|
||||
delete[] m_pNumTrades;
|
||||
}
|
||||
|
||||
m_pNumTrades = new int[(size_t)m_iTotalBrokers];
|
||||
|
||||
if (m_pCommTotal != NULL) {
|
||||
delete[] m_pCommTotal;
|
||||
}
|
||||
|
||||
m_pCommTotal = new double[(size_t)m_iTotalBrokers];
|
||||
}
|
||||
|
||||
// Initialize array to 0
|
||||
//
|
||||
if (m_pNumTrades != NULL) {
|
||||
for (i = 0; i < m_iTotalBrokers; ++i) {
|
||||
m_pNumTrades[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize array to 0
|
||||
//
|
||||
if (m_pCommTotal != NULL) {
|
||||
for (i = 0; i < m_iTotalBrokers; ++i) {
|
||||
m_pCommTotal[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_iStartFromBroker != ((iStartFromCustomer / iBrokersDiv) + iStartingBrokerID + iTIdentShift)) {
|
||||
// Multiplying by iBrokersDiv again to get 64-bit broker ids
|
||||
// with 4.3bln IDENT_T shift value.
|
||||
// Removing shift factor prior to arithmetic so that contiguous
|
||||
// B_IDs values are obtained, and then add it back so that we
|
||||
// get shifted values.
|
||||
//
|
||||
m_iStartFromBroker = (iStartFromCustomer / iBrokersDiv) + iStartingBrokerID + iTIdentShift;
|
||||
}
|
||||
|
||||
m_iLastRowNumber = 0;
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
|
||||
// Don't re-initialize the cache for the first load unit
|
||||
if (m_iStartFromCustomer != iStartFromCustomer) {
|
||||
m_person.InitNextLoadUnit(iDefaultLoadUnitSize / iBrokersDiv);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Increment year-to-date values for broker trades and commissions.
|
||||
* Used to preserve consistency with initial trades.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN B_ID - broker for whom to update YTD
|
||||
* values IN iTradeIncrement - number of trades to add IN
|
||||
* fCommissionIncrement - amount of commission to add
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void UpdateTradeAndCommissionYTD(TIdent B_ID, int iTradeIncrement, double fCommissionIncrement) {
|
||||
if ((B_ID >= m_iStartFromBroker) && (B_ID < (m_iStartFromBroker + m_iTotalBrokers))) {
|
||||
m_pNumTrades[B_ID - m_iStartFromBroker] += iTradeIncrement;
|
||||
m_pCommTotal[B_ID - m_iStartFromBroker] += fCommissionIncrement;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate random broker id.
|
||||
* Exposed mostly for the driver to ensure unique
|
||||
* broker names for Broker Volume.
|
||||
* External RNG object is used in order to honor CCE autoseed behavior.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN rnd - external RNG
|
||||
*
|
||||
* RETURNS:
|
||||
* random broker id
|
||||
*/
|
||||
TIdent GenerateRandomBrokerId(CRandom *pRnd) {
|
||||
return pRnd->RndInt64Range(m_iStartFromBroker, m_iStartFromBroker + m_iTotalBrokers - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate broker name into the provided buffer.
|
||||
* Exposed mostly for the driver (Broker Volume).
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN B_ID - broker id
|
||||
* IN B_NAME - buffer for broker name
|
||||
* IN B_NAME_len - length of the name buffer
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateBrokerName(TIdent B_ID, char *B_NAME, size_t B_NAME_len) {
|
||||
snprintf(B_NAME, B_NAME_len, "%s %c. %s", m_person.GetFirstName(B_ID + iBrokerNameIDShift).c_str(),
|
||||
m_person.GetMiddleName(B_ID + iBrokerNameIDShift),
|
||||
m_person.GetLastName(B_ID + iBrokerNameIDShift).c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
* Return total broker count.
|
||||
* Exposed mostly for the driver (Broker Volume).
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* total number of brokers in the table
|
||||
*/
|
||||
TIdent GetBrokerCount() {
|
||||
return m_iTotalBrokers;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generates all column values for the next row
|
||||
* and store them in the internal record structure.
|
||||
* Increments the number of rows generated.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* TRUE, if there are more records in the ADDRESS table; FALSE
|
||||
* othewise.
|
||||
*/
|
||||
bool GenerateNextRecord() {
|
||||
m_row.B_ID = m_iStartFromBroker + m_iLastRowNumber;
|
||||
strncpy(m_row.B_ST_ID, m_StatusTypeFile[eActive].ST_ID_CSTR(), sizeof(m_row.B_ST_ID));
|
||||
|
||||
GenerateBrokerName(m_row.B_ID, m_row.B_NAME, static_cast<int>(sizeof(m_row.B_NAME)));
|
||||
|
||||
m_row.B_NUM_TRADES = m_pNumTrades[m_row.B_ID - m_iStartFromBroker];
|
||||
m_row.B_COMM_TOTAL = m_pCommTotal[m_row.B_ID - m_iStartFromBroker];
|
||||
|
||||
// Update state info
|
||||
++m_iLastRowNumber;
|
||||
m_bMoreRecords = m_iLastRowNumber < m_iTotalBrokers;
|
||||
|
||||
// Return false if all the rows have been generated
|
||||
return (MoreRecords());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // BROKERS_H
|
||||
208
external/duckdb/third_party/tpce-tool/include/main/CE.h
vendored
Normal file
208
external/duckdb/third_party/tpce-tool/include/main/CE.h
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This class provides Customer Emulator functionality.
|
||||
* It controls the mix of customer-initiated transactions
|
||||
* and generates all required inputs for each of these
|
||||
* transactions. These inputs are then made available to
|
||||
* a sponsor provided callback interface to the SUT (see
|
||||
* CESUTInterface.h). In addition, a set of constants used
|
||||
* to uniquely identify each transaction type is exposed.
|
||||
*
|
||||
* The constructor for this class is overloaded. The first
|
||||
* form of the constructor accepts 7 inputs, the last one
|
||||
* of which is optional (i.e. it has a default value).
|
||||
* - pSUT: a pointer to an instance of a sponsor provided
|
||||
* subclassing of the CCESUTInterface class.
|
||||
* - pLogger: a pointer to an
|
||||
*instance of CEGenLogger or a sponsor provided subclassing of the CBaseLogger
|
||||
*class.
|
||||
* - inputFiles: a reference to an instance of the
|
||||
* CInputFiles class containing all input files loaded
|
||||
* into memory.
|
||||
* - iCustomerCount: the total number of customers to
|
||||
* emulate. C_IDs will be generated in the range of
|
||||
* 1 to iCustomerCount.
|
||||
* - iScaleFactor: the number of customers per tpsE. This
|
||||
* should match the scale factor used at load time.
|
||||
* - iDaysOfInitialTrades: the number of days of initial
|
||||
* trades that was populated during load time.
|
||||
* - RandomSeed: seed to be used for the RNG.
|
||||
* - pTxnTunables: (optional). a pointer to a tuning
|
||||
* structure used to configure the behavior of the CE
|
||||
* class.
|
||||
*
|
||||
* The second form of the constructor accepts all of the
|
||||
* same inputs as the first form. In addition, however,
|
||||
* it accepts 3 additional inputs between iCustomerCount
|
||||
* and iScaleFacto that facilitate partitioning by C_ID
|
||||
* during runtime.
|
||||
* - iMyStartingCustomerId: the starting customer ID for
|
||||
* this instance's partition of C_IDs. This ID must be
|
||||
* the first ID in a load unit.
|
||||
* - iMyCustomerCount: the number of customers in this
|
||||
* instance's partition. The number of customers specified
|
||||
* must be an integral multiple of the load unit size.
|
||||
* - iPartitionPercent: the percentage of C_IDs
|
||||
* that should be generated within this instance's
|
||||
* partition. 100-iParititionPercent percent of the C_IDs
|
||||
* will be generated across the full range of C_IDs.
|
||||
*
|
||||
* Paritioning Example.
|
||||
* Based on a load unit size of 1000, assume the following
|
||||
* valid inputs.
|
||||
* - iCustomerCount = 5000
|
||||
* - iMyStartingCustomerID = 2001
|
||||
* - iMyCustomerCount = 2000
|
||||
* - iPartitionPercent = 40
|
||||
* These setting will configure the CE to generated C_IDs
|
||||
* as follows.
|
||||
* - 40% of the time in the range [2001 - 4000]
|
||||
* - 60% of the time in the range [1-5000]
|
||||
*
|
||||
* The CE provides the following entry point.
|
||||
*
|
||||
* - DoTxn: this entry point will select the next
|
||||
* transaction type based on the mix settings, generate
|
||||
* all required inputs for the selected transaction type,
|
||||
* and provide those inputs to sponsor code at the
|
||||
* appropriate callback interface.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef CE_H
|
||||
#define CE_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "CETxnInputGenerator.h"
|
||||
#include "CETxnMixGenerator.h"
|
||||
#include "CESUTInterface.h"
|
||||
#include "BaseLogger.h"
|
||||
#include "DriverParamSettings.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CCE {
|
||||
private:
|
||||
CDriverGlobalSettings m_DriverGlobalSettings;
|
||||
CDriverCESettings m_DriverCESettings;
|
||||
CDriverCEPartitionSettings m_DriverCEPartitionSettings;
|
||||
TDriverCETxnSettings m_DriverCETxnSettings;
|
||||
|
||||
CCESUTInterface *m_pSUT;
|
||||
CBaseLogger *m_pLogger;
|
||||
CCETxnMixGenerator m_TxnMixGenerator;
|
||||
CCETxnInputGenerator m_TxnInputGenerator;
|
||||
|
||||
TBrokerVolumeTxnInput m_BrokerVolumeTxnInput;
|
||||
TCustomerPositionTxnInput m_CustomerPositionTxnInput;
|
||||
TMarketWatchTxnInput m_MarketWatchTxnInput;
|
||||
TSecurityDetailTxnInput m_SecurityDetailTxnInput;
|
||||
TTradeLookupTxnInput m_TradeLookupTxnInput;
|
||||
TTradeOrderTxnInput m_TradeOrderTxnInput;
|
||||
TTradeStatusTxnInput m_TradeStatusTxnInput;
|
||||
TTradeUpdateTxnInput m_TradeUpdateTxnInput;
|
||||
|
||||
// Initialization that is common for all constructors.
|
||||
void Initialize(PDriverCETxnSettings pTxnParamSettings);
|
||||
|
||||
// Automatically generate unique RNG seeds
|
||||
void AutoSetRNGSeeds(UINT32 UniqueId);
|
||||
|
||||
/*
|
||||
* Zero transaction input buffer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN iTxnType - what transaction to zero the buffer for.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void ZeroInputBuffer(int iTxnType);
|
||||
|
||||
public:
|
||||
static const INT32 INVALID_TRANSACTION_TYPE = CCETxnMixGenerator::INVALID_TRANSACTION_TYPE;
|
||||
static const INT32 SECURITY_DETAIL = CCETxnMixGenerator::SECURITY_DETAIL;
|
||||
static const INT32 BROKER_VOLUME = CCETxnMixGenerator::BROKER_VOLUME;
|
||||
static const INT32 CUSTOMER_POSITION = CCETxnMixGenerator::CUSTOMER_POSITION;
|
||||
static const INT32 MARKET_WATCH = CCETxnMixGenerator::MARKET_WATCH;
|
||||
static const INT32 TRADE_STATUS = CCETxnMixGenerator::TRADE_STATUS;
|
||||
static const INT32 TRADE_LOOKUP = CCETxnMixGenerator::TRADE_LOOKUP;
|
||||
static const INT32 TRADE_ORDER = CCETxnMixGenerator::TRADE_ORDER;
|
||||
static const INT32 TRADE_UPDATE = CCETxnMixGenerator::TRADE_UPDATE;
|
||||
// Trade-Result and Market-Feed are included for completness.
|
||||
static const INT32 MARKET_FEED = CCETxnMixGenerator::MARKET_FEED;
|
||||
static const INT32 TRADE_RESULT = CCETxnMixGenerator::TRADE_RESULT;
|
||||
|
||||
// Constructor - no partitioning by C_ID, automatic RNG seed generation
|
||||
// (requires unique input)
|
||||
CCE(CCESUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &dfm, TIdent iConfiguredCustomerCount,
|
||||
TIdent iActiveCustomerCount, INT32 iScaleFactor, INT32 iDaysOfInitialTrades, UINT32 UniqueId,
|
||||
const PDriverCETxnSettings pParameterSettings = NULL);
|
||||
|
||||
// Constructor - no partitioning by C_ID, RNG seeds provided
|
||||
CCE(CCESUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &dfm, TIdent iConfiguredCustomerCount,
|
||||
TIdent iActiveCustomerCount, INT32 iScaleFactor, INT32 iDaysOfInitialTrades, UINT32 UniqueId,
|
||||
RNGSEED TxnMixRNGSeed, RNGSEED TxnInputRNGSeed, const PDriverCETxnSettings pParameterSettings = NULL);
|
||||
|
||||
// Constructor - partitioning by C_ID, automatic RNG seed generation
|
||||
// (requires unique input)
|
||||
CCE(CCESUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &dfm, TIdent iConfiguredCustomerCount,
|
||||
TIdent iActiveCustomerCount, TIdent iMyStartingCustomerId, TIdent iMyCustomerCount, INT32 iPartitionPercent,
|
||||
INT32 iScaleFactor, INT32 iDaysOfInitialTrades, UINT32 UniqueId,
|
||||
const PDriverCETxnSettings pParameterSettings = NULL);
|
||||
|
||||
// Constructor - partitioning by C_ID, RNG seeds provided
|
||||
CCE(CCESUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &dfm, TIdent iConfiguredCustomerCount,
|
||||
TIdent iActiveCustomerCount, TIdent iMyStartingCustomerId, TIdent iMyCustomerCount, INT32 iPartitionPercent,
|
||||
INT32 iScaleFactor, INT32 iDaysOfInitialTrades, UINT32 UniqueId, RNGSEED TxnMixRNGSeed, RNGSEED TxnInputRNGSeed,
|
||||
const PDriverCETxnSettings pParameterSettings = NULL);
|
||||
|
||||
~CCE(void);
|
||||
|
||||
RNGSEED GetTxnInputGeneratorRNGSeed(void);
|
||||
RNGSEED GetTxnMixGeneratorRNGSeed(void);
|
||||
void SetTxnTunables(const PDriverCETxnSettings pTxnParamSettings);
|
||||
|
||||
void DoTxn(void);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // CE_H
|
||||
77
external/duckdb/third_party/tpce-tool/include/main/CESUTInterface.h
vendored
Normal file
77
external/duckdb/third_party/tpce-tool/include/main/CESUTInterface.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: Interface base class to be used for deriving a sponsor
|
||||
* specific class for commmunicating with the SUT for all
|
||||
* customer-initiated transactions.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef CE_SUT_INTERFACE_H
|
||||
#define CE_SUT_INTERFACE_H
|
||||
|
||||
#include "TxnHarnessStructs.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CCESUTInterface {
|
||||
public:
|
||||
/*
|
||||
* Virtual destructor. Provided so that a sponsor-specific
|
||||
* destructor can be called on destruction from the base-class pointer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
virtual ~CCESUTInterface(){};
|
||||
|
||||
virtual bool BrokerVolume(PBrokerVolumeTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
virtual bool CustomerPosition(PCustomerPositionTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
virtual bool MarketWatch(PMarketWatchTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
virtual bool SecurityDetail(PSecurityDetailTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
virtual bool TradeLookup(PTradeLookupTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
virtual bool TradeOrder(PTradeOrderTxnInput pTxnInput, INT32 iTradeType,
|
||||
bool bExecutorIsAccountOwner) = 0; // return whether it was successful
|
||||
virtual bool TradeStatus(PTradeStatusTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
virtual bool TradeUpdate(PTradeUpdateTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // CE_SUT_INTERFACE_H
|
||||
408
external/duckdb/third_party/tpce-tool/include/main/CETxnInputGenerator.h
vendored
Normal file
408
external/duckdb/third_party/tpce-tool/include/main/CETxnInputGenerator.h
vendored
Normal file
@@ -0,0 +1,408 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class that generates transaction input data for the Customer Emulator (CE).
|
||||
*/
|
||||
|
||||
#ifndef CE_TXN_INPUT_GENERATOR_H
|
||||
#define CE_TXN_INPUT_GENERATOR_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "TxnHarnessStructs.h"
|
||||
#include "DriverParamSettings.h"
|
||||
#include "EGenLogger.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
#include "Brokers.h"
|
||||
#include "HoldingsAndTradesTable.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CCETxnInputGenerator {
|
||||
CRandom m_rnd; // used inside for parameter generation
|
||||
CPerson m_Person;
|
||||
CCustomerSelection m_CustomerSelection;
|
||||
CCustomerAccountsAndPermissionsTable m_AccsAndPerms;
|
||||
CHoldingsAndTradesTable m_Holdings;
|
||||
CBrokersTable m_Brokers;
|
||||
const CCompanyFile &m_pCompanies;
|
||||
const CSecurityFile &m_pSecurities;
|
||||
const IndustryDataFile_t &m_pIndustries;
|
||||
const SectorDataFile_t &m_pSectors;
|
||||
const StatusTypeDataFile_t &m_pStatusType;
|
||||
const TradeTypeDataFile_t &m_pTradeType;
|
||||
PDriverCETxnSettings m_pDriverCETxnSettings;
|
||||
CBaseLogger *m_pLogger;
|
||||
|
||||
TIdent m_iConfiguredCustomerCount;
|
||||
TIdent m_iActiveCustomerCount;
|
||||
|
||||
TIdent m_iMyStartingCustomerId;
|
||||
TIdent m_iMyCustomerCount;
|
||||
INT32 m_iPartitionPercent;
|
||||
|
||||
INT32 m_iScaleFactor;
|
||||
INT32 m_iHoursOfInitialTrades;
|
||||
INT64 m_iMaxActivePrePopulatedTradeID;
|
||||
|
||||
INT64 m_iTradeLookupFrame2MaxTimeInMilliSeconds;
|
||||
INT64 m_iTradeLookupFrame3MaxTimeInMilliSeconds;
|
||||
INT64 m_iTradeLookupFrame4MaxTimeInMilliSeconds;
|
||||
|
||||
INT64 m_iTradeUpdateFrame2MaxTimeInMilliSeconds;
|
||||
INT64 m_iTradeUpdateFrame3MaxTimeInMilliSeconds;
|
||||
|
||||
// number of securities (scaled based on active customers)
|
||||
TIdent m_iActiveSecurityCount;
|
||||
TIdent m_iActiveCompanyCount;
|
||||
// number of industries (from flat file)
|
||||
INT32 m_iIndustryCount;
|
||||
// number of sector names (from flat file)
|
||||
INT32 m_iSectorCount;
|
||||
// starting ids
|
||||
TIdent m_iStartFromCompany;
|
||||
CDateTime m_StartTime; // start time of initial trades
|
||||
CDateTime m_EndTime; // end time of initial trades
|
||||
|
||||
INT32 m_iTradeOrderRollbackLimit;
|
||||
INT32 m_iTradeOrderRollbackLevel;
|
||||
|
||||
/*
|
||||
* Perform initialization common to all constructors.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN pDriverCETxnSettings - initial transaction parameter
|
||||
* settings
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void Initialize();
|
||||
|
||||
/*
|
||||
* Generate Non-Uniform customer ID.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT iCustomerId - generated C_ID
|
||||
* OUT iCustomerTier - generated C_TIER
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateNonUniformRandomCustomerId(TIdent &iCustomerId, eCustomerTier &iCustomerTier);
|
||||
|
||||
/*
|
||||
* Generate customer account ID (uniformly distributed).
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* CA_ID uniformly distributed across all load units.
|
||||
*/
|
||||
TIdent GenerateRandomCustomerAccountId(void);
|
||||
|
||||
/*
|
||||
* Generate a trade id to be used in Trade-Lookup / Trade-Update Frame 1.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN AValue - parameter to NURAND function
|
||||
* IN SValue - parameter to NURAND function
|
||||
*
|
||||
* RETURNS:
|
||||
* T_ID, distributed non-uniformly.
|
||||
*/
|
||||
TTrade GenerateNonUniformTradeID(INT32 AValue, INT32 SValue);
|
||||
|
||||
/*
|
||||
* Generate a trade timestamp to be used in Trade-Lookup / Trade-Update.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT dts - returned timestamp
|
||||
* IN MaxTimeInMilliSeconds - time interval (from the first
|
||||
* initial trade) in which to generate the timestamp IN AValue - parameter
|
||||
* to NURAND function IN SValue - parameter to NURAND
|
||||
* function
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateNonUniformTradeDTS(TIMESTAMP_STRUCT &dts, INT64 MaxTimeInMilliSeconds, INT32 AValue, INT32 SValue);
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor - no partitioning by C_ID.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN dfm - Data file manager
|
||||
* IN iConfiguredCustomerCount - number of configured
|
||||
* customers in the database IN iActiveCustomerCount - number of
|
||||
* active customers in the database IN iScaleFactor - scale
|
||||
* factor (number of customers per 1 tpsE) of the database IN
|
||||
* iHoursOfInitialTrades - number of hours of the initial trades
|
||||
* portion of the database IN pLogger - reference to
|
||||
* parameter logging object IN pDriverCETxnSettings - initial
|
||||
* transaction parameter settings
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CCETxnInputGenerator(const DataFileManager &dfm, TIdent iConfiguredCustomerCount, TIdent iActiveCustomerCount,
|
||||
INT32 iScaleFactor, INT32 iHoursOfInitialTrades, CBaseLogger *pLogger,
|
||||
const PDriverCETxnSettings pDriverCETxnTunables);
|
||||
|
||||
/*
|
||||
* Constructor - no partitioning by C_ID, RNG seed provided.
|
||||
*
|
||||
* RNG seed is for testing/engineering work allowing repeatable transaction
|
||||
* parameter stream. This constructor is NOT legal for a benchmark
|
||||
* publication.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN dfm - Data file manager
|
||||
* IN iConfiguredCustomerCount - number of configured
|
||||
* customers in the database IN iActiveCustomerCount - number of
|
||||
* active customers in the database IN iScaleFactor - scale
|
||||
* factor (number of customers per 1 tpsE) of the database IN
|
||||
* iHoursOfInitialTrades - number of hours of the initial trades
|
||||
* portion of the database IN RNGSeed - initial seed
|
||||
* for random number generator IN pLogger - reference
|
||||
* to parameter logging object IN pDriverCETxnSettings - initial
|
||||
* transaction parameter settings
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CCETxnInputGenerator(const DataFileManager &dfm, TIdent iConfiguredCustomerCount, TIdent iActiveCustomerCount,
|
||||
INT32 iScaleFactor, INT32 iHoursOfInitialTrades, RNGSEED RNGSeed, CBaseLogger *pLogger,
|
||||
const PDriverCETxnSettings pDriverCETxnTunables);
|
||||
|
||||
/*
|
||||
* Constructor - partitioning by C_ID.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN dfm - Data file manager
|
||||
* IN iConfiguredCustomerCount - number of configured
|
||||
* customers in the database IN iActiveCustomerCount - number of
|
||||
* active customers in the database IN iScaleFactor - scale
|
||||
* factor (number of customers per 1 tpsE) of the database IN
|
||||
* iHoursOfInitialTrades - number of hours of the initial trades
|
||||
* portion of the database IN iMyStartingCustomerId - first customer
|
||||
* id (1-based) of the partition for this instance IN iMyCustomerCount -
|
||||
* number of customers in the partition for this instance IN
|
||||
* iPartitionPercent - the percentage of C_IDs generated within
|
||||
* this instance's partition IN pLogger - reference to
|
||||
* parameter logging object IN pDriverCETxnSettings - initial
|
||||
* transaction parameter settings
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CCETxnInputGenerator(const DataFileManager &dfm, TIdent iConfiguredCustomerCount, TIdent iActiveCustomerCount,
|
||||
INT32 iScaleFactor, INT32 iHoursOfInitialTrades, TIdent iMyStartingCustomerId,
|
||||
TIdent iMyCustomerCount, INT32 iPartitionPercent, CBaseLogger *pLogger,
|
||||
const PDriverCETxnSettings pDriverCETxnTunables);
|
||||
|
||||
/*
|
||||
* Constructor - partitioning by C_ID, RNG seed provided.
|
||||
*
|
||||
* RNG seed is for testing/engineering work allowing repeatable transaction
|
||||
* parameter stream. This constructor is NOT legal for a benchmark
|
||||
* publication.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN dfm - Data file manager
|
||||
* IN iConfiguredCustomerCount - number of configured
|
||||
* customers in the database IN iActiveCustomerCount - number of
|
||||
* active customers in the database IN iScaleFactor - scale
|
||||
* factor (number of customers per 1 tpsE) of the database IN
|
||||
* iHoursOfInitialTrades - number of hours of the initial trades
|
||||
* portion of the database IN iMyStartingCustomerId - first customer
|
||||
* id (1-based) of the partition for this instance IN iMyCustomerCount -
|
||||
* number of customers in the partition for this instance IN
|
||||
* iPartitionPercent - the percentage of C_IDs generated within
|
||||
* this instance's partition IN pLogger - reference to
|
||||
* parameter logging object IN pDriverCETxnSettings - initial
|
||||
* transaction parameter settings
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CCETxnInputGenerator(const DataFileManager &dfm, TIdent iConfiguredCustomerCount, TIdent iActiveCustomerCount,
|
||||
INT32 iScaleFactor, INT32 iHoursOfInitialTrades, TIdent iMyStartingCustomerId,
|
||||
TIdent iMyCustomerCount, INT32 iPartitionPercent, RNGSEED RNGSeed, CBaseLogger *pLogger,
|
||||
const PDriverCETxnSettings pDriverCETxnTunables);
|
||||
|
||||
/*
|
||||
* Return internal random number generator seed.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* current random number generator seed.
|
||||
*/
|
||||
RNGSEED GetRNGSeed(void);
|
||||
|
||||
/*
|
||||
* Set internal random number generator seed.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN RNGSeed - new random number generator seed
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void SetRNGSeed(RNGSEED RNGSeed);
|
||||
|
||||
/*
|
||||
* Refresh internal information from the external transaction parameters.
|
||||
* This function should be called anytime the external transaction
|
||||
* parameter structure changes.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void UpdateTunables();
|
||||
|
||||
/*
|
||||
* Generate Broker-Volume transaction input.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT TxnReq - input parameter structure filled
|
||||
* in for the transaction.
|
||||
*
|
||||
* RETURNS:
|
||||
* the number of brokers generated.
|
||||
*/
|
||||
void GenerateBrokerVolumeInput(TBrokerVolumeTxnInput &TxnReq);
|
||||
|
||||
/*
|
||||
* Generate Customer-Position transaction input.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT TxnReq - input parameter structure filled
|
||||
* in for the transaction.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateCustomerPositionInput(TCustomerPositionTxnInput &TxnReq);
|
||||
|
||||
/*
|
||||
* Generate Market-Watch transaction input.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT TxnReq - input parameter structure filled
|
||||
* in for the transaction.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateMarketWatchInput(TMarketWatchTxnInput &TxnReq);
|
||||
|
||||
/*
|
||||
* Generate Security-Detail transaction input.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT TxnReq - input parameter structure filled
|
||||
* in for the transaction.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateSecurityDetailInput(TSecurityDetailTxnInput &TxnReq);
|
||||
|
||||
/*
|
||||
* Generate Trade-Lookup transaction input.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT TxnReq - input parameter structure filled
|
||||
* in for the transaction.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateTradeLookupInput(TTradeLookupTxnInput &TxnReq);
|
||||
|
||||
/*
|
||||
* Generate Trade-Order transaction input.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT TxnReq - input parameter structure filled
|
||||
* in for the transaction. OUT TradeType - integer
|
||||
* representation of generated trade type (as eTradeTypeID enum). OUT
|
||||
* bExecutorIsAccountOwner - whether Trade-Order frame 2 should (FALSE) or
|
||||
* shouldn't (TRUE) be called.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateTradeOrderInput(TTradeOrderTxnInput &TxnReq, INT32 &iTradeType, bool &bExecutorIsAccountOwner);
|
||||
|
||||
/*
|
||||
* Generate Trade-Status transaction input.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT TxnReq - input parameter structure filled
|
||||
* in for the transaction.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateTradeStatusInput(TTradeStatusTxnInput &TxnReq);
|
||||
|
||||
/*
|
||||
* Generate Trade-Update transaction input.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT TxnReq - input parameter structure filled
|
||||
* in for the transaction.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateTradeUpdateInput(TTradeUpdateTxnInput &TxnReq);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // #ifndef CE_TXN_INPUT_GENERATOR_H
|
||||
107
external/duckdb/third_party/tpce-tool/include/main/CETxnMixGenerator.h
vendored
Normal file
107
external/duckdb/third_party/tpce-tool/include/main/CETxnMixGenerator.h
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson, Cecil Reames, Matt Emmerton
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: EGenDriverCE class to generate transaction types for
|
||||
* execution
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef CE_TXN_MIX_GENERATOR_H
|
||||
#define CE_TXN_MIX_GENERATOR_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "DriverParamSettings.h"
|
||||
#include "EGenLogger.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CCETxnMixGenerator {
|
||||
private:
|
||||
const PDriverCETxnSettings m_pDriverCETxnSettings;
|
||||
CRandom m_rnd;
|
||||
CBaseLogger *m_pLogger;
|
||||
|
||||
// Transaction mixes are expressed out of a total of 1000.
|
||||
//
|
||||
// NOTE that Trade-Result and Market-Feed are not generated by this class
|
||||
// as possible runtime transaction types. They happen as an automatic
|
||||
// by-product of Trade-Order transactions.
|
||||
|
||||
INT32 m_CETransactionMixTotal;
|
||||
|
||||
/*INT32 m_BrokerVolumeMixLimit;
|
||||
INT32 m_CustomerPositionMixLimit;
|
||||
INT32 m_MarketWatchMixLimit;
|
||||
INT32 m_SecurityDetailMixLimit;
|
||||
INT32 m_TradeLookupMixLimit;
|
||||
INT32 m_TradeOrderMixLimit;
|
||||
INT32 m_TradeStatusMixLimit;
|
||||
INT32 m_TradeUpdateMixLimit;*/
|
||||
|
||||
// Array of transaction types used for "shuffle a deck of cards"
|
||||
// algorithm (also known as Knuth shuffle).
|
||||
//
|
||||
INT32 m_iTxnArrayCurrentIndex;
|
||||
char *m_pTxnArray;
|
||||
|
||||
public:
|
||||
static const INT32 INVALID_TRANSACTION_TYPE = -1;
|
||||
static const INT32 SECURITY_DETAIL = 0;
|
||||
static const INT32 BROKER_VOLUME = 1;
|
||||
static const INT32 CUSTOMER_POSITION = 2;
|
||||
static const INT32 MARKET_WATCH = 3;
|
||||
static const INT32 TRADE_STATUS = 4;
|
||||
static const INT32 TRADE_LOOKUP = 5;
|
||||
static const INT32 TRADE_ORDER = 6;
|
||||
static const INT32 TRADE_UPDATE = 7;
|
||||
// Trade-Result and Market-Feed are included for completness.
|
||||
static const INT32 MARKET_FEED = 8;
|
||||
static const INT32 TRADE_RESULT = 9;
|
||||
|
||||
CCETxnMixGenerator(const PDriverCETxnSettings pTxnParamSettings, CBaseLogger *pLogger);
|
||||
CCETxnMixGenerator(const PDriverCETxnSettings pTxnParamSettings, RNGSEED RNGSeed, CBaseLogger *pLogger);
|
||||
~CCETxnMixGenerator();
|
||||
|
||||
RNGSEED GetRNGSeed(void);
|
||||
void SetRNGSeed(RNGSEED RNGSeed);
|
||||
|
||||
void UpdateTunables(void);
|
||||
int GenerateNextTxnType(void);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // #ifndef CE_TXN_MIX_GENERATOR_H
|
||||
59
external/duckdb/third_party/tpce-tool/include/main/ChargeTable.h
vendored
Normal file
59
external/duckdb/third_party/tpce-tool/include/main/ChargeTable.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Charge table.
|
||||
*/
|
||||
#ifndef CHARGE_TABLE_H
|
||||
#define CHARGE_TABLE_H
|
||||
|
||||
#include "FixedTable.h"
|
||||
#include "input/DataFileTypes.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CChargeTable : public FixedTable<ChargeDataFile_t, CHARGE_ROW> {
|
||||
public:
|
||||
CChargeTable(const ChargeDataFile_t &dataFile);
|
||||
~CChargeTable();
|
||||
|
||||
virtual void LoadTableRow();
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // CHARGE_TABLE_H
|
||||
61
external/duckdb/third_party/tpce-tool/include/main/CommissionRateTable.h
vendored
Normal file
61
external/duckdb/third_party/tpce-tool/include/main/CommissionRateTable.h
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the CommissionRate table.
|
||||
*/
|
||||
#ifndef COMMISSION_RATE_TABLE_H
|
||||
#define COMMISSION_RATE_TABLE_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "FixedTable.h"
|
||||
#include "input/DataFileTypes.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CCommissionRateTable : public FixedTable<CommissionRateDataFile_t, COMMISSION_RATE_ROW> {
|
||||
public:
|
||||
CCommissionRateTable(const CommissionRateDataFile_t &dataFile);
|
||||
~CCommissionRateTable();
|
||||
|
||||
virtual void LoadTableRow();
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // COMMISSION_RATE_TABLE_H
|
||||
106
external/duckdb/third_party/tpce-tool/include/main/CompanyCompetitorTable.h
vendored
Normal file
106
external/duckdb/third_party/tpce-tool/include/main/CompanyCompetitorTable.h
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the CompanyCompetitor table.
|
||||
*/
|
||||
#ifndef COMPANY_COMPETITOR_TABLE_H
|
||||
#define COMPANY_COMPETITOR_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CCompanyCompetitorTable : public TableTemplate<COMPANY_COMPETITOR_ROW> {
|
||||
const CCompanyCompetitorFile &m_CompanyCompetitorFile;
|
||||
TIdent m_iCompanyCompetitorCount;
|
||||
TIdent m_iStartFromCompanyCompetitor;
|
||||
TIdent m_iCompanyCompetitorCountForOneLoadUnit;
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
// No RNG calls in this class, so don't need to reset the RNG.
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
}
|
||||
|
||||
public:
|
||||
CCompanyCompetitorTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer)
|
||||
: TableTemplate<COMPANY_COMPETITOR_ROW>(), m_CompanyCompetitorFile(dfm.CompanyCompetitorFile()) {
|
||||
m_iCompanyCompetitorCount = m_CompanyCompetitorFile.CalculateCompanyCompetitorCount(iCustomerCount);
|
||||
m_iStartFromCompanyCompetitor = m_CompanyCompetitorFile.CalculateStartFromCompanyCompetitor(iStartFromCustomer);
|
||||
|
||||
m_iLastRowNumber = m_iStartFromCompanyCompetitor;
|
||||
|
||||
m_iCompanyCompetitorCountForOneLoadUnit =
|
||||
m_CompanyCompetitorFile.CalculateCompanyCompetitorCount(iDefaultLoadUnitSize);
|
||||
};
|
||||
|
||||
/*
|
||||
* Generates all column values for the next row.
|
||||
*/
|
||||
bool GenerateNextRecord() {
|
||||
if (m_iLastRowNumber % m_iCompanyCompetitorCountForOneLoadUnit == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
m_row.CP_CO_ID = m_CompanyCompetitorFile.GetCompanyId(m_iLastRowNumber);
|
||||
|
||||
m_row.CP_COMP_CO_ID = m_CompanyCompetitorFile.GetCompanyCompetitorId(m_iLastRowNumber);
|
||||
|
||||
strncpy(m_row.CP_IN_ID, m_CompanyCompetitorFile.GetIndustryIdCSTR(m_iLastRowNumber), sizeof(m_row.CP_IN_ID));
|
||||
|
||||
++m_iLastRowNumber;
|
||||
|
||||
m_bMoreRecords = m_iLastRowNumber < m_iStartFromCompanyCompetitor + m_iCompanyCompetitorCount;
|
||||
|
||||
return (MoreRecords());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // COMPANY_COMPETITOR_TABLE_H
|
||||
234
external/duckdb/third_party/tpce-tool/include/main/CompanyTable.h
vendored
Normal file
234
external/duckdb/third_party/tpce-tool/include/main/CompanyTable.h
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Company table.
|
||||
*/
|
||||
#ifndef COMPANY_TABLE_H
|
||||
#define COMPANY_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
const int iCEOMult = 1000; // for generating CEO name
|
||||
|
||||
// Number of RNG calls to skip for one row in order
|
||||
// to not use any of the random values from the previous row.
|
||||
//
|
||||
const int iRNGSkipOneRowCompany = 2; // one for SP rate and one for CO_OPEN_DATE
|
||||
|
||||
class CCompanyTable : public TableTemplate<COMPANY_ROW> {
|
||||
const CCompanyFile &m_CompanyFile;
|
||||
const CompanySPRateDataFile_t &m_CompanySPRateFile;
|
||||
CPerson m_person; // for CEO
|
||||
CDateTime m_date;
|
||||
TIdent m_iCO_AD_ID_START; // starting address id for companies
|
||||
int m_iJan1_1800_DayNo;
|
||||
int m_iJan2_2000_DayNo;
|
||||
int m_iCurrentDayNo;
|
||||
TIdent m_iCompanyCountForOneLoadUnit;
|
||||
TIdent m_iCompanyCount;
|
||||
TIdent m_iStartFromCompany;
|
||||
|
||||
/*
|
||||
* Generate distribution for the company inside S&P Rating file.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* threshold in the set of S&P credit ratings.
|
||||
*/
|
||||
int GetCompanySPRateThreshold() {
|
||||
RNGSEED OldSeed;
|
||||
int iCompanySPRateThreshold;
|
||||
|
||||
OldSeed = m_rnd.GetSeed();
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedBaseSPRate, (RNGSEED)m_row.CO_ID));
|
||||
iCompanySPRateThreshold = m_rnd.RndIntRange(0, m_CompanySPRateFile.size() - 1);
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
return (iCompanySPRateThreshold);
|
||||
}
|
||||
|
||||
/*
|
||||
* S&P Credit Rating for the current company.
|
||||
* It is stored in the current record structure.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateCompanySPRate(void) {
|
||||
int iThreshold = GetCompanySPRateThreshold();
|
||||
|
||||
// Select the row in the input file
|
||||
strncpy(m_row.CO_SP_RATE, m_CompanySPRateFile[iThreshold].CO_SP_RATE_CSTR(), sizeof(m_row.CO_SP_RATE));
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedTableDefault, (RNGSEED)m_iLastRowNumber * iRNGSkipOneRowCompany));
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
}
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN inputFiles - input flat files loaded in memory
|
||||
* IN iCustomerCount - number of customers to generate
|
||||
* IN iStartFromCustomer - ordinal position of the first
|
||||
* customer in the sequence (Note: 1-based)
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CCompanyTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer)
|
||||
: TableTemplate<COMPANY_ROW>(), m_CompanyFile(dfm.CompanyFile()),
|
||||
m_CompanySPRateFile(dfm.CompanySPRateDataFile()), m_person(dfm, 0, false) {
|
||||
m_iJan1_1800_DayNo = CDateTime::YMDtoDayno(1800, 1, 1); // days number for Jan 1, 1800
|
||||
m_iJan2_2000_DayNo = CDateTime::YMDtoDayno(2000, 1, 2); // days number for Jan 2, 2000
|
||||
m_iCurrentDayNo = m_date.DayNo(); // today's days number
|
||||
|
||||
m_iCompanyCountForOneLoadUnit = m_CompanyFile.CalculateCompanyCount(iDefaultLoadUnitSize);
|
||||
|
||||
m_iCompanyCount = m_CompanyFile.CalculateCompanyCount(iCustomerCount);
|
||||
m_iStartFromCompany = m_CompanyFile.CalculateStartFromCompany(iStartFromCustomer);
|
||||
|
||||
m_iLastRowNumber = m_iStartFromCompany;
|
||||
// Start Company addresses immediately after Exchange addresses,
|
||||
// and company addresses for prior companies
|
||||
m_iCO_AD_ID_START = dfm.ExchangeDataFile().size() + m_iStartFromCompany + iTIdentShift;
|
||||
};
|
||||
|
||||
/*
|
||||
* Generate and store state information for the next CO_ID.
|
||||
* The number of rows generated is incremented. This is why
|
||||
* this function cannot be called more than once for a record.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* TRUE, if there are more company ids to generate; FALSE, otherwise.
|
||||
*/
|
||||
bool GenerateNextCO_ID() {
|
||||
++m_iLastRowNumber;
|
||||
m_bMoreRecords = m_iLastRowNumber < (m_iStartFromCompany + m_iCompanyCount);
|
||||
|
||||
return (MoreRecords());
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the current CO_ID. Since it doesn't generate the next CO_ID,
|
||||
* this function can be called many times for the same record.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* CO_ID in the current record.
|
||||
*/
|
||||
TIdent GetCurrentCO_ID() {
|
||||
return (m_CompanyFile.GetCompanyId(m_iLastRowNumber));
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate all column values for the next row
|
||||
* and store them in the internal record structure.
|
||||
* Increment the number of rows generated.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* TRUE, if there are more records in the ADDRESS table; FALSE
|
||||
* othewise.
|
||||
*/
|
||||
bool GenerateNextRecord() {
|
||||
int iFoundDayNo;
|
||||
|
||||
// Reset RNG at Load Unit boundary, so that all data is repeatable.
|
||||
//
|
||||
if (m_iLastRowNumber % m_iCompanyCountForOneLoadUnit == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
m_row.CO_ID = GetCurrentCO_ID();
|
||||
|
||||
strncpy(m_row.CO_ST_ID, m_CompanyFile.GetRecord(m_iLastRowNumber).CO_ST_ID_CSTR(), sizeof(m_row.CO_ST_ID));
|
||||
|
||||
m_CompanyFile.CreateName(m_iLastRowNumber, m_row.CO_NAME, static_cast<int>(sizeof(m_row.CO_NAME)));
|
||||
|
||||
strncpy(m_row.CO_IN_ID, m_CompanyFile.GetRecord(m_iLastRowNumber).CO_IN_ID_CSTR(), sizeof(m_row.CO_IN_ID));
|
||||
|
||||
GenerateCompanySPRate();
|
||||
|
||||
snprintf(m_row.CO_CEO, sizeof(m_row.CO_CEO), "%s %s", m_person.GetFirstName(iCEOMult * m_row.CO_ID).c_str(),
|
||||
m_person.GetLastName(iCEOMult * m_row.CO_ID).c_str());
|
||||
|
||||
strncpy(m_row.CO_DESC, m_CompanyFile.GetRecord(m_iLastRowNumber).CO_DESC_CSTR(), sizeof(m_row.CO_DESC));
|
||||
|
||||
m_row.CO_AD_ID = ++m_iCO_AD_ID_START;
|
||||
|
||||
iFoundDayNo = m_rnd.RndIntRange(m_iJan1_1800_DayNo, m_iJan2_2000_DayNo);
|
||||
|
||||
m_row.CO_OPEN_DATE.Set(iFoundDayNo);
|
||||
|
||||
// Update state info
|
||||
return GenerateNextCO_ID();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // COMPANY_TABLE_H
|
||||
764
external/duckdb/third_party/tpce-tool/include/main/CustomerAccountsAndPermissionsTable.h
vendored
Normal file
764
external/duckdb/third_party/tpce-tool/include/main/CustomerAccountsAndPermissionsTable.h
vendored
Normal file
@@ -0,0 +1,764 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Customer Accounts table.
|
||||
*/
|
||||
#ifndef CUSTOMER_ACCOUNTS_AND_PERMISSIONS_TABLE_H
|
||||
#define CUSTOMER_ACCOUNTS_AND_PERMISSIONS_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
#include "CustomerTable.h"
|
||||
#include "AddressTable.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
const UINT iMaxCAPerms = 3; // maximum # of customers having permissions to the same account
|
||||
const UINT iMinAccountsPerCustRange[3] = {1, 2, 5};
|
||||
const UINT iMaxAccountsPerCustRange[3] = {4, 8, 10};
|
||||
const UINT iMaxAccountsPerCust = 10; // must be the biggest number in iMaxAccountsPerCustRange array
|
||||
const TIdent iStartingBrokerID = 1;
|
||||
|
||||
// This is the fixed range from which person ids (like CIDs) are selected
|
||||
// for the *additional* permissions on the account that make the
|
||||
// content of ACCOUNT_PERMISSION table.
|
||||
//
|
||||
// The range is fixed for any size database in order for the parallel loaders
|
||||
// to select person ids the same way and be compatible with runtime driver
|
||||
// (and to avoid database size parameter to the loader executable).
|
||||
//
|
||||
const TIdent iAccountPermissionIDRange = INT64_CONST(4024) * 1024 * 1024 - iDefaultStartFromCustomer;
|
||||
|
||||
const UINT iPercentAccountsWithPositiveInitialBalance = 80;
|
||||
|
||||
const double fAccountInitialPositiveBalanceMax = 9999999.99;
|
||||
const double fAccountInitialNegativeBalanceMin = -9999999.99;
|
||||
|
||||
const UINT iPercentAccountAdditionalPermissions_0 = 60;
|
||||
const UINT iPercentAccountAdditionalPermissions_1 = 38;
|
||||
const UINT iPercentAccountAdditionalPermissions_2 = 2;
|
||||
|
||||
const UINT iPercentAccountTaxStatusNonTaxable = 20;
|
||||
const UINT iPercentAccountTaxStatusTaxableAndWithhold = 50;
|
||||
const UINT iPercentAccountTaxStatusTaxableAndDontWithhold = 30;
|
||||
|
||||
// Number of RNG calls to skip for one row in order
|
||||
// to not use any of the random values from the previous row.
|
||||
const UINT iRNGSkipOneRowCustomerAccount = 10; // real max count in v3.5: 7
|
||||
|
||||
enum eTaxStatus { eNone = -1, eNonTaxable = 0, eTaxableAndWithhold, eTaxableAndDontWithhold };
|
||||
|
||||
typedef struct CUSTOMER_ACCOUNT_AND_PERMISSION_ROW {
|
||||
CUSTOMER_ACCOUNT_ROW m_ca;
|
||||
ACCOUNT_PERMISSION_ROW m_perm[iMaxCAPerms + 1];
|
||||
} * PCUSTOMER_ACCOUNT_AND_PERMISSION_ROW;
|
||||
|
||||
class CCustomerAccountsAndPermissionsTable : public TableTemplate<CUSTOMER_ACCOUNT_AND_PERMISSION_ROW> {
|
||||
const TaxableAccountNameDataFile_t &m_TaxableAccountName;
|
||||
const NonTaxableAccountNameDataFile_t &m_NonTaxableAccountName;
|
||||
TIdent m_iStartFromCustomer;
|
||||
TIdent m_iCustomerCount;
|
||||
TIdent m_iStartingCA_ID; // first CA_ID for the current customer
|
||||
UINT m_iRowsToGenForCust; // total # of rows to generate for a given
|
||||
// portfolio
|
||||
UINT m_iRowsGeneratedForCust; // rows already generated for a particular
|
||||
// portfolio
|
||||
CCustomerTable m_cust;
|
||||
CPerson m_person;
|
||||
UINT m_iPermsForCA;
|
||||
TIdent m_iBrokersCount;
|
||||
CAddressTable m_addr; // ADDRESS table - to calculate tax for TRADE
|
||||
UINT m_iLoadUnitSize;
|
||||
CCustomerSelection m_CustomerSelection;
|
||||
bool m_bCacheEnabled;
|
||||
int m_iCacheSizeNA;
|
||||
TIdent m_iCacheOffsetNA;
|
||||
UINT *m_CacheNA;
|
||||
int m_iCacheSizeTS;
|
||||
TIdent m_iCacheOffsetTS;
|
||||
eTaxStatus *m_CacheTS;
|
||||
|
||||
/*
|
||||
* Generate only the Customer Account row.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateCARow() {
|
||||
int iAcctType;
|
||||
|
||||
// Generate customer account row.
|
||||
//
|
||||
GenerateNextCA_AD();
|
||||
|
||||
m_row.m_ca.CA_C_ID = GetCurrentC_ID(); // get from CUSTOMER
|
||||
|
||||
// Generate broker id.
|
||||
m_row.m_ca.CA_B_ID = GenerateBrokerIdForAccount(m_row.m_ca.CA_ID);
|
||||
|
||||
// Generate tax status and account name.
|
||||
if ((m_row.m_ca.CA_TAX_ST = (char)GetAccountTaxStatus(m_row.m_ca.CA_ID)) ==
|
||||
eNonTaxable) { // non-taxable account
|
||||
iAcctType = (int)m_row.m_ca.CA_ID % m_NonTaxableAccountName.size(); // select account type
|
||||
|
||||
snprintf(m_row.m_ca.CA_NAME, sizeof(m_row.m_ca.CA_NAME), "%s %s %s",
|
||||
m_person.GetFirstName(m_row.m_ca.CA_C_ID).c_str(),
|
||||
m_person.GetLastName(m_row.m_ca.CA_C_ID).c_str(), m_NonTaxableAccountName[iAcctType].NAME_CSTR());
|
||||
} else { // taxable account
|
||||
iAcctType = (int)m_row.m_ca.CA_ID % m_TaxableAccountName.size(); // select account type
|
||||
|
||||
snprintf(m_row.m_ca.CA_NAME, sizeof(m_row.m_ca.CA_NAME), "%s %s %s",
|
||||
m_person.GetFirstName(m_row.m_ca.CA_C_ID).c_str(),
|
||||
m_person.GetLastName(m_row.m_ca.CA_C_ID).c_str(), m_TaxableAccountName[iAcctType].NAME_CSTR());
|
||||
}
|
||||
|
||||
if (m_rnd.RndPercent(iPercentAccountsWithPositiveInitialBalance)) {
|
||||
m_row.m_ca.CA_BAL = m_rnd.RndDoubleIncrRange(0.00, fAccountInitialPositiveBalanceMax, 0.01);
|
||||
} else {
|
||||
m_row.m_ca.CA_BAL = m_rnd.RndDoubleIncrRange(fAccountInitialNegativeBalanceMin, 0.00, 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to generate parts of an ACCOUNT_PERMISSION row.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN CA_ID - customer account id
|
||||
* IN C_ID - customer id
|
||||
* IN szACL - Access-Control-List string on the account
|
||||
* OUT row - ACCOUNT_PERMISSION row structure to fill
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void FillAPRow(TIdent CA_ID, TIdent C_ID, const char *szACL, ACCOUNT_PERMISSION_ROW &row) {
|
||||
row.AP_CA_ID = CA_ID;
|
||||
m_cust.GetC_TAX_ID(C_ID, row.AP_TAX_ID);
|
||||
strncpy(row.AP_L_NAME, m_person.GetLastName(C_ID).c_str(), sizeof(row.AP_L_NAME));
|
||||
strncpy(row.AP_F_NAME, m_person.GetFirstName(C_ID).c_str(), sizeof(row.AP_F_NAME));
|
||||
strncpy(row.AP_ACL, szACL, sizeof(row.AP_ACL));
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate only the Account Permissions row(s).
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAPRows() {
|
||||
int iAdditionalPerms;
|
||||
TIdent CID_1, CID_2;
|
||||
|
||||
// Generate account permissions rows.
|
||||
|
||||
// Generate the owner row
|
||||
FillAPRow(m_row.m_ca.CA_ID, m_row.m_ca.CA_C_ID, "0000", m_row.m_perm[0]);
|
||||
|
||||
iAdditionalPerms = GetNumPermsForCA(m_row.m_ca.CA_ID);
|
||||
switch (iAdditionalPerms) {
|
||||
case 0:
|
||||
m_iPermsForCA = 1; // 60%
|
||||
break;
|
||||
case 1:
|
||||
GetCIDsForPermissions(m_row.m_ca.CA_ID, m_row.m_ca.CA_C_ID, &CID_1, NULL);
|
||||
m_iPermsForCA = 2; // 38%
|
||||
// generate second account permission row
|
||||
FillAPRow(m_row.m_ca.CA_ID, CID_1, "0001", m_row.m_perm[1]);
|
||||
break;
|
||||
case 2:
|
||||
GetCIDsForPermissions(m_row.m_ca.CA_ID, m_row.m_ca.CA_C_ID, &CID_1, &CID_2);
|
||||
m_iPermsForCA = 3; // 2%
|
||||
// generate second account permission row
|
||||
FillAPRow(m_row.m_ca.CA_ID, CID_1, "0001", m_row.m_perm[1]);
|
||||
// generate third account permission row
|
||||
FillAPRow(m_row.m_ca.CA_ID, CID_2, "0011", m_row.m_perm[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN dfm - input flat files loaded in memory
|
||||
* IN iLoadUnitSize - should always be 1000
|
||||
* IN iCustomerCount - number of customers to generate
|
||||
* IN iStartFromCustomer - ordinal position of the first
|
||||
* customer in the sequence (Note: 1-based)
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CCustomerAccountsAndPermissionsTable(const DataFileManager &dfm,
|
||||
UINT iLoadUnitSize, // # of customers in one load unit
|
||||
TIdent iCustomerCount, TIdent iStartFromCustomer, bool bCacheEnabled = false)
|
||||
: TableTemplate<CUSTOMER_ACCOUNT_AND_PERMISSION_ROW>(), m_TaxableAccountName(dfm.TaxableAccountNameDataFile()),
|
||||
m_NonTaxableAccountName(dfm.NonTaxableAccountNameDataFile()), m_iStartFromCustomer(iStartFromCustomer),
|
||||
m_iCustomerCount(iCustomerCount), m_iRowsToGenForCust(0), m_iRowsGeneratedForCust(0),
|
||||
m_cust(dfm, iCustomerCount, iStartFromCustomer), m_person(dfm, iStartFromCustomer, bCacheEnabled),
|
||||
m_iPermsForCA(0), m_iBrokersCount(iLoadUnitSize / iBrokersDiv),
|
||||
m_addr(dfm, iCustomerCount, iStartFromCustomer, bCacheEnabled), m_iLoadUnitSize(iLoadUnitSize),
|
||||
m_bCacheEnabled(bCacheEnabled) {
|
||||
if (m_bCacheEnabled) {
|
||||
m_iCacheSizeNA = iDefaultLoadUnitSize;
|
||||
m_iCacheOffsetNA = iStartFromCustomer + iTIdentShift;
|
||||
m_CacheNA = new UINT[m_iCacheSizeNA];
|
||||
for (int i = 0; i < m_iCacheSizeNA; i++) {
|
||||
m_CacheNA[i] = 0;
|
||||
}
|
||||
|
||||
m_iCacheSizeTS = iDefaultLoadUnitSize * iMaxAccountsPerCust;
|
||||
m_iCacheOffsetTS = ((iStartFromCustomer - 1) + iTIdentShift) * iMaxAccountsPerCust;
|
||||
m_CacheTS = new eTaxStatus[m_iCacheSizeTS];
|
||||
for (int i = 0; i < m_iCacheSizeTS; i++) {
|
||||
m_CacheTS[i] = eNone;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Destructor.
|
||||
*/
|
||||
~CCustomerAccountsAndPermissionsTable() {
|
||||
if (m_bCacheEnabled) {
|
||||
delete[] m_CacheNA;
|
||||
delete[] m_CacheTS;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(
|
||||
RNGSeedTableDefault, (RNGSEED)(GetCurrentC_ID() * iMaxAccountsPerCust * iRNGSkipOneRowCustomerAccount)));
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
|
||||
if (m_bCacheEnabled) {
|
||||
m_iCacheOffsetNA += iDefaultLoadUnitSize;
|
||||
for (int i = 0; i < m_iCacheSizeNA; i++) {
|
||||
m_CacheNA[i] = 0;
|
||||
}
|
||||
m_iCacheOffsetTS += iDefaultLoadUnitSize * iMaxAccountsPerCust;
|
||||
for (int i = 0; i < m_iCacheSizeTS; i++) {
|
||||
m_CacheTS[i] = eNone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate the number of accounts for a given customer id.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN CID - customer id
|
||||
* IN iCustomerTier - customer tier (indicating trading
|
||||
* frequency)
|
||||
*
|
||||
* RETURNS:
|
||||
* number of accounts
|
||||
*/
|
||||
UINT GetNumberOfAccounts(TIdent CID, eCustomerTier iCustomerTier) {
|
||||
UINT iNumAccounts = 0;
|
||||
|
||||
// We will sometimes get CID values that are outside the current
|
||||
// load unit (cached range). We need to check for this case
|
||||
// and avoid the lookup (as we will segfault or get bogus data.)
|
||||
TIdent index = CID - m_iCacheOffsetNA;
|
||||
bool bCheckCache = (index >= 0 && index < m_iCacheSizeNA);
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
iNumAccounts = m_CacheNA[index];
|
||||
}
|
||||
|
||||
if (iNumAccounts == 0) {
|
||||
UINT iMinAccountCount;
|
||||
UINT iMod;
|
||||
UINT iInverseCID;
|
||||
|
||||
iMinAccountCount = iMinAccountsPerCustRange[iCustomerTier - eCustomerTierOne];
|
||||
iMod = iMaxAccountsPerCustRange[iCustomerTier - eCustomerTierOne] - iMinAccountCount + 1;
|
||||
iInverseCID = m_CustomerSelection.GetInverseCID(CID);
|
||||
|
||||
// Note: the calculations below assume load unit contains 1000
|
||||
// customers.
|
||||
//
|
||||
if (iInverseCID < 200) // Tier 1
|
||||
{
|
||||
iNumAccounts = (iInverseCID % iMod) + iMinAccountCount;
|
||||
} else {
|
||||
if (iInverseCID < 800) // Tier 2
|
||||
{
|
||||
iNumAccounts = ((iInverseCID - 200 + 1) % iMod) + iMinAccountCount;
|
||||
} else // Tier 3
|
||||
{
|
||||
iNumAccounts = ((iInverseCID - 800 + 2) % iMod) + iMinAccountCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
m_CacheNA[index] = iNumAccounts;
|
||||
}
|
||||
}
|
||||
return iNumAccounts;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate a random account for the specified customer.
|
||||
* The distribution is uniform across all the accounts for the customer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN RND - external Random Number Generator
|
||||
* IN iCustomerId - customer id
|
||||
* IN iCustomerTier - customer tier (indicating trading
|
||||
* frequency) OUT piCustomerAccount - customer account id OUT
|
||||
* piAccountCount - total number of accounts that the customer has
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateRandomAccountId(CRandom &RND, // in - external RNG
|
||||
TIdent iCustomerId, // in
|
||||
eCustomerTier iCustomerTier, // in
|
||||
TIdent *piCustomerAccount, // out
|
||||
int *piAccountCount) // out
|
||||
{
|
||||
TIdent iCustomerAccount;
|
||||
int iAccountCount;
|
||||
TIdent iStartingAccount;
|
||||
|
||||
iAccountCount = GetNumberOfAccounts(iCustomerId, iCustomerTier);
|
||||
|
||||
iStartingAccount = GetStartingCA_ID(iCustomerId);
|
||||
|
||||
// Select random account for the customer
|
||||
//
|
||||
iCustomerAccount = RND.RndInt64Range(iStartingAccount, iStartingAccount + iAccountCount - 1);
|
||||
|
||||
if (piCustomerAccount != NULL) {
|
||||
*piCustomerAccount = iCustomerAccount;
|
||||
}
|
||||
|
||||
if (piAccountCount != NULL) {
|
||||
*piAccountCount = iAccountCount;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate a random account for the specified customer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN RND - external Random Number Generator
|
||||
* IN iCustomerId - customer id
|
||||
* IN iCustomerTier - customer tier (indicating trading
|
||||
* frequency)
|
||||
*
|
||||
* RETURNS:
|
||||
* customer account id.
|
||||
*/
|
||||
TIdent GenerateRandomAccountId(CRandom &RND, TIdent iCustomerId, eCustomerTier iCustomerTier) {
|
||||
TIdent iAccountOffset;
|
||||
INT32 iAccountCount;
|
||||
TIdent iStartingAccount;
|
||||
|
||||
iAccountCount = GetNumberOfAccounts(iCustomerId, iCustomerTier);
|
||||
|
||||
iStartingAccount = GetStartingCA_ID(iCustomerId);
|
||||
|
||||
iAccountOffset = (TIdent)RND.RndInt64Range(0, (INT64)iAccountCount - 1);
|
||||
|
||||
return (iStartingAccount + iAccountOffset);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get starting account id for a given customer id.
|
||||
* This is needed for the driver to know what account ids belong to a
|
||||
* given customer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN CID - customer id
|
||||
*
|
||||
* RETURNS:
|
||||
* first account id of the customer.
|
||||
*/
|
||||
TIdent GetStartingCA_ID(TIdent CID) {
|
||||
// start account ids on the next boundary for the new customer
|
||||
return ((CID - 1) * iMaxAccountsPerCust + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get (maximum potential) ending account id for a given customer id.
|
||||
* This is needed for the driver to restrict query results to active
|
||||
* accounts.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN CID - customer id
|
||||
*
|
||||
* RETURNS:
|
||||
* last account id of the customer.
|
||||
*/
|
||||
TIdent GetEndingCA_ID(TIdent CID) {
|
||||
return (CID + iTIdentShift) * iMaxAccountsPerCust;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate next CA_ID and update state information.
|
||||
* It is stored in the internal record structure and also returned.
|
||||
* The number of rows generated is incremented. This is why
|
||||
* this function cannot be called more than once for a record.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* next account id of the customer.
|
||||
*/
|
||||
TIdent GenerateNextCA_AD() {
|
||||
if (GetCurrentC_ID() % iDefaultLoadUnitSize == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
++m_iLastRowNumber;
|
||||
|
||||
if (m_iRowsGeneratedForCust == m_iRowsToGenForCust) { // select next customer id as all the rows
|
||||
// for this customer have been generated
|
||||
m_cust.GenerateNextC_ID();
|
||||
m_addr.GenerateNextAD_ID(); // next address id (to get the one for
|
||||
// this customer)
|
||||
m_iRowsGeneratedForCust = 0; // no row generated yet
|
||||
// total # of accounts for this customer
|
||||
m_iRowsToGenForCust =
|
||||
GetNumberOfAccounts(m_cust.GetCurrentC_ID(), m_cust.GetC_TIER(m_cust.GetCurrentC_ID()));
|
||||
|
||||
m_iStartingCA_ID = GetStartingCA_ID(m_cust.GetCurrentC_ID());
|
||||
}
|
||||
|
||||
m_row.m_ca.CA_ID = m_iStartingCA_ID + m_iRowsGeneratedForCust;
|
||||
|
||||
++m_iRowsGeneratedForCust;
|
||||
|
||||
// store state info
|
||||
m_bMoreRecords = m_cust.MoreRecords() || m_iRowsGeneratedForCust < m_iRowsToGenForCust;
|
||||
|
||||
return m_row.m_ca.CA_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate the number (0-2) of additional permission rows for a certain
|
||||
* account. This number is needed by the driver.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN CA_ID - customer account id
|
||||
*
|
||||
* RETURNS:
|
||||
* number of ACCOUNT_PERMISSION rows.
|
||||
*/
|
||||
int GetNumPermsForCA(TIdent CA_ID) {
|
||||
RNGSEED OldSeed;
|
||||
UINT iThreshold;
|
||||
UINT iNumberOfPermissions;
|
||||
|
||||
OldSeed = m_rnd.GetSeed();
|
||||
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedBaseNumberOfAccountPermissions, (RNGSEED)CA_ID));
|
||||
|
||||
iThreshold = m_rnd.RndGenerateIntegerPercentage();
|
||||
|
||||
if (iThreshold <= iPercentAccountAdditionalPermissions_0) {
|
||||
iNumberOfPermissions = 0; // 60% of accounts have just the owner row permissions
|
||||
} else {
|
||||
if (iThreshold <= iPercentAccountAdditionalPermissions_0 + iPercentAccountAdditionalPermissions_1) {
|
||||
iNumberOfPermissions = 1; // 38% of accounts have one additional permisison row
|
||||
} else {
|
||||
iNumberOfPermissions = 2; // 2% of accounts have two additional permission rows
|
||||
}
|
||||
}
|
||||
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
return (iNumberOfPermissions);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate customer ids for ACCOUNT_PERMISSION table for a given account
|
||||
* id. Driver needs to know what those customer ids are based on the account
|
||||
* id.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN CA_ID - customer account id
|
||||
* IN Owner_CID - customer id of the account owner
|
||||
* OUT CID_1 - first customer id in the ACL list of the
|
||||
* account OUT CID_2 - second customer id in the ACL list of the
|
||||
* account
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GetCIDsForPermissions(TIdent CA_ID, TIdent Owner_CID, TIdent *CID_1, TIdent *CID_2) {
|
||||
RNGSEED OldSeed;
|
||||
|
||||
if (CID_1 == NULL)
|
||||
return;
|
||||
|
||||
OldSeed = m_rnd.GetSeed();
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedBaseCIDForPermission1, (RNGSEED)CA_ID));
|
||||
|
||||
// Select from a fixed range that doesn't depend on the number of
|
||||
// customers in the database. This allows not to specify the total
|
||||
// number of customers to EGenLoader, only how many a particular
|
||||
// instance needs to generate (may be a fraction of total). Note: this
|
||||
// is not implemented right now.
|
||||
*CID_1 = m_rnd.RndInt64RangeExclude(iDefaultStartFromCustomer,
|
||||
iDefaultStartFromCustomer + iAccountPermissionIDRange, Owner_CID);
|
||||
|
||||
if (CID_2 != NULL) {
|
||||
// NOTE: Reseeding the RNG here for the second CID value. The use of
|
||||
// this sequence is fuzzy because the number of RNG values consumed
|
||||
// is dependant on not only the CA_ID, but also the CID value chosen
|
||||
// above for the first permission. Using a different sequence here
|
||||
// may help prevent potential overlaps that might occur if the same
|
||||
// sequence from above were used.
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedBaseCIDForPermission2, (RNGSEED)CA_ID));
|
||||
do // make sure the second id is different from the first
|
||||
{
|
||||
*CID_2 = m_rnd.RndInt64RangeExclude(iDefaultStartFromCustomer,
|
||||
iDefaultStartFromCustomer + iAccountPermissionIDRange, Owner_CID);
|
||||
} while (*CID_2 == *CID_1);
|
||||
}
|
||||
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate tax id for a given CA_ID.
|
||||
* This is needed to calculate tax on sale proceeds for the TRADE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN iCA_ID - customer account id
|
||||
*
|
||||
* RETURNS:
|
||||
* tax status for the account.
|
||||
*/
|
||||
eTaxStatus GetAccountTaxStatus(TIdent iCA_ID) {
|
||||
eTaxStatus eCATaxStatus = eNone;
|
||||
|
||||
// We will sometimes get CA values that are outside the current
|
||||
// load unit (cached range). We need to check for this case
|
||||
// and avoid the lookup (as we will segfault or get bogus data.)
|
||||
TIdent index = iCA_ID - m_iCacheOffsetTS;
|
||||
bool bCheckCache = (index >= 0 && index < m_iCacheSizeTS);
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
eCATaxStatus = m_CacheTS[index];
|
||||
}
|
||||
|
||||
if (eCATaxStatus == eNone) {
|
||||
RNGSEED OldSeed;
|
||||
UINT iThreshold;
|
||||
|
||||
OldSeed = m_rnd.GetSeed();
|
||||
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedBaseAccountTaxStatus, (RNGSEED)iCA_ID));
|
||||
|
||||
iThreshold = m_rnd.RndGenerateIntegerPercentage();
|
||||
if (iThreshold <= iPercentAccountTaxStatusNonTaxable) {
|
||||
eCATaxStatus = eNonTaxable;
|
||||
} else {
|
||||
if (iThreshold <= iPercentAccountTaxStatusNonTaxable + iPercentAccountTaxStatusTaxableAndWithhold) {
|
||||
eCATaxStatus = eTaxableAndWithhold;
|
||||
} else {
|
||||
eCATaxStatus = eTaxableAndDontWithhold;
|
||||
}
|
||||
}
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
m_CacheTS[index] = eCATaxStatus;
|
||||
}
|
||||
}
|
||||
return eCATaxStatus;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the country and division address codes for the customer that
|
||||
* owns the current account.
|
||||
* These codes are used to get the tax rates and calculate tax on trades
|
||||
* in the TRADE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* OUT iDivCode - division (state/province) code
|
||||
* OUT iCtryCode - country (USA/CANADA) code
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GetDivisionAndCountryCodesForCurrentAccount(UINT &iDivCode, UINT &iCtryCode) {
|
||||
m_addr.GetDivisionAndCountryCodes(iDivCode, iCtryCode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate a broker id for a certain account.
|
||||
* Used in CTradeGen for updating YTD values.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN iCA_ID - customer account id
|
||||
*
|
||||
* RETURNS:
|
||||
* broker id that corresponds to the account.
|
||||
*/
|
||||
TIdent GenerateBrokerIdForAccount(TIdent iCA_ID) {
|
||||
// Customer that own the account (actually, customer id minus 1)
|
||||
//
|
||||
TIdent iCustomerId = ((iCA_ID - 1) / iMaxAccountsPerCust) - iTIdentShift;
|
||||
|
||||
// Set the starting broker to be the first broker for the current load
|
||||
// unit of customers.
|
||||
//
|
||||
TIdent iStartFromBroker = (iCustomerId / m_iLoadUnitSize) * m_iBrokersCount + iStartingBrokerID + iTIdentShift;
|
||||
|
||||
// Note: this depends on broker ids being integer numbers from
|
||||
// contiguous range. The method of generating broker ids should be in
|
||||
// sync with the CBrokerTable.
|
||||
return m_rnd.RndNthInt64Range(RNGSeedBaseBrokerId, (RNGSEED)iCA_ID - (10 * iTIdentShift), iStartFromBroker,
|
||||
iStartFromBroker + m_iBrokersCount - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate all column values for the next row
|
||||
* and store them in the internal record structure.
|
||||
* Increment the number of rows generated.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* TRUE, if there are more records in the ADDRESS table; FALSE
|
||||
* othewise.
|
||||
*/
|
||||
bool GenerateNextRecord() {
|
||||
GenerateCARow();
|
||||
GenerateAPRows();
|
||||
|
||||
// Return false if all the rows have been generated
|
||||
return (MoreRecords());
|
||||
}
|
||||
|
||||
/*
|
||||
* Return CUSTOMER_ACCOUNT row from the internal structure.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* current CUSTOMER_ACCOUNT record.
|
||||
*/
|
||||
// PCUSTOMER_ACCOUNT_ROW GetCARow() {return &m_row.m_ca;}
|
||||
const CUSTOMER_ACCOUNT_ROW &GetCARow() {
|
||||
return m_row.m_ca;
|
||||
}
|
||||
/*
|
||||
* Return ACCOUNT_PERMISSION row from the internal structure.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* current ACCOUNT_PERMISSION record.
|
||||
*/
|
||||
const ACCOUNT_PERMISSION_ROW &GetAPRow(UINT i) {
|
||||
if (i < m_iPermsForCA)
|
||||
return m_row.m_perm[i];
|
||||
else
|
||||
throw std::range_error("Account Permission row index out of bounds.");
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the number of ACCOUNT_PERMISSION rows for the current
|
||||
* CUSTOMER_ACCOUNT row.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* the number of permissions for the account.
|
||||
*/
|
||||
UINT GetCAPermsCount() {
|
||||
return m_iPermsForCA;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the customer ID for the currently generated CA_ID id.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* customer id of the account in the current CUSTOMER_ACCOUNT
|
||||
* record.
|
||||
*/
|
||||
TIdent GetCurrentC_ID() {
|
||||
return m_cust.GetCurrentC_ID();
|
||||
}
|
||||
/*
|
||||
* Return the customer tier for the currently generated CA_ID id.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* customer tier of the customer, whose account is in the current
|
||||
* CUSTOMER_ACCOUNT record.
|
||||
*/
|
||||
eCustomerTier GetCurrentC_TIER() {
|
||||
return m_cust.GetC_TIER(m_cust.GetCurrentC_ID());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // CUSTOMER_ACCOUNTS_AND_PERMISSIONS_TABLE_H
|
||||
138
external/duckdb/third_party/tpce-tool/include/main/CustomerSelection.h
vendored
Normal file
138
external/duckdb/third_party/tpce-tool/include/main/CustomerSelection.h
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy, Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This class encapsulates customer tier distribution
|
||||
* functions and provides functionality to:
|
||||
* - Generate customer tier based on customer ID
|
||||
* - Generate non-uniform customer ID
|
||||
* - Generate customer IDs in a specified partition, and
|
||||
* outside the specified partition a set percentage of
|
||||
* the time.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef CUSTOMER_SELECTION_H
|
||||
#define CUSTOMER_SELECTION_H
|
||||
|
||||
#include "utilities/Random.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
/*
|
||||
* Define customer tier type.
|
||||
*/
|
||||
enum eCustomerTier { eCustomerTierOne = 1, eCustomerTierTwo, eCustomerTierThree };
|
||||
|
||||
class CCustomerSelection {
|
||||
CRandom *m_pRND; // external random number generator
|
||||
|
||||
TIdent m_iStartFromCustomer;
|
||||
TIdent m_iCustomerCount;
|
||||
|
||||
/*
|
||||
* Used when partitioning by C_ID.
|
||||
*/
|
||||
bool m_bPartitionByCID;
|
||||
int m_iPartitionPercent;
|
||||
TIdent m_iMyStartFromCustomer;
|
||||
TIdent m_iMyCustomerCount;
|
||||
|
||||
/*
|
||||
* Forward permutation (used to convert ordinal C_ID into real C_ID).
|
||||
*/
|
||||
TIdent Permute(TIdent iLow, TIdent iHigh);
|
||||
|
||||
/*
|
||||
* Inverse permutation (used to convert real C_ID into it's ordinal
|
||||
* number).
|
||||
*/
|
||||
TIdent InversePermute(TIdent iLow, TIdent iHigh);
|
||||
|
||||
/*
|
||||
* Get lower 3 digits.
|
||||
*/
|
||||
inline TIdent CLow(TIdent C_ID) {
|
||||
return ((C_ID - 1) % 1000);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get higher digits.
|
||||
*/
|
||||
inline TIdent CHigh(TIdent C_ID) {
|
||||
return ((C_ID - 1) / 1000);
|
||||
}
|
||||
|
||||
public:
|
||||
/*
|
||||
* Default constructor.
|
||||
*/
|
||||
CCustomerSelection();
|
||||
|
||||
/*
|
||||
* Constructor to set the customer range.
|
||||
*/
|
||||
CCustomerSelection(CRandom *pRND, TIdent iStartFromCustomer, TIdent iCustomerCount);
|
||||
|
||||
/*
|
||||
* Constructor to set subrange when paritioning by C_ID.
|
||||
*/
|
||||
CCustomerSelection(CRandom *pRND, TIdent iStartFromCustomer, TIdent iCustomerCount, int iPartitionPercent,
|
||||
TIdent iMyStartFromCustomer, TIdent iMyCustomerCount);
|
||||
|
||||
/*
|
||||
* Re-set the customer range for the parition.
|
||||
*/
|
||||
void SetPartitionRange(TIdent iStartFromCustomer, TIdent iCustomerCount);
|
||||
|
||||
/*
|
||||
* Return scrambled inverse customer id.
|
||||
*/
|
||||
UINT GetInverseCID(TIdent C_ID);
|
||||
|
||||
/*
|
||||
* Return customer tier.
|
||||
*/
|
||||
eCustomerTier GetTier(TIdent C_ID);
|
||||
|
||||
/*
|
||||
* Return a non-uniform random customer and the associated tier.
|
||||
*/
|
||||
void GenerateRandomCustomer(TIdent &C_ID, eCustomerTier &C_TIER);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // CUSTOMER_SELECTION_H
|
||||
110
external/duckdb/third_party/tpce-tool/include/main/CustomerTable.h
vendored
Normal file
110
external/duckdb/third_party/tpce-tool/include/main/CustomerTable.h
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Contains class definition to generate Customer table.
|
||||
*/
|
||||
#ifndef CUSTOMER_TABLE_H
|
||||
#define CUSTOMER_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
const int iNumEMAIL_DOMAINs = 6;
|
||||
|
||||
class CCustomerTable : public TableTemplate<CUSTOMER_ROW> {
|
||||
private:
|
||||
TIdent m_iRowsToGenerate; // total # of rows to generate
|
||||
CPerson m_person;
|
||||
const AreaCodeDataFile_t &m_Phones;
|
||||
TIdent m_iStartFromCustomer;
|
||||
TIdent m_iCustomerCount;
|
||||
const StatusTypeDataFile_t &m_StatusTypeFile; // STATUS_TYPE table from the flat file
|
||||
CCustomerSelection m_CustomerSelection;
|
||||
TIdent m_iCompanyCount; // number of Companies
|
||||
unsigned int m_iExchangeCount; // number of Exchanges
|
||||
|
||||
void GenerateC_ST_ID();
|
||||
void GeneratePersonInfo(); // generate last name, first name, and gender.
|
||||
void GenerateC_DOB();
|
||||
void GenerateC_AD_ID();
|
||||
void GenerateC_CTRY_1();
|
||||
void GenerateC_LOCAL_1();
|
||||
void GenerateC_AREA_1();
|
||||
void GenerateC_EXT_1();
|
||||
void GenerateC_CTRY_2();
|
||||
void GenerateC_LOCAL_2();
|
||||
void GenerateC_AREA_2();
|
||||
void GenerateC_EXT_2();
|
||||
void GenerateC_CTRY_3();
|
||||
void GenerateC_LOCAL_3();
|
||||
void GenerateC_AREA_3();
|
||||
void GenerateC_EXT_3();
|
||||
void GenerateC_EMAIL_1_and_C_EMAIL_2();
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit
|
||||
*/
|
||||
void InitNextLoadUnit();
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor for the CUSTOMER table class.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN dfm - input flat files loaded in memory
|
||||
* IN iCustomerCount - number of customers to generate
|
||||
* IN iStartFromCustomer - ordinal position of the first customer in
|
||||
* the sequence (Note: 1-based)
|
||||
*/
|
||||
CCustomerTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer);
|
||||
|
||||
TIdent GenerateNextC_ID(); // generate C_ID and store state information;
|
||||
// return false if all ids are generated
|
||||
TIdent GetCurrentC_ID(); // return current customer id
|
||||
|
||||
void GetC_TAX_ID(TIdent C_ID,
|
||||
char *szOutput); // return tax id (ala Social Security number)
|
||||
eCustomerTier GetC_TIER(TIdent C_ID); // returns unique C_TIER for a given customer id
|
||||
|
||||
bool GenerateNextRecord(); // generates the next table row
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // CUSTOMER_TABLE_H
|
||||
169
external/duckdb/third_party/tpce-tool/include/main/CustomerTaxRateTable.h
vendored
Normal file
169
external/duckdb/third_party/tpce-tool/include/main/CustomerTaxRateTable.h
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Customer Taxrates table.
|
||||
*/
|
||||
#ifndef CUSTOMER_TAX_RATE_TABLE_H
|
||||
#define CUSTOMER_TAX_RATE_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
#include "CustomerTable.h"
|
||||
#include "AddressTable.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
const UINT iTaxRatesPerCust = 2; // number of tax rates per customer
|
||||
const int iMaxDivOrCtryName = 6;
|
||||
|
||||
// Number of RNG calls to skip for one row in order
|
||||
// to not use any of the random values from the previous row.
|
||||
const int iRNGSkipOneRowCustomerTaxrate = 5; // real max count in v3.5: 2
|
||||
|
||||
typedef struct CUSTOMER_TAXRATE_ROWS {
|
||||
CUSTOMER_TAXRATE_ROW
|
||||
m_row[iTaxRatesPerCust]; // multiple tax rates rows per customer
|
||||
} * PCUSTOMER_TAXRATE_ROWS;
|
||||
|
||||
class CCustomerTaxRateTable : public TableTemplate<CUSTOMER_TAXRATE_ROWS> {
|
||||
CCustomerTable m_cust;
|
||||
CAddressTable m_addr;
|
||||
const TaxRateDivisionDataFile_t &m_division_rates;
|
||||
const TaxRateCountryDataFile_t &m_country_rates;
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
m_rnd.SetSeed(
|
||||
m_rnd.RndNthElement(RNGSeedTableDefault, (RNGSEED)m_cust.GetCurrentC_ID() * iRNGSkipOneRowCustomerTaxrate));
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
}
|
||||
|
||||
// generate the tax row deterministically for a given customer and country
|
||||
// or division code
|
||||
const ITaxRateFileRecord &GetTaxRow(TIdent C_ID, UINT iCode, bool bCtry) {
|
||||
RNGSEED OldSeed;
|
||||
UINT iThreshold;
|
||||
// const vector<TTaxRateInputRow> *pRates;
|
||||
|
||||
OldSeed = m_rnd.GetSeed();
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedBaseTaxRateRow, (RNGSEED)C_ID));
|
||||
|
||||
if (bCtry) {
|
||||
// Return appropriate country record.
|
||||
iThreshold = (UINT)m_rnd.RndIntRange(0, m_country_rates.getBucket(iCode).size() - 1);
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
return m_country_rates.getBucket(iCode)[iThreshold];
|
||||
}
|
||||
|
||||
// It's not a country so return the appropriate division record.
|
||||
iThreshold = (UINT)m_rnd.RndIntRange(0, m_division_rates.getBucket(iCode).size() - 1);
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
return m_division_rates.getBucket(iCode)[iThreshold];
|
||||
}
|
||||
|
||||
public:
|
||||
CCustomerTaxRateTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer,
|
||||
bool bCacheEnabled = false)
|
||||
: TableTemplate<CUSTOMER_TAXRATE_ROWS>(), m_cust(dfm, iCustomerCount, iStartFromCustomer),
|
||||
m_addr(dfm, iCustomerCount, iStartFromCustomer, true, bCacheEnabled),
|
||||
m_division_rates(dfm.TaxRateDivisionDataFile()), m_country_rates(dfm.TaxRateCountryDataFile()){};
|
||||
|
||||
/*
|
||||
* Generates all column values for the next row.
|
||||
*/
|
||||
bool GenerateNextRecord() {
|
||||
UINT iDivCode, iCtryCode;
|
||||
|
||||
if (m_cust.GetCurrentC_ID() % iDefaultLoadUnitSize == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
++m_iLastRowNumber;
|
||||
|
||||
m_cust.GenerateNextC_ID(); // next customer id
|
||||
m_addr.GenerateNextAD_ID(); // next address id (to get the one for this
|
||||
// customer)
|
||||
m_addr.GetDivisionAndCountryCodes(iDivCode, iCtryCode);
|
||||
// Fill the country tax rate row
|
||||
m_row.m_row[0].CX_C_ID = m_cust.GetCurrentC_ID(); // fill the customer
|
||||
// id
|
||||
// Select the country rate
|
||||
strncpy(m_row.m_row[0].CX_TX_ID, GetCountryTaxRow(m_cust.GetCurrentC_ID(), iCtryCode).TX_ID_CSTR(),
|
||||
sizeof(m_row.m_row[0].CX_TX_ID));
|
||||
|
||||
// Fill the division tax rate row
|
||||
m_row.m_row[1].CX_C_ID = m_cust.GetCurrentC_ID(); // fill the customer
|
||||
// id
|
||||
// Select the division rate
|
||||
strncpy(m_row.m_row[1].CX_TX_ID, GetDivisionTaxRow(m_cust.GetCurrentC_ID(), iDivCode).TX_ID_CSTR(),
|
||||
sizeof(m_row.m_row[0].CX_TX_ID));
|
||||
|
||||
m_bMoreRecords = m_cust.MoreRecords();
|
||||
|
||||
return (MoreRecords());
|
||||
}
|
||||
|
||||
const CUSTOMER_TAXRATE_ROW &GetRowByIndex(UINT i) {
|
||||
if (i < iTaxRatesPerCust)
|
||||
return m_row.m_row[i];
|
||||
else
|
||||
throw std::range_error("Customer Taxrate row index out of bounds.");
|
||||
}
|
||||
|
||||
UINT GetTaxRatesCount() {
|
||||
return iTaxRatesPerCust;
|
||||
} // tax rates per customer
|
||||
|
||||
// generate country tax row for a given customer
|
||||
const ITaxRateFileRecord &GetCountryTaxRow(TIdent C_ID, UINT iCtryCode) {
|
||||
return GetTaxRow(C_ID, iCtryCode, true);
|
||||
}
|
||||
|
||||
// generate division tax row for a given customer
|
||||
const ITaxRateFileRecord &GetDivisionTaxRow(TIdent C_ID, UINT iDivCode) {
|
||||
return GetTaxRow(C_ID, iDivCode, false);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // CUSTOMER_TAX_RATE_TABLE_H
|
||||
140
external/duckdb/third_party/tpce-tool/include/main/DM.h
vendored
Normal file
140
external/duckdb/third_party/tpce-tool/include/main/DM.h
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This class provides Data-Maintenance functionality.
|
||||
* It generates all necessary inputs for the
|
||||
* Data-Maintenance transaction. These inputs are then
|
||||
* made available to a sponsor provided callback interface
|
||||
* to the SUT (see DMSUTInterface.h).
|
||||
*
|
||||
* The constructor to this class accepts the following
|
||||
* parameters.
|
||||
*
|
||||
* - pSUT: a pointer to an instance of a sponsor provided
|
||||
* subclassing of the CCESUTInterface class.
|
||||
* - pLogger: a pointer to an
|
||||
*instance of CEGenLogger or a sponsor provided subclassing of the CBaseLogger
|
||||
*class.
|
||||
* - dfm: a reference to an instance of the
|
||||
* CInputFiles class containing all input files loaded
|
||||
* into memory.
|
||||
* - iActiveCustomerCount: the total number of customers
|
||||
* to emulate. C_IDs will be generated in the range of
|
||||
* 1 to iActiveCustomerCount.
|
||||
* - RandomSeed: seed to be used for the RNG.
|
||||
*
|
||||
* The DM class provides the following entry point.
|
||||
*
|
||||
* - DoTxn: this entry point will generate all required
|
||||
* inputs and provide those inputs to sponsor code at the
|
||||
* - DoCleanupTxn: this entry point will execute the
|
||||
* Trade-Cleanup transaction. This must be run at the
|
||||
* start of each measurement run before any CE or MEE
|
||||
* transactions are executed.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef DM_H
|
||||
#define DM_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "TxnHarnessStructs.h"
|
||||
#include "DMSUTInterface.h"
|
||||
#include "BaseLogger.h"
|
||||
#include "DriverParamSettings.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CDM {
|
||||
private:
|
||||
CDriverGlobalSettings m_DriverGlobalSettings;
|
||||
CDriverDMSettings m_DriverDMSettings;
|
||||
|
||||
CRandom m_rnd;
|
||||
CCustomerSelection m_CustomerSelection;
|
||||
CCustomerAccountsAndPermissionsTable m_AccsAndPerms;
|
||||
const CSecurityFile &m_Securities;
|
||||
const CCompanyFile &m_Companies;
|
||||
const TaxRateDivisionDataFile_t &m_TaxRatesDivision;
|
||||
const StatusTypeDataFile_t &m_StatusType;
|
||||
TIdent m_iSecurityCount;
|
||||
TIdent m_iCompanyCount;
|
||||
TIdent m_iStartFromCompany;
|
||||
INT32 m_iDivisionTaxCount;
|
||||
TIdent m_iStartFromCustomer;
|
||||
|
||||
INT32 m_DataMaintenanceTableNum;
|
||||
|
||||
TDataMaintenanceTxnInput m_TxnInput;
|
||||
TTradeCleanupTxnInput m_CleanupTxnInput;
|
||||
CDMSUTInterface *m_pSUT;
|
||||
CBaseLogger *m_pLogger;
|
||||
|
||||
// Automatically generate unique RNG seeds
|
||||
void AutoSetRNGSeeds(UINT32 UniqueId);
|
||||
|
||||
TIdent GenerateRandomCustomerId();
|
||||
|
||||
TIdent GenerateRandomCustomerAccountId();
|
||||
|
||||
TIdent GenerateRandomCompanyId();
|
||||
|
||||
TIdent GenerateRandomSecurityId();
|
||||
|
||||
// Initialization that is common for all constructors.
|
||||
void Initialize();
|
||||
|
||||
public:
|
||||
// Constructor - automatice RNG seed generation
|
||||
CDM(CDMSUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &dfm, TIdent iConfiguredCustomerCount,
|
||||
TIdent iActiveCustomerCount, INT32 iScaleFactor, INT32 iDaysOfInitialTrades, UINT32 UniqueId);
|
||||
|
||||
// Constructor - RNG seed provided
|
||||
CDM(CDMSUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &dfm, TIdent iConfiguredCustomerCount,
|
||||
TIdent iActiveCustomerCount, INT32 iScaleFactor, INT32 iDaysOfInitialTrades, UINT32 UniqueId, RNGSEED RNGSeed);
|
||||
|
||||
~CDM(void);
|
||||
|
||||
RNGSEED GetRNGSeed(void);
|
||||
void DoTxn(void);
|
||||
void DoCleanupTxn(void);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // #ifndef DM_H
|
||||
69
external/duckdb/third_party/tpce-tool/include/main/DMSUTInterface.h
vendored
Normal file
69
external/duckdb/third_party/tpce-tool/include/main/DMSUTInterface.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
/******************************************************************************
|
||||
* Description: Interface base class to be used for deriving a sponsor
|
||||
* specific class for commmunicating with the SUT for
|
||||
* the Data-Maintenance transaction.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef DM_SUT_INTERFACE_H
|
||||
#define DM_SUT_INTERFACE_H
|
||||
|
||||
#include "TxnHarnessStructs.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CDMSUTInterface {
|
||||
public:
|
||||
/*
|
||||
* Virtual destructor. Provided so that a sponsor-specific
|
||||
* destructor can be called on destruction from the base-class pointer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
virtual ~CDMSUTInterface(){};
|
||||
|
||||
virtual bool DataMaintenance(PDataMaintenanceTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
virtual bool TradeCleanup(PTradeCleanupTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // DM_SUT_INTERFACE_H
|
||||
200
external/duckdb/third_party/tpce-tool/include/main/DailyMarketTable.h
vendored
Normal file
200
external/duckdb/third_party/tpce-tool/include/main/DailyMarketTable.h
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the DAILY_MARKET table.
|
||||
*/
|
||||
#ifndef DAILY_MARKET_TABLE_H
|
||||
#define DAILY_MARKET_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
#include "SecurityPriceRange.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
const int iTradeDaysInYear = 261; // the number of trading days in a year (for DAILY_MARKET)
|
||||
const int iDailyMarketYears = 5; // number of years of history in DAILY_MARKET
|
||||
const int iDailyMarketTotalRows = iDailyMarketYears * iTradeDaysInYear;
|
||||
|
||||
const double fDailyMarketCloseMin = fMinSecPrice;
|
||||
const double fDailyMarketCloseMax = fMaxSecPrice;
|
||||
|
||||
const double fDailyMarketHighRelativeToClose = 1.05;
|
||||
const double fDailyMarketLowRelativeToClose = 0.92;
|
||||
|
||||
const INT64 iDailyMarketVolumeMax = 10000;
|
||||
const INT64 iDailyMarketVolumeMin = 1000;
|
||||
|
||||
const int iRNGSkipOneRowDailyMarket = 2; // number of RNG calls for one row
|
||||
|
||||
typedef struct DAILY_MARKET_GEN_ROW {
|
||||
// big array of all the history for one security
|
||||
DAILY_MARKET_ROW m_daily_market[iDailyMarketTotalRows];
|
||||
} * PDAILY_MARKET_GEN_ROW;
|
||||
|
||||
class CDailyMarketTable : public TableTemplate<DAILY_MARKET_GEN_ROW> {
|
||||
TIdent m_iStartFromSecurity;
|
||||
TIdent m_iSecurityCount;
|
||||
const CSecurityFile &m_SecurityFile;
|
||||
CDateTime m_StartFromDate;
|
||||
int m_iDailyMarketTotalRows;
|
||||
// Number of times GenerateNextRecord() was called for the current security
|
||||
// data. Needed to decide when to generate next security's data.
|
||||
int m_iRowsGeneratedPerSecurity;
|
||||
// Stores whether there is another security(s) for which to
|
||||
// generate daily market data.
|
||||
bool m_bMoreSecurities;
|
||||
TIdent m_iSecurityCountForOneLoadUnit;
|
||||
|
||||
/*
|
||||
* DAILY_MARKET table rows generation
|
||||
*/
|
||||
void GenerateDailyMarketRows() {
|
||||
int i;
|
||||
int iDayNo = 0; // start from the oldest date (start date)
|
||||
char szSymbol[cSYMBOL_len + 1];
|
||||
|
||||
// Create symbol only once.
|
||||
//
|
||||
m_SecurityFile.CreateSymbol(m_iLastRowNumber, szSymbol, static_cast<int>(sizeof(szSymbol)));
|
||||
|
||||
for (i = 0; i < m_iDailyMarketTotalRows; ++i) {
|
||||
// copy the symbol
|
||||
strncpy(m_row.m_daily_market[i].DM_S_SYMB, szSymbol, sizeof(m_row.m_daily_market[i].DM_S_SYMB));
|
||||
|
||||
// generate trade date
|
||||
m_row.m_daily_market[i].DM_DATE = m_StartFromDate;
|
||||
m_row.m_daily_market[i].DM_DATE.Add(iDayNo, 0);
|
||||
|
||||
// generate prices
|
||||
m_row.m_daily_market[i].DM_CLOSE =
|
||||
m_rnd.RndDoubleIncrRange(fDailyMarketCloseMin, fDailyMarketCloseMax, 0.01);
|
||||
m_row.m_daily_market[i].DM_HIGH = m_row.m_daily_market[i].DM_CLOSE * fDailyMarketHighRelativeToClose;
|
||||
m_row.m_daily_market[i].DM_LOW = m_row.m_daily_market[i].DM_CLOSE * fDailyMarketLowRelativeToClose;
|
||||
|
||||
// generate volume
|
||||
m_row.m_daily_market[i].DM_VOL = m_rnd.RndInt64Range(iDailyMarketVolumeMin, iDailyMarketVolumeMax);
|
||||
|
||||
++iDayNo; // go one day forward for the next row
|
||||
|
||||
if ((iDayNo % DaysPerWeek) == DaysPerWorkWeek)
|
||||
iDayNo += 2; // skip weekend
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedTableDefault, (RNGSEED)m_iLastRowNumber * iRNGSkipOneRowDailyMarket));
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
}
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor.
|
||||
*/
|
||||
CDailyMarketTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer)
|
||||
: TableTemplate<DAILY_MARKET_GEN_ROW>(), m_SecurityFile(dfm.SecurityFile()),
|
||||
m_iDailyMarketTotalRows(sizeof(m_row.m_daily_market) / sizeof(m_row.m_daily_market[0])),
|
||||
m_iRowsGeneratedPerSecurity(sizeof(m_row.m_daily_market) / sizeof(m_row.m_daily_market[0])),
|
||||
m_bMoreSecurities(true) // initialize once
|
||||
{
|
||||
// Set DAILY_MARKET start date to Jan 03, 2000.
|
||||
//
|
||||
m_StartFromDate.Set(iDailyMarketBaseYear, iDailyMarketBaseMonth, iDailyMarketBaseDay, iDailyMarketBaseHour,
|
||||
iDailyMarketBaseMinute, iDailyMarketBaseSecond, iDailyMarketBaseMsec);
|
||||
|
||||
m_bMoreRecords = true; // initialize once
|
||||
|
||||
m_iSecurityCount = m_SecurityFile.CalculateSecurityCount(iCustomerCount);
|
||||
m_iStartFromSecurity = m_SecurityFile.CalculateStartFromSecurity(iStartFromCustomer);
|
||||
|
||||
m_iSecurityCountForOneLoadUnit = m_SecurityFile.CalculateSecurityCount(iDefaultLoadUnitSize);
|
||||
|
||||
m_iLastRowNumber = m_iStartFromSecurity;
|
||||
};
|
||||
|
||||
bool GenerateNextRecord() {
|
||||
++m_iRowsGeneratedPerSecurity;
|
||||
|
||||
if (m_iRowsGeneratedPerSecurity >= m_iDailyMarketTotalRows) {
|
||||
if (m_bMoreSecurities) {
|
||||
// Reset RNG at Load Unit boundary, so that all data is
|
||||
// repeatable.
|
||||
//
|
||||
if (m_iLastRowNumber % m_iSecurityCountForOneLoadUnit == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
GenerateDailyMarketRows(); // generate all rows for the current
|
||||
// security
|
||||
|
||||
++m_iLastRowNumber;
|
||||
|
||||
// Update state info
|
||||
m_bMoreSecurities = m_iLastRowNumber < (m_iStartFromSecurity + m_iSecurityCount);
|
||||
|
||||
m_iRowsGeneratedPerSecurity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Return false when generated the last row of the last security
|
||||
if (!m_bMoreSecurities && (m_iRowsGeneratedPerSecurity == m_iDailyMarketTotalRows - 1)) {
|
||||
m_bMoreRecords = false;
|
||||
}
|
||||
|
||||
return (MoreRecords());
|
||||
}
|
||||
|
||||
const DAILY_MARKET_ROW &GetRow() {
|
||||
return m_row.m_daily_market[m_iRowsGeneratedPerSecurity];
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // DAILY_MARKET_TABLE_H
|
||||
1084
external/duckdb/third_party/tpce-tool/include/main/DriverParamSettings.h
vendored
Normal file
1084
external/duckdb/third_party/tpce-tool/include/main/DriverParamSettings.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
51
external/duckdb/third_party/tpce-tool/include/main/DriverTypes.h
vendored
Normal file
51
external/duckdb/third_party/tpce-tool/include/main/DriverTypes.h
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Matt Emmerton
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: Driver types and names
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef DRIVER_TYPES_H
|
||||
#define DRIVER_TYPES_H
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
enum eDriverType { eDriverEGenLoader, eDriverAll, eDriverCE, eDriverMEE, eDriverDM, eDriverMax };
|
||||
|
||||
extern char szDriverTypeNames[eDriverMax][14];
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // DRIVER_TYPES_H
|
||||
43
external/duckdb/third_party/tpce-tool/include/main/EGenBaseLoader_stdafx.h
vendored
Normal file
43
external/duckdb/third_party/tpce-tool/include/main/EGenBaseLoader_stdafx.h
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
#ifndef EGEN_BASELOADER_STDAFX_H
|
||||
#define EGEN_BASELOADER_STDAFX_H
|
||||
|
||||
#include "BaseLoader.h"
|
||||
#include "BaseLoaderFactory.h"
|
||||
|
||||
#endif // #ifndef EGEN_BASELOADER_STDAFX_H
|
||||
378
external/duckdb/third_party/tpce-tool/include/main/EGenGenerateAndLoad.h
vendored
Normal file
378
external/duckdb/third_party/tpce-tool/include/main/EGenGenerateAndLoad.h
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains a class that acts as a client to the table
|
||||
* generation classes (EGenTables) and to the loader classes (EGenBaseLoader).
|
||||
* It provides routines for generating and loading the table data or its
|
||||
* subset.
|
||||
*/
|
||||
|
||||
#ifndef EGEN_GENERATE_AND_LOAD_H
|
||||
#define EGEN_GENERATE_AND_LOAD_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "utilities/EGenStandardTypes.h"
|
||||
#include "input/DataFileManager.h"
|
||||
#include "EGenGenerateAndLoadBaseOutput.h"
|
||||
#include "utilities/MiscConsts.h"
|
||||
#include "BaseLoaderFactory.h"
|
||||
#include "BaseLogger.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CGenerateAndLoad {
|
||||
// Data File Manager
|
||||
const DataFileManager &m_dfm;
|
||||
// Ordinal position (1-based) of the first customer in the sequence
|
||||
TIdent m_iStartFromCustomer;
|
||||
// The number of customers to generate from the starting position
|
||||
TIdent m_iCustomerCount;
|
||||
// Total number of customers in the database
|
||||
TIdent m_iTotalCustomers;
|
||||
// Number of customers in one load unit for generating initial trades
|
||||
UINT m_iLoadUnitSize;
|
||||
// Number of customers per 1 tpsE
|
||||
UINT m_iScaleFactor;
|
||||
// Time period for which to generate initial trades
|
||||
UINT m_iHoursOfInitialTrades;
|
||||
// External loader factory to create table loaders
|
||||
CBaseLoaderFactory *m_pLoaderFactory;
|
||||
// External class used to output load progress
|
||||
CGenerateAndLoadBaseOutput *m_pOutput;
|
||||
// Logger instance
|
||||
CBaseLogger *m_pLogger;
|
||||
// Parameter instance
|
||||
CLoaderSettings m_LoaderSettings;
|
||||
// Whether to use cache when generating initial population
|
||||
bool m_bCacheEnabled;
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN inputFiles - in-memory representation of input
|
||||
* flat files IN iCustomerCount - number of customers to build (for
|
||||
* this class instance) IN iStartFromCustomer - first customer id IN
|
||||
* iTotalCustomers - total number of customers in the database IN
|
||||
* iLoadUnitSize - minimal number of customers that can be build
|
||||
* (should always be 1000) IN iScaleFactor - number of customers for
|
||||
* 1tpsE IN iDaysOfInitialTrades- number of 8-hour days of initial trades
|
||||
* per customer IN pLoaderFactory - factory to create loader classes
|
||||
* IN pLogger - parameter logging interface
|
||||
* IN pOutput - interface to output information to a
|
||||
* user during the build process IN szInDir - input flat file
|
||||
* directory needed for tables loaded from flat files IN bCacheEnabled -
|
||||
* whether or not to use caching during data generation
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CGenerateAndLoad(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer,
|
||||
TIdent iTotalCustomers, UINT iLoadUnitSize, UINT iScaleFactor, UINT iDaysOfInitialTrades,
|
||||
CBaseLoaderFactory *pLoaderFactory, CBaseLogger *pLogger, CGenerateAndLoadBaseOutput *pOutput,
|
||||
bool bCacheEnabled = false);
|
||||
|
||||
/*
|
||||
* Generate and load ADDRESS table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadAddress();
|
||||
/*
|
||||
* Generate and load CHARGE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadCharge();
|
||||
/*
|
||||
* Generate and load COMMISSION_RATE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadCommissionRate();
|
||||
/*
|
||||
* Generate and load COMPANY_COMPETITOR table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadCompanyCompetitor();
|
||||
/*
|
||||
* Generate and load COMPANY table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadCompany();
|
||||
/*
|
||||
* Generate and load CUSTOMER_ACCOUNT, ACCOUNT_PERMISSION table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadCustomerAccountAndAccountPermission();
|
||||
/*
|
||||
* Generate and load CUSTOMER table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadCustomer();
|
||||
/*
|
||||
* Generate and load CUSTOMER_TAXRATE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadCustomerTaxrate();
|
||||
/*
|
||||
* Generate and load DAILY_MARKET table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadDailyMarket();
|
||||
/*
|
||||
* Generate and load EXCHANGE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadExchange();
|
||||
/*
|
||||
* Generate and load FINANCIAL table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadFinancial();
|
||||
/*
|
||||
* Generate and load HOLDING, HOLDING_HISTORY, TRADE, TRADE_HISTORY,
|
||||
* SETTLEMENT, CASH_TRANSACTION, BROKER table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadHoldingAndTrade();
|
||||
/*
|
||||
* Generate and load INDUSTRY table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadIndustry();
|
||||
/*
|
||||
* Generate and load LAST_TRADE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadLastTrade();
|
||||
/*
|
||||
* Generate and load NEWS_ITEM, NEWS_XREF table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadNewsItemAndNewsXRef();
|
||||
/*
|
||||
* Generate and load SECTOR table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadSector();
|
||||
/*
|
||||
* Generate and load SECURITY table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadSecurity();
|
||||
/*
|
||||
* Generate and load STATUS_TYPE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadStatusType();
|
||||
/*
|
||||
* Generate and load TAXRATE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadTaxrate();
|
||||
/*
|
||||
* Generate and load TRADE_TYPE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadTradeType();
|
||||
/*
|
||||
* Generate and load WATCH_LIST, WATCH_ITEM table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadWatchListAndWatchItem();
|
||||
/*
|
||||
* Generate and load ZIP_CODE table.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadZipCode();
|
||||
|
||||
/*
|
||||
* Generate and load All tables that are constant in size.
|
||||
*
|
||||
* Spec definition: Fixed tables.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadFixedTables();
|
||||
|
||||
/*
|
||||
* Generate and load All tables (except BROKER) that scale with the size
|
||||
* of the CUSTOMER table, but do not grow in runtime.
|
||||
*
|
||||
* Spec definition: Scaling tables.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadScalingTables();
|
||||
|
||||
/*
|
||||
* Generate and load All trade related tables and BROKER (included here to
|
||||
* facilitate generation of a consistent database).
|
||||
*
|
||||
* Spec definition: Growing tables.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void GenerateAndLoadGrowingTables();
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // EGEN_GENERATE_AND_LOAD_H
|
||||
112
external/duckdb/third_party/tpce-tool/include/main/EGenGenerateAndLoadBaseOutput.h
vendored
Normal file
112
external/duckdb/third_party/tpce-tool/include/main/EGenGenerateAndLoadBaseOutput.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
/*
|
||||
* Base interface used to output generation and load progress
|
||||
* and any other supporting information.
|
||||
*/
|
||||
|
||||
#ifndef EGEN_GENERATE_AND_LOAD_BASE_OUTPUT_H
|
||||
#define EGEN_GENERATE_AND_LOAD_BASE_OUTPUT_H
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CGenerateAndLoadBaseOutput {
|
||||
public:
|
||||
/*
|
||||
* Virtual destructor. Provided so that a sponsor-specific
|
||||
* destructor can be called on destruction from the base-class pointer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
virtual ~CGenerateAndLoadBaseOutput(){};
|
||||
|
||||
/*
|
||||
* Output beginning of table generation.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szMsg - string to output to the user
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void OutputStart(string szMsg) = 0;
|
||||
|
||||
/*
|
||||
* Output progress of table generation.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szMsg - string to output to the user
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void OutputProgress(string szMsg) = 0;
|
||||
|
||||
/*
|
||||
* Output completion of table generation.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szMsg - string to output to the user
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void OutputComplete(string szMsg) = 0;
|
||||
|
||||
/*
|
||||
* Output end-of-line.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szMsg - string to output to the user
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void OutputNewline() = 0;
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // EGEN_GENERATE_AND_LOAD_BASE_OUTPUT_H
|
||||
112
external/duckdb/third_party/tpce-tool/include/main/EGenGenerateAndLoadStandardOutput.h
vendored
Normal file
112
external/duckdb/third_party/tpce-tool/include/main/EGenGenerateAndLoadStandardOutput.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class for generation and load output to stdout.
|
||||
*/
|
||||
|
||||
#ifndef EGEN_GENERATE_AND_LOAD_STANDARD_OUTPUT_H
|
||||
#define EGEN_GENERATE_AND_LOAD_STANDARD_OUTPUT_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include "EGenGenerateAndLoadBaseOutput.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CGenerateAndLoadStandardOutput : public CGenerateAndLoadBaseOutput {
|
||||
public:
|
||||
/*
|
||||
* Output beginning of table generation.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szMsg - string to output to the user
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void OutputStart(string szMsg) {
|
||||
// printf("%s", szMsg.c_str());
|
||||
// fflush(stdout); // in case there is no newline character in szMsg
|
||||
}
|
||||
|
||||
/*
|
||||
* Output progress of table generation.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szMsg - string to output to the user
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void OutputProgress(string szMsg) {
|
||||
// printf("%s", szMsg.c_str());
|
||||
// fflush(stdout); // in case there is no newline character in szMsg
|
||||
}
|
||||
|
||||
/*
|
||||
* Output completion of table generation.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szMsg - string to output to the user
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void OutputComplete(string szMsg) {
|
||||
// printf("%s", szMsg.c_str());
|
||||
// fflush(stdout); // in case there is no newline character in szMsg
|
||||
}
|
||||
|
||||
/*
|
||||
* Output end-of-line.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN szMsg - string to output to the user
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void OutputNewline() {
|
||||
// printf("\n");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // EGEN_GENERATE_AND_LOAD_STANDARD_OUTPUT_H
|
||||
61
external/duckdb/third_party/tpce-tool/include/main/EGenGenerateAndLoad_stdafx.h
vendored
Normal file
61
external/duckdb/third_party/tpce-tool/include/main/EGenGenerateAndLoad_stdafx.h
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
#ifndef EGEN_GENERATE_AND_LOAD_STDAFX_H
|
||||
#define EGEN_GENERATE_AND_LOAD_STDAFX_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "EGenTables_stdafx.h"
|
||||
#include "EGenBaseLoader_stdafx.h"
|
||||
#include "EGenGenerateAndLoadBaseOutput.h"
|
||||
#include "EGenGenerateAndLoadStandardOutput.h"
|
||||
#include "DriverParamSettings.h"
|
||||
#include "EGenLogger.h"
|
||||
#include "EGenGenerateAndLoad.h"
|
||||
|
||||
#endif // #ifndef EGEN_GENERATE_AND_LOAD_STDAFX_H
|
||||
90
external/duckdb/third_party/tpce-tool/include/main/EGenLoader_stdafx.h
vendored
Normal file
90
external/duckdb/third_party/tpce-tool/include/main/EGenLoader_stdafx.h
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
#ifndef EGEN_LOADER_STDAFX_H
|
||||
#define EGEN_LOADER_STDAFX_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef COMPILE_ODBC_LOAD
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
// ODBC headers
|
||||
#include <sql.h>
|
||||
#include <sqlext.h>
|
||||
#include <odbcss.h>
|
||||
#endif // COMPILE_ODBC_LOAD
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
using namespace std;
|
||||
|
||||
#include "EGenTables_stdafx.h"
|
||||
#include "EGenBaseLoader_stdafx.h"
|
||||
#include "EGenGenerateAndLoad_stdafx.h"
|
||||
|
||||
// Include one or more load types.
|
||||
#include "NullLoad_stdafx.h"
|
||||
#ifdef COMPILE_FLAT_FILE_LOAD
|
||||
#include "FlatFileLoad_stdafx.h"
|
||||
#endif
|
||||
#ifdef COMPILE_ODBC_LOAD
|
||||
#include "win/ODBCLoad_stdafx.h"
|
||||
#endif
|
||||
#ifdef COMPILE_CUSTOM_LOAD
|
||||
#include "custom/CustomLoad_stdafx.h"
|
||||
#endif
|
||||
#ifdef CUSTOM_LOAD_INCLUDE
|
||||
#define COMPILE_CUSTOM_LOAD
|
||||
#include CUSTOM_LOAD_INCLUDE
|
||||
#endif
|
||||
|
||||
// Generic Error Codes
|
||||
#define ERROR_BAD_OPTION 1
|
||||
#define ERROR_INPUT_FILE 2
|
||||
#define ERROR_INVALID_OPTION_VALUE 3
|
||||
|
||||
#endif // #ifndef EGEN_LOADER_STDAFX_H
|
||||
117
external/duckdb/third_party/tpce-tool/include/main/EGenLogFormatterTab.h
vendored
Normal file
117
external/duckdb/third_party/tpce-tool/include/main/EGenLogFormatterTab.h
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Matt Emmerton
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This file implements the methods for formatting
|
||||
* log entries in TSV or CSV format.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef EGEN_LOG_FORMATTER_H
|
||||
#define EGEN_LOG_FORMATTER_H
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip> // for log message formatting
|
||||
#include <sstream> // for log message construction
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "DriverParamSettings.h"
|
||||
#include "BaseLogFormatter.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CLogFormatTab : public CBaseLogFormatter {
|
||||
friend class EGenLogger;
|
||||
|
||||
private:
|
||||
ostringstream logmsg;
|
||||
string emptyString;
|
||||
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
CLogFormatTab() : emptyString("") {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// CE Transaction Settings
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
string GetLogOutput(CBrokerVolumeSettings &parms);
|
||||
|
||||
string GetLogOutput(CCustomerPositionSettings &parms);
|
||||
|
||||
string GetLogOutput(CMarketWatchSettings &parms);
|
||||
|
||||
string GetLogOutput(CSecurityDetailSettings &parms);
|
||||
|
||||
string GetLogOutput(CTradeLookupSettings &parms);
|
||||
|
||||
string GetLogOutput(CTradeOrderSettings &parms);
|
||||
|
||||
string GetLogOutput(CTradeUpdateSettings &parms);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// CE Transaction Mix Settings
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
string GetLogOutput(CTxnMixGeneratorSettings &parms);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Loader Settings
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
string GetLogOutput(CLoaderSettings &parms);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Driver Settings
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
string GetLogOutput(CDriverGlobalSettings &parms);
|
||||
|
||||
string GetLogOutput(CDriverCESettings &parms);
|
||||
|
||||
string GetLogOutput(CDriverCEPartitionSettings &parms);
|
||||
|
||||
string GetLogOutput(CDriverMEESettings &parms);
|
||||
|
||||
string GetLogOutput(CDriverDMSettings &parms);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // EGEN_LOG_FORMATTER_H
|
||||
93
external/duckdb/third_party/tpce-tool/include/main/EGenLogger.h
vendored
Normal file
93
external/duckdb/third_party/tpce-tool/include/main/EGenLogger.h
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Matt Emmerton
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This file implements the interface for data logging.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef EGEN_LOGGER_H
|
||||
#define EGEN_LOGGER_H
|
||||
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
|
||||
#include "utilities/EGenStandardTypes.h"
|
||||
#include "DriverParamSettings.h"
|
||||
#include "utilities/EGenVersion.h"
|
||||
#include "BaseLogger.h"
|
||||
#include "EGenLogFormatterTab.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CEGenLogger : public CBaseLogger {
|
||||
private:
|
||||
char m_Filename[iMaxPath];
|
||||
ofstream m_Log;
|
||||
CMutex m_LogLock;
|
||||
|
||||
bool SendToLoggerImpl(const char *szPrefix, const char *szTimestamp, const char *szMsg) {
|
||||
// m_LogLock.lock();
|
||||
// cerr << szPrefix << " " << szTimestamp << " " << szMsg << endl;
|
||||
// // m_Log.flush();
|
||||
// if (!m_Log)
|
||||
// {
|
||||
// throw CSystemErr(CSystemErr::eWriteFile,
|
||||
// "CEGenLogger::SendToLoggerImpl");
|
||||
// }
|
||||
// m_LogLock.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
CEGenLogger(eDriverType drvType, UINT32 UniqueId, const char *szFilename, CBaseLogFormatter *pLogFormatter)
|
||||
: CBaseLogger(drvType, UniqueId, pLogFormatter){
|
||||
// Copy Log Filename
|
||||
// strncpy(m_Filename, szFilename, sizeof(m_Filename));
|
||||
|
||||
// // Open Log File
|
||||
// m_Log.open(m_Filename);
|
||||
// if (!m_Log)
|
||||
// {
|
||||
// throw CSystemErr(CSystemErr::eCreateFile,
|
||||
// "CEGenLogger::CEGenLogger");
|
||||
// }
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // EGEN_LOGGER_H
|
||||
48
external/duckdb/third_party/tpce-tool/include/main/EGenNullLoader_stdafx.h
vendored
Normal file
48
external/duckdb/third_party/tpce-tool/include/main/EGenNullLoader_stdafx.h
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#ifndef EGEN_NULLLOADER_STDAFX_H
|
||||
#define EGEN_NULLLOADER_STDAFX_H
|
||||
|
||||
#include "NullLoader.h"
|
||||
#include "NullLoaderFactory.h"
|
||||
|
||||
#endif // #ifndef EGEN_NULLLOADER_STDAFX_H
|
||||
63
external/duckdb/third_party/tpce-tool/include/main/EGenTables_common.h
vendored
Normal file
63
external/duckdb/third_party/tpce-tool/include/main/EGenTables_common.h
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Chris Ruemmler
|
||||
*/
|
||||
|
||||
#ifndef EGEN_TABLES_COMMON_H
|
||||
#define EGEN_TABLES_COMMON_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "utilities/EGenStandardTypes.h"
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "TableRows.h"
|
||||
#include "TableTemplate.h"
|
||||
#include "Person.h"
|
||||
#include "CustomerSelection.h"
|
||||
|
||||
#endif // #ifndef EGEN_TABLES_COMMON_H
|
||||
81
external/duckdb/third_party/tpce-tool/include/main/EGenTables_stdafx.h
vendored
Normal file
81
external/duckdb/third_party/tpce-tool/include/main/EGenTables_stdafx.h
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
#ifndef EGEN_TABLES_STDAFX_H
|
||||
#define EGEN_TABLES_STDAFX_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
using namespace std;
|
||||
|
||||
#include "utilities/EGenStandardTypes.h"
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "TableRows.h"
|
||||
#include "TableTemplate.h"
|
||||
#include "Person.h"
|
||||
#include "CustomerSelection.h"
|
||||
#include "CustomerTable.h"
|
||||
#include "CompanyTable.h" //must be before Address and Financial tables
|
||||
#include "FinancialTable.h"
|
||||
#include "AddressTable.h"
|
||||
#include "CustomerAccountsAndPermissionsTable.h"
|
||||
#include "CustomerTaxRateTable.h"
|
||||
#include "HoldingsAndTradesTable.h"
|
||||
#include "WatchListsAndItemsTable.h"
|
||||
#include "SecurityTable.h"
|
||||
#include "DailyMarketTable.h"
|
||||
#include "Brokers.h"
|
||||
#include "ExchangeTable.h"
|
||||
#include "CompanyCompetitorTable.h"
|
||||
#include "ZipCodeTable.h"
|
||||
#include "NewsItemAndXRefTable.h"
|
||||
#include "MEESecurity.h" // must be before LastTradeTable.h
|
||||
#include "LastTradeTable.h"
|
||||
#include "TradeGen.h"
|
||||
|
||||
#endif // #ifndef EGEN_TABLES_STDAFX_H
|
||||
49
external/duckdb/third_party/tpce-tool/include/main/ExchangeIDs.h
vendored
Normal file
49
external/duckdb/third_party/tpce-tool/include/main/ExchangeIDs.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
#ifndef EXCHANGE_IDS_H
|
||||
#define EXCHANGE_IDS_H
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
// Exchange IDs corresponding to the Exchange.txt flat file.
|
||||
// Note: The order of enumeration members must match the order
|
||||
// of rows in the Exchange.txt flat file.
|
||||
enum eExchangeID { eNYSE = 0, eNASDAQ, eAMEX, ePCX };
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // EXCHANGE_IDS_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/ExchangeTable.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/ExchangeTable.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Exchange table.
|
||||
*/
|
||||
#ifndef EXCHANGE_TABLE_H
|
||||
#define EXCHANGE_TABLE_H
|
||||
|
||||
#include "FixedTable.h"
|
||||
#include "input/DataFileTypes.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CExchangeTable : public FixedTable<ExchangeDataFile_t, EXCHANGE_ROW> {
|
||||
private:
|
||||
INT32 securityCount[4];
|
||||
|
||||
/*
|
||||
* Computes the number of securities in each exchange.
|
||||
* Assumption is that exchanges are ordered in NYSE, NASDAQ, AMEX, PCX
|
||||
* order. (This is the current ordering of exchanges in the
|
||||
* flat_in/Exchange.txt file.)
|
||||
*/
|
||||
void ComputeNumSecurities(TIdent iCustomerCount);
|
||||
|
||||
public:
|
||||
CExchangeTable(const ExchangeDataFile_t &dataFile, TIdent configuredCustomers);
|
||||
~CExchangeTable();
|
||||
|
||||
virtual void LoadTableRow();
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // EXCHANGE_TABLE_H
|
||||
243
external/duckdb/third_party/tpce-tool/include/main/FinancialTable.h
vendored
Normal file
243
external/duckdb/third_party/tpce-tool/include/main/FinancialTable.h
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy, Cecil Reames, Matt Emmerton, Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Financial table.
|
||||
*/
|
||||
#ifndef FINANCIAL_TABLE_H
|
||||
#define FINANCIAL_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
#include "CompanyTable.h"
|
||||
#include "utilities/Money.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
const int iYearsForFins = 5;
|
||||
const int iQuartersInYear = 4;
|
||||
const int iFinsPerCompany = iYearsForFins * iQuartersInYear; // 5 years of 4 quaters each year
|
||||
|
||||
// multiplier to get the diluted number of shares from outstanding
|
||||
const double fDilutedSharesMultiplier = 1.1;
|
||||
|
||||
// Multipliers for previous quarter to get the current quarter data
|
||||
const double fFinDataDownMult = 0.9;
|
||||
const double fFinDataUpMult = 1.15;
|
||||
const double fFinDataIncr = 0.00000000000001;
|
||||
|
||||
const double fFinancialRevenueMin = 100000.00;
|
||||
const double fFinancialRevenueMax = 16000000000.00;
|
||||
|
||||
const double fFinancialEarningsMin = -300000000.00;
|
||||
const double fFinancialEarningsMax = 3000000000.00;
|
||||
|
||||
const INT64 iFinancialOutBasicMin = 400000;
|
||||
const INT64 iFinancialOutBasicMax = INT64_CONST(9500000000);
|
||||
|
||||
const double fFinancialInventMin = 0.00;
|
||||
const double fFinancialInventMax = 2000000000.00;
|
||||
|
||||
const double fFinancialAssetsMin = 100000.00;
|
||||
const double fFinancialAssetsMax = 65000000000.00;
|
||||
|
||||
const double fFinancialLiabMin = 100000.00;
|
||||
const double fFinancialLiabMax = 35000000000.00;
|
||||
|
||||
// Number of RNG calls to skip for one row in order
|
||||
// to not use any of the random values from the previous row.
|
||||
//
|
||||
const int iRNGSkipOneRowFinancial = 6 + iFinsPerCompany * 6;
|
||||
|
||||
typedef struct FINANCIAL_GEN_ROW {
|
||||
FINANCIAL_ROW m_financials[iFinsPerCompany];
|
||||
} * PFINANCIAL_GEN_ROW;
|
||||
|
||||
class CFinancialTable : public TableTemplate<FINANCIAL_GEN_ROW> {
|
||||
CCompanyTable m_CompanyTable;
|
||||
int m_iFinYear; // first year to generate financials
|
||||
int m_iFinQuarter; // first quarter to generate financials (0-based)
|
||||
// Number of times GenerateNextRecord() was called for the current company
|
||||
// data. Needed to decide when to generate next company's data.
|
||||
int m_iRowsGeneratedPerCompany;
|
||||
// Stores whether there is another company(s) for which to
|
||||
// generate financial data.
|
||||
bool m_bMoreCompanies;
|
||||
TIdent m_iFinancialCountForOneLoadUnit;
|
||||
|
||||
//
|
||||
// Generate the financial data for the next company.
|
||||
//
|
||||
// Return whether there are more companies to generate data for.
|
||||
//
|
||||
bool GenerateFinancialRows() {
|
||||
TIdent FI_CO_ID;
|
||||
int iFinYear, iFinQuarter;
|
||||
int i;
|
||||
CMoney fRev, fEarn, fInvent, fAssets, fLiab, fBasicEPS, fDilutEPS, fMargin;
|
||||
INT64 iOutBasic, iOutDilut;
|
||||
|
||||
// Set starting values for financial values
|
||||
FI_CO_ID = m_CompanyTable.GetCurrentCO_ID();
|
||||
iFinYear = m_iFinYear;
|
||||
iFinQuarter = m_iFinQuarter;
|
||||
|
||||
fRev = m_rnd.RndDoubleIncrRange(fFinancialRevenueMin, fFinancialRevenueMax, 0.01);
|
||||
fEarn = m_rnd.RndDoubleIncrRange(
|
||||
fFinancialEarningsMin, fRev < fFinancialEarningsMax ? fRev.DollarAmount() : fFinancialEarningsMax, 0.01);
|
||||
iOutBasic = m_rnd.RndInt64Range(iFinancialOutBasicMin, iFinancialOutBasicMax);
|
||||
iOutDilut = 0;
|
||||
fInvent = m_rnd.RndDoubleIncrRange(fFinancialInventMin, fFinancialInventMax, 0.01);
|
||||
fAssets = m_rnd.RndDoubleIncrRange(fFinancialAssetsMin, fFinancialAssetsMax, 0.01);
|
||||
fLiab = m_rnd.RndDoubleIncrRange(fFinancialLiabMin, fFinancialLiabMax, 0.01);
|
||||
fBasicEPS = 0.00;
|
||||
fDilutEPS = 0.00;
|
||||
fMargin = 0.00;
|
||||
|
||||
for (i = 0; i < iFinsPerCompany; ++i) {
|
||||
// Compute values for this quarter
|
||||
fRev = fRev * m_rnd.RndDoubleIncrRange(fFinDataDownMult, fFinDataUpMult, fFinDataIncr);
|
||||
fEarn = fEarn * m_rnd.RndDoubleIncrRange(fFinDataDownMult, fFinDataUpMult, fFinDataIncr);
|
||||
if (fEarn >= fRev) { // earnings cannot be greater than the revenue
|
||||
fEarn = fEarn * fFinDataDownMult;
|
||||
}
|
||||
iOutBasic =
|
||||
(INT64)((double)iOutBasic * m_rnd.RndDoubleIncrRange(fFinDataDownMult, fFinDataUpMult, fFinDataIncr));
|
||||
iOutDilut = (INT64)((double)iOutBasic * fDilutedSharesMultiplier);
|
||||
fInvent = fInvent * m_rnd.RndDoubleIncrRange(fFinDataDownMult, fFinDataUpMult, fFinDataIncr);
|
||||
fAssets = fAssets * m_rnd.RndDoubleIncrRange(fFinDataDownMult, fFinDataUpMult, fFinDataIncr);
|
||||
fLiab = fLiab * m_rnd.RndDoubleIncrRange(fFinDataDownMult, fFinDataUpMult, fFinDataIncr);
|
||||
fBasicEPS = fEarn / (double)iOutBasic;
|
||||
fDilutEPS = fEarn / (double)iOutDilut;
|
||||
fMargin = fEarn / fRev.DollarAmount();
|
||||
|
||||
// Assign values for this quarter
|
||||
m_row.m_financials[i].FI_CO_ID = FI_CO_ID;
|
||||
m_row.m_financials[i].FI_YEAR = iFinYear;
|
||||
m_row.m_financials[i].FI_QTR = iFinQuarter + 1;
|
||||
m_row.m_financials[i].FI_QTR_START_DATE.Set(iFinYear, iFinQuarter * 3 + 1, 1);
|
||||
m_row.m_financials[i].FI_REVENUE = fRev.DollarAmount();
|
||||
m_row.m_financials[i].FI_NET_EARN = fEarn.DollarAmount();
|
||||
m_row.m_financials[i].FI_OUT_BASIC = iOutBasic;
|
||||
m_row.m_financials[i].FI_OUT_DILUT = iOutDilut;
|
||||
m_row.m_financials[i].FI_INVENTORY = fInvent.DollarAmount();
|
||||
m_row.m_financials[i].FI_ASSETS = fAssets.DollarAmount();
|
||||
m_row.m_financials[i].FI_LIABILITY = fLiab.DollarAmount();
|
||||
m_row.m_financials[i].FI_BASIC_EPS = fBasicEPS.DollarAmount();
|
||||
m_row.m_financials[i].FI_DILUT_EPS = fDilutEPS.DollarAmount();
|
||||
m_row.m_financials[i].FI_MARGIN = fMargin.DollarAmount();
|
||||
|
||||
// Increment quarter
|
||||
iFinQuarter++;
|
||||
if (iFinQuarter == iQuartersInYear) { // reached the last quarter in the year
|
||||
iFinQuarter = 0; // start from the first quarter
|
||||
++iFinYear; // increment year
|
||||
}
|
||||
}
|
||||
|
||||
return m_CompanyTable.GenerateNextCO_ID();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedTableDefault, (RNGSEED)m_iLastRowNumber * iRNGSkipOneRowFinancial));
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
}
|
||||
|
||||
public:
|
||||
CFinancialTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer)
|
||||
: TableTemplate<FINANCIAL_GEN_ROW>(), m_CompanyTable(dfm, iCustomerCount, iStartFromCustomer),
|
||||
m_iRowsGeneratedPerCompany(iFinsPerCompany), m_bMoreCompanies(true) {
|
||||
// Start year to generate financials.
|
||||
// Count by quaters
|
||||
m_iFinYear = iDailyMarketBaseYear; // first financial year
|
||||
m_iFinQuarter = iDailyMarketBaseMonth / 3; // first financial quarter in the year (0-based)
|
||||
|
||||
m_bMoreRecords = true; // initialize once
|
||||
|
||||
m_iFinancialCountForOneLoadUnit =
|
||||
dfm.CompanyFile().CalculateCompanyCount(iDefaultLoadUnitSize) * iFinsPerCompany;
|
||||
|
||||
m_iLastRowNumber = dfm.CompanyFile().CalculateStartFromCompany(iStartFromCustomer) * iFinsPerCompany;
|
||||
};
|
||||
|
||||
bool GenerateNextRecord() {
|
||||
// Reset RNG at Load Unit boundary, so that all data is repeatable.
|
||||
//
|
||||
if (m_iLastRowNumber % m_iFinancialCountForOneLoadUnit == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
++m_iLastRowNumber;
|
||||
|
||||
++m_iRowsGeneratedPerCompany;
|
||||
|
||||
if (m_iRowsGeneratedPerCompany >= iFinsPerCompany) {
|
||||
if (m_bMoreCompanies) {
|
||||
// All rows for the current company have been returned
|
||||
// therefore move on to the next company
|
||||
m_bMoreCompanies = GenerateFinancialRows();
|
||||
|
||||
m_iRowsGeneratedPerCompany = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Return false when generated the last row of the last company
|
||||
if (!m_bMoreCompanies && (m_iRowsGeneratedPerCompany == iFinsPerCompany - 1)) {
|
||||
m_bMoreRecords = false;
|
||||
}
|
||||
|
||||
return MoreRecords();
|
||||
}
|
||||
|
||||
const FINANCIAL_ROW &GetRow() {
|
||||
return m_row.m_financials[m_iRowsGeneratedPerCompany];
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FINANCIAL_TABLE_H
|
||||
93
external/duckdb/third_party/tpce-tool/include/main/FixedTable.h
vendored
Normal file
93
external/duckdb/third_party/tpce-tool/include/main/FixedTable.h
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Fixed table.
|
||||
*/
|
||||
#ifndef FIXED_TABLE_H
|
||||
#define FIXED_TABLE_H
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
template <class DataFileT, class TableRowT> class FixedTable {
|
||||
protected:
|
||||
const DataFileT &df;
|
||||
TableRowT tableRow;
|
||||
int recordIdx;
|
||||
|
||||
public:
|
||||
FixedTable(const DataFileT &dataFile) : df(dataFile), tableRow(), recordIdx(-1) {
|
||||
}
|
||||
|
||||
virtual ~FixedTable() {
|
||||
}
|
||||
|
||||
/*
|
||||
* Generates all fields for the next record.
|
||||
* Template Method Pattern used to accommodate
|
||||
* subtle variations in underlying data files
|
||||
* (i.e. DataFile vs. WeightedDataFile).
|
||||
*/
|
||||
bool GenerateNextRecord() {
|
||||
// Don't increment past size().
|
||||
if (MaxRecordIdx() != recordIdx) {
|
||||
++recordIdx;
|
||||
}
|
||||
|
||||
// See if we just went past the end.
|
||||
if (MaxRecordIdx() == recordIdx) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadTableRow();
|
||||
|
||||
// We have a valid record.
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual unsigned int MaxRecordIdx() const {
|
||||
return df.size();
|
||||
}
|
||||
|
||||
const TableRowT &GetRow() const {
|
||||
return tableRow;
|
||||
}
|
||||
|
||||
virtual void LoadTableRow() = 0;
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
#endif // FIXED_TABLE_H
|
||||
72
external/duckdb/third_party/tpce-tool/include/main/FlatAccountPermissionLoad.h
vendored
Normal file
72
external/duckdb/third_party/tpce-tool/include/main/FlatAccountPermissionLoad.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for Account Permission.
|
||||
*/
|
||||
|
||||
#ifndef FLAT_ACCOUNT_PERMISSION_LOAD_H
|
||||
#define FLAT_ACCOUNT_PERMISSION_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatAccountPermissionLoad : public CFlatFileLoader<ACCOUNT_PERMISSION_ROW> {
|
||||
private:
|
||||
const std::string AccountPermissionRowFmt;
|
||||
|
||||
public:
|
||||
CFlatAccountPermissionLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<ACCOUNT_PERMISSION_ROW>(szFileName, FlatFileOutputMode),
|
||||
AccountPermissionRowFmt("%" PRId64 "|%s|%s|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const ACCOUNT_PERMISSION_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, AccountPermissionRowFmt.c_str(), next_record.AP_CA_ID, next_record.AP_ACL,
|
||||
next_record.AP_TAX_ID, next_record.AP_L_NAME, next_record.AP_F_NAME);
|
||||
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatAccountPermissionLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_ACCOUNT_PERMISSION_LOAD_H
|
||||
71
external/duckdb/third_party/tpce-tool/include/main/FlatAddressLoad.h
vendored
Normal file
71
external/duckdb/third_party/tpce-tool/include/main/FlatAddressLoad.h
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for Address.
|
||||
*/
|
||||
|
||||
#ifndef FLAT_ADDRESS_LOAD_H
|
||||
#define FLAT_ADDRESS_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatAddressLoad : public CFlatFileLoader<ADDRESS_ROW> {
|
||||
private:
|
||||
const std::string AddressRowFmt;
|
||||
|
||||
public:
|
||||
CFlatAddressLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<ADDRESS_ROW>(szFileName, FlatFileOutputMode), AddressRowFmt("%" PRId64 "|%s|%s|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const ADDRESS_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, AddressRowFmt.c_str(), next_record.AD_ID, next_record.AD_LINE1, next_record.AD_LINE2,
|
||||
next_record.AD_ZC_CODE, next_record.AD_CTRY);
|
||||
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatAddressLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_ADDRESS_LOAD_H
|
||||
71
external/duckdb/third_party/tpce-tool/include/main/FlatBrokerLoad.h
vendored
Normal file
71
external/duckdb/third_party/tpce-tool/include/main/FlatBrokerLoad.h
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for BROKER.
|
||||
*/
|
||||
|
||||
#ifndef FLAT_BROKER_LOAD_H
|
||||
#define FLAT_BROKER_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatBrokerLoad : public CFlatFileLoader<BROKER_ROW> {
|
||||
private:
|
||||
const std::string BrokerRowFmt;
|
||||
|
||||
public:
|
||||
CFlatBrokerLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<BROKER_ROW>(szFileName, FlatFileOutputMode), BrokerRowFmt("%" PRId64 "|%s|%s|%d|%.2f\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const BROKER_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, BrokerRowFmt.c_str(), next_record.B_ID, next_record.B_ST_ID, next_record.B_NAME,
|
||||
next_record.B_NUM_TRADES, next_record.B_COMM_TOTAL);
|
||||
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatBrokerLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_BROKER_LOAD_H
|
||||
73
external/duckdb/third_party/tpce-tool/include/main/FlatCashTransactionLoad.h
vendored
Normal file
73
external/duckdb/third_party/tpce-tool/include/main/FlatCashTransactionLoad.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for CASH_TRANSACTION.
|
||||
*/
|
||||
#ifndef FLAT_CASH_TRANSACTION_LOAD_H
|
||||
#define FLAT_CASH_TRANSACTION_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatCashTransactionLoad : public CFlatFileLoader<CASH_TRANSACTION_ROW> {
|
||||
private:
|
||||
CDateTime Flat_CT_DTS;
|
||||
const std::string CashTransactionRowFmt;
|
||||
|
||||
public:
|
||||
CFlatCashTransactionLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<CASH_TRANSACTION_ROW>(szFileName, FlatFileOutputMode),
|
||||
CashTransactionRowFmt("%" PRId64 "|%s|%.2f|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const CASH_TRANSACTION_ROW &next_record) {
|
||||
Flat_CT_DTS = next_record.CT_DTS;
|
||||
int rc = fprintf(hOutFile, CashTransactionRowFmt.c_str(), next_record.CT_T_ID,
|
||||
Flat_CT_DTS.ToStr(FlatFileDateTimeFormat), next_record.CT_AMT, next_record.CT_NAME);
|
||||
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatCashTransactionLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_CASH_TRANSACTION_LOAD_H
|
||||
72
external/duckdb/third_party/tpce-tool/include/main/FlatChargeLoad.h
vendored
Normal file
72
external/duckdb/third_party/tpce-tool/include/main/FlatChargeLoad.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for CHARGE.
|
||||
*/
|
||||
#ifndef FLAT_CHARGE_LOAD_H
|
||||
#define FLAT_CHARGE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
#include "TableTypes.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatChargeLoad : public CFlatFileLoader<CHARGE_ROW> {
|
||||
private:
|
||||
const std::string ChargeRowFmt;
|
||||
|
||||
public:
|
||||
CFlatChargeLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<CHARGE_ROW>(szFileName, FlatFileOutputMode), ChargeRowFmt("%s|%d|%.2f\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const CHARGE_ROW &next_record) {
|
||||
// fprintf(hOutFile, "%s\n", next_record.ToString('|').c_str());
|
||||
int rc =
|
||||
fprintf(hOutFile, ChargeRowFmt.c_str(), next_record.CH_TT_ID, next_record.CH_C_TIER, next_record.CH_CHRG);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatChargeLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_CHARGE_LOAD_H
|
||||
72
external/duckdb/third_party/tpce-tool/include/main/FlatCommissionRateLoad.h
vendored
Normal file
72
external/duckdb/third_party/tpce-tool/include/main/FlatCommissionRateLoad.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for COMMISSIOIN_RATE.
|
||||
*/
|
||||
#ifndef FLAT_COMMISSION_RATE_LOAD_H
|
||||
#define FLAT_COMMISSION_RATE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
#include "TableTypes.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatCommissionRateLoad : public CFlatFileLoader<COMMISSION_RATE_ROW> {
|
||||
private:
|
||||
const std::string CommissionRateRowFmt;
|
||||
|
||||
public:
|
||||
CFlatCommissionRateLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<COMMISSION_RATE_ROW>(szFileName, FlatFileOutputMode),
|
||||
CommissionRateRowFmt("%d|%s|%s|%d|%d|%.2f\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const COMMISSION_RATE_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, CommissionRateRowFmt.c_str(), next_record.CR_C_TIER, next_record.CR_TT_ID,
|
||||
next_record.CR_EX_ID, next_record.CR_FROM_QTY, next_record.CR_TO_QTY, next_record.CR_RATE);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatCommissionRateLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_COMMISSION_RATE_LOAD_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/FlatCompanyCompetitorLoad.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/FlatCompanyCompetitorLoad.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for COMPANY_COMPETITOR.
|
||||
*/
|
||||
#ifndef FLAT_COMPANY_COMPETITOR_LOAD_H
|
||||
#define FLAT_COMPANY_COMPETITOR_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatCompanyCompetitorLoad : public CFlatFileLoader<COMPANY_COMPETITOR_ROW> {
|
||||
private:
|
||||
const std::string CompanyCompetitorRowFmt;
|
||||
|
||||
public:
|
||||
CFlatCompanyCompetitorLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<COMPANY_COMPETITOR_ROW>(szFileName, FlatFileOutputMode),
|
||||
CompanyCompetitorRowFmt("%" PRId64 "|%" PRId64 "|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const COMPANY_COMPETITOR_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, CompanyCompetitorRowFmt.c_str(), next_record.CP_CO_ID, next_record.CP_COMP_CO_ID,
|
||||
next_record.CP_IN_ID);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatCompanyCompetitorLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_COMPANY_COMPETITOR_LOAD_H
|
||||
73
external/duckdb/third_party/tpce-tool/include/main/FlatCompanyLoad.h
vendored
Normal file
73
external/duckdb/third_party/tpce-tool/include/main/FlatCompanyLoad.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for COMPANY.
|
||||
*/
|
||||
#ifndef FLAT_COMPANY_LOAD_H
|
||||
#define FLAT_COMPANY_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatCompanyLoad : public CFlatFileLoader<COMPANY_ROW> {
|
||||
private:
|
||||
CDateTime Flat_CO_OPEN_DATE;
|
||||
const std::string CompanyRowFmt;
|
||||
|
||||
public:
|
||||
CFlatCompanyLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<COMPANY_ROW>(szFileName, FlatFileOutputMode),
|
||||
CompanyRowFmt("%" PRId64 "|%s|%s|%s|%s|%s|%" PRId64 "|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const COMPANY_ROW &next_record) {
|
||||
Flat_CO_OPEN_DATE = next_record.CO_OPEN_DATE;
|
||||
int rc = fprintf(hOutFile, CompanyRowFmt.c_str(), next_record.CO_ID, next_record.CO_ST_ID, next_record.CO_NAME,
|
||||
next_record.CO_IN_ID, next_record.CO_SP_RATE, next_record.CO_CEO, next_record.CO_AD_ID,
|
||||
next_record.CO_DESC, Flat_CO_OPEN_DATE.ToStr(FlatFileDateFormat));
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatCompanyLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_COMPANY_LOAD_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/FlatCustomerAccountLoad.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/FlatCustomerAccountLoad.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for CUSTOMER_ACCOUNT.
|
||||
*/
|
||||
#ifndef FLAT_CUSTOMER_ACCOUNT_LOAD_H
|
||||
#define FLAT_CUSTOMER_ACCOUNT_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatCustomerAccountLoad : public CFlatFileLoader<CUSTOMER_ACCOUNT_ROW> {
|
||||
private:
|
||||
const std::string CustomerAccountRowFmt;
|
||||
|
||||
public:
|
||||
CFlatCustomerAccountLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<CUSTOMER_ACCOUNT_ROW>(szFileName, FlatFileOutputMode),
|
||||
CustomerAccountRowFmt("%" PRId64 "|%" PRId64 "|%" PRId64 "|%s|%d|%.2f\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const CUSTOMER_ACCOUNT_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, CustomerAccountRowFmt.c_str(), next_record.CA_ID, next_record.CA_B_ID,
|
||||
next_record.CA_C_ID, next_record.CA_NAME, (int)next_record.CA_TAX_ST, next_record.CA_BAL);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatCustomerAccountLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_CUSTOMER_ACCOUNT_LOAD_H
|
||||
79
external/duckdb/third_party/tpce-tool/include/main/FlatCustomerLoad.h
vendored
Normal file
79
external/duckdb/third_party/tpce-tool/include/main/FlatCustomerLoad.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for CUSTOMER.
|
||||
*/
|
||||
|
||||
#ifndef FLAT_CUSTOMER_LOAD_H
|
||||
#define FLAT_CUSTOMER_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatCustomerLoad : public CFlatFileLoader<CUSTOMER_ROW> {
|
||||
private:
|
||||
CDateTime Flat_C_DOB;
|
||||
const std::string CustomerRowFmt;
|
||||
|
||||
public:
|
||||
CFlatCustomerLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<CUSTOMER_ROW>(szFileName, FlatFileOutputMode),
|
||||
CustomerRowFmt("%" PRId64 "|%s|%s|%s|%s|%s|%c|%d|%s|%" PRId64
|
||||
"|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const CUSTOMER_ROW &next_record) {
|
||||
Flat_C_DOB = next_record.C_DOB;
|
||||
int rc = fprintf(hOutFile, CustomerRowFmt.c_str(), next_record.C_ID, next_record.C_TAX_ID, next_record.C_ST_ID,
|
||||
next_record.C_L_NAME, next_record.C_F_NAME, next_record.C_M_NAME, next_record.C_GNDR,
|
||||
(int)next_record.C_TIER, Flat_C_DOB.ToStr(FlatFileDateFormat), next_record.C_AD_ID,
|
||||
next_record.C_CTRY_1, next_record.C_AREA_1, next_record.C_LOCAL_1, next_record.C_EXT_1,
|
||||
next_record.C_CTRY_2, next_record.C_AREA_2, next_record.C_LOCAL_2, next_record.C_EXT_2,
|
||||
next_record.C_CTRY_3, next_record.C_AREA_3, next_record.C_LOCAL_3, next_record.C_EXT_3,
|
||||
next_record.C_EMAIL_1, next_record.C_EMAIL_2);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatCustomerLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_CUSTOMER_LOAD_H
|
||||
69
external/duckdb/third_party/tpce-tool/include/main/FlatCustomerTaxrateLoad.h
vendored
Normal file
69
external/duckdb/third_party/tpce-tool/include/main/FlatCustomerTaxrateLoad.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for CUSTOMER_TAXRATE.
|
||||
*/
|
||||
#ifndef FLAT_CUSTOMER_TAXRATE_LOAD_H
|
||||
#define FLAT_CUSTOMER_TAXRATE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatCustomerTaxrateLoad : public CFlatFileLoader<CUSTOMER_TAXRATE_ROW> {
|
||||
private:
|
||||
const std::string CustomerTaxrateRowFmt;
|
||||
|
||||
public:
|
||||
CFlatCustomerTaxrateLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<CUSTOMER_TAXRATE_ROW>(szFileName, FlatFileOutputMode),
|
||||
CustomerTaxrateRowFmt("%s|%" PRId64 "\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const CUSTOMER_TAXRATE_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, CustomerTaxrateRowFmt.c_str(), next_record.CX_TX_ID, next_record.CX_C_ID);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatCustomerTaxrateLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_CUSTOMER_TAXRATE_LOAD_H
|
||||
74
external/duckdb/third_party/tpce-tool/include/main/FlatDailyMarketLoad.h
vendored
Normal file
74
external/duckdb/third_party/tpce-tool/include/main/FlatDailyMarketLoad.h
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for DAILY_MARKET.
|
||||
*/
|
||||
#ifndef FLAT_DAILY_MARKET_LOAD_H
|
||||
#define FLAT_DAILY_MARKET_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatDailyMarketLoad : public CFlatFileLoader<DAILY_MARKET_ROW> {
|
||||
private:
|
||||
CDateTime Flat_DM_DATE;
|
||||
const std::string DailyMarketRowFmt;
|
||||
|
||||
public:
|
||||
CFlatDailyMarketLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<DAILY_MARKET_ROW>(szFileName, FlatFileOutputMode),
|
||||
DailyMarketRowFmt("%s|%s|%.2f|%.2f|%.2f|%" PRId64 "\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const DAILY_MARKET_ROW &next_record) {
|
||||
Flat_DM_DATE = next_record.DM_DATE;
|
||||
int rc =
|
||||
fprintf(hOutFile, DailyMarketRowFmt.c_str(), Flat_DM_DATE.ToStr(FlatFileDateFormat), next_record.DM_S_SYMB,
|
||||
next_record.DM_CLOSE, next_record.DM_HIGH, next_record.DM_LOW, next_record.DM_VOL);
|
||||
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatDailyMarketLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_DAILY_MARKET_LOAD_H
|
||||
72
external/duckdb/third_party/tpce-tool/include/main/FlatExchangeLoad.h
vendored
Normal file
72
external/duckdb/third_party/tpce-tool/include/main/FlatExchangeLoad.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for EXCHANGE.
|
||||
*/
|
||||
#ifndef FLAT_EXCHANGE_LOAD_H
|
||||
#define FLAT_EXCHANGE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatExchangeLoad : public CFlatFileLoader<EXCHANGE_ROW> {
|
||||
private:
|
||||
const std::string ExchangeRowFmt;
|
||||
|
||||
public:
|
||||
CFlatExchangeLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<EXCHANGE_ROW>(szFileName, FlatFileOutputMode),
|
||||
ExchangeRowFmt("%s|%s|%d|%d|%d|%s|%" PRId64 "\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const EXCHANGE_ROW &next_record) {
|
||||
int rc =
|
||||
fprintf(hOutFile, ExchangeRowFmt.c_str(), next_record.EX_ID, next_record.EX_NAME, next_record.EX_NUM_SYMB,
|
||||
next_record.EX_OPEN, next_record.EX_CLOSE, next_record.EX_DESC, next_record.EX_AD_ID);
|
||||
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatExchangeLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_EXCHANGE_LOAD_H
|
||||
52
external/duckdb/third_party/tpce-tool/include/main/FlatFileLoad_common.h
vendored
Normal file
52
external/duckdb/third_party/tpce-tool/include/main/FlatFileLoad_common.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Chris Ruemmler
|
||||
*/
|
||||
|
||||
#ifndef FLAT_FILE_LOAD_COMMON_H
|
||||
#define FLAT_FILE_LOAD_COMMON_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include "FlatFileLoader.h"
|
||||
#include "TableRows.h"
|
||||
#include "utilities/DateTime.h"
|
||||
#include "utilities/error.h"
|
||||
|
||||
#endif // #ifndef FLAT_FILE_LOAD_COMMON_H
|
||||
85
external/duckdb/third_party/tpce-tool/include/main/FlatFileLoad_stdafx.h
vendored
Normal file
85
external/duckdb/third_party/tpce-tool/include/main/FlatFileLoad_stdafx.h
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
#ifndef FLAT_FILE_LOAD_STDAFX_H
|
||||
#define FLAT_FILE_LOAD_STDAFX_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "TableRows.h"
|
||||
#include "EGenBaseLoader_stdafx.h"
|
||||
#include "FlatFileLoader.h"
|
||||
#include "FlatAccountPermissionLoad.h"
|
||||
#include "FlatAddressLoad.h"
|
||||
#include "FlatBrokerLoad.h"
|
||||
#include "FlatCashTransactionLoad.h"
|
||||
#include "FlatChargeLoad.h"
|
||||
#include "FlatCommissionRateLoad.h"
|
||||
#include "FlatCompanyLoad.h"
|
||||
#include "FlatCompanyCompetitorLoad.h"
|
||||
#include "FlatCustomerLoad.h"
|
||||
#include "FlatCustomerAccountLoad.h"
|
||||
#include "FlatCustomerTaxrateLoad.h"
|
||||
#include "FlatDailyMarketLoad.h"
|
||||
#include "FlatExchangeLoad.h"
|
||||
#include "FlatFinancialLoad.h"
|
||||
#include "FlatHoldingLoad.h"
|
||||
#include "FlatHoldingHistoryLoad.h"
|
||||
#include "FlatHoldingSummaryLoad.h"
|
||||
#include "FlatIndustryLoad.h"
|
||||
#include "FlatLastTradeLoad.h"
|
||||
#include "FlatNewsItemLoad.h"
|
||||
#include "FlatNewsXRefLoad.h"
|
||||
#include "FlatSectorLoad.h"
|
||||
#include "FlatSecurityLoad.h"
|
||||
#include "FlatSettlementLoad.h"
|
||||
#include "FlatStatusTypeLoad.h"
|
||||
#include "FlatTaxRateLoad.h"
|
||||
#include "FlatTradeLoad.h"
|
||||
#include "FlatTradeHistoryLoad.h"
|
||||
#include "FlatTradeRequestLoad.h"
|
||||
#include "FlatTradeTypeLoad.h"
|
||||
#include "FlatWatchItemLoad.h"
|
||||
#include "FlatWatchListLoad.h"
|
||||
#include "FlatZipCodeLoad.h"
|
||||
#include "FlatLoaderFactory.h"
|
||||
|
||||
#endif // #ifndef FLAT_FILE_LOAD_STDAFX_H
|
||||
164
external/duckdb/third_party/tpce-tool/include/main/FlatFileLoader.h
vendored
Normal file
164
external/duckdb/third_party/tpce-tool/include/main/FlatFileLoader.h
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing a flat file loader.
|
||||
*/
|
||||
#ifndef FLAT_FILE_LOADER_H
|
||||
#define FLAT_FILE_LOADER_H
|
||||
|
||||
#include <cstdio>
|
||||
#include "BaseLoader.h"
|
||||
#include "unusedflag.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
// EGen Formatting Defaults
|
||||
#ifndef DATETIME_FORMAT
|
||||
#define DATETIME_FORMAT 12 // YYYY-MM-DD HH:MM:SS.mmm
|
||||
#endif
|
||||
|
||||
#ifndef TIME_FORMAT
|
||||
#define TIME_FORMAT 01 // hh:mm:ss
|
||||
#endif
|
||||
|
||||
#ifndef DATE_FORMAT
|
||||
#define DATE_FORMAT 10 // YYYY-MM-DD
|
||||
#endif
|
||||
|
||||
#ifndef BOOLEAN_TRUE
|
||||
#define BOOLEAN_TRUE "1"
|
||||
#endif
|
||||
|
||||
#ifndef BOOLEAN_FALSE
|
||||
#define BOOLEAN_FALSE "0"
|
||||
#endif
|
||||
|
||||
#ifndef BUFFER_SIZE
|
||||
#define BUFFER_SIZE 0
|
||||
#endif
|
||||
|
||||
#ifndef FILE_OPEN_MODE_OVERWRITE
|
||||
#ifdef WIN32
|
||||
#define FILE_OPEN_MODE_OVERWRITE "w+"
|
||||
#else
|
||||
#define FILE_OPEN_MODE_OVERWRITE "w"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FILE_OPEN_MODE_APPEND
|
||||
#ifdef WIN32
|
||||
#define FILE_OPEN_MODE_APPEND "a+"
|
||||
#else
|
||||
#define FILE_OPEN_MODE_APPEND "a"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// EGen Formatting
|
||||
const int FlatFileDateTimeFormat = DATETIME_FORMAT;
|
||||
const int FlatFileTimeFormat = TIME_FORMAT;
|
||||
const int FlatFileDateFormat = DATE_FORMAT;
|
||||
const char *const FlatFileBoolTrue = BOOLEAN_TRUE;
|
||||
const char *const FlatFileBoolFalse = BOOLEAN_FALSE;
|
||||
|
||||
// EGen Buffering
|
||||
const int FlatFileBufferSize = BUFFER_SIZE;
|
||||
|
||||
// EGen File Open Modes
|
||||
const char *const FlatFileOpenModeOverwrite = FILE_OPEN_MODE_OVERWRITE;
|
||||
const char *const FlatFileOpenModeAppend = FILE_OPEN_MODE_APPEND;
|
||||
|
||||
// Overwrite vs. append functionality for output flat files.
|
||||
enum FlatFileOutputModes { FLAT_FILE_OUTPUT_APPEND = 0, FLAT_FILE_OUTPUT_OVERWRITE };
|
||||
|
||||
/*
|
||||
* FlatLoader class.
|
||||
*/
|
||||
template <typename T> class CFlatFileLoader : public CBaseLoader<T> {
|
||||
protected:
|
||||
FILE *hOutFile;
|
||||
|
||||
public:
|
||||
CFlatFileLoader(char *szFileName, FlatFileOutputModes FlatFileOutputMode);
|
||||
~CFlatFileLoader(void);
|
||||
|
||||
// virtual void WriteNextRecord(const T* next_record UNUSED) {};
|
||||
// virtual void WriteNextRecord(const T& next_record UNUSED) {};
|
||||
void FinishLoad(); // finish load
|
||||
};
|
||||
|
||||
/*
|
||||
* The constructor.
|
||||
*/
|
||||
template <typename T> CFlatFileLoader<T>::CFlatFileLoader(char *szFileName, FlatFileOutputModes flatFileOutputMode) {
|
||||
if (FLAT_FILE_OUTPUT_APPEND == flatFileOutputMode) {
|
||||
hOutFile = fopen(szFileName, FlatFileOpenModeAppend);
|
||||
} else if (FLAT_FILE_OUTPUT_OVERWRITE == flatFileOutputMode) {
|
||||
hOutFile = fopen(szFileName, FlatFileOpenModeOverwrite);
|
||||
}
|
||||
|
||||
if (!hOutFile) {
|
||||
throw CSystemErr(CSystemErr::eCreateFile, "CFlatFileLoader<T>::CFlatFileLoader");
|
||||
}
|
||||
|
||||
if (FlatFileBufferSize > 0) {
|
||||
if (setvbuf(hOutFile, NULL, _IOFBF, FlatFileBufferSize)) {
|
||||
throw CSystemErr(CSystemErr::eCreateFile, "CFlatFileLoader<T>::CFlatFileLoader");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Destructor.
|
||||
*/
|
||||
template <typename T> CFlatFileLoader<T>::~CFlatFileLoader() {
|
||||
fclose(hOutFile);
|
||||
}
|
||||
|
||||
/*
|
||||
* Commit sent rows. This needs to be called after the last row has been
|
||||
* sent and before the object is destructed. Otherwise all rows will be
|
||||
* discarded.
|
||||
*/
|
||||
template <typename T> void CFlatFileLoader<T>::FinishLoad() {
|
||||
fflush(hOutFile);
|
||||
}
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_FILE_LOADER_H
|
||||
75
external/duckdb/third_party/tpce-tool/include/main/FlatFinancialLoad.h
vendored
Normal file
75
external/duckdb/third_party/tpce-tool/include/main/FlatFinancialLoad.h
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for FINANCIAL.
|
||||
*/
|
||||
#ifndef FLAT_FINANCIAL_LOAD_H
|
||||
#define FLAT_FINANCIAL_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatFinancialLoad : public CFlatFileLoader<FINANCIAL_ROW> {
|
||||
private:
|
||||
CDateTime Flat_FI_QTR_START_DATE;
|
||||
const std::string FinancialRowFmt;
|
||||
|
||||
public:
|
||||
CFlatFinancialLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<FINANCIAL_ROW>(szFileName, FlatFileOutputMode),
|
||||
FinancialRowFmt("%" PRId64 "|%d|%d|%s|%.2f|%.2f|%.2f|%.2f|%.2f|%.2f|%.2f|%.2f|%" PRId64 "|%" PRId64 "\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const FINANCIAL_ROW &next_record) {
|
||||
Flat_FI_QTR_START_DATE = next_record.FI_QTR_START_DATE;
|
||||
int rc = fprintf(hOutFile, FinancialRowFmt.c_str(), next_record.FI_CO_ID, next_record.FI_YEAR,
|
||||
next_record.FI_QTR, Flat_FI_QTR_START_DATE.ToStr(FlatFileDateFormat), next_record.FI_REVENUE,
|
||||
next_record.FI_NET_EARN, next_record.FI_BASIC_EPS, next_record.FI_DILUT_EPS,
|
||||
next_record.FI_MARGIN, next_record.FI_INVENTORY, next_record.FI_ASSETS,
|
||||
next_record.FI_LIABILITY, next_record.FI_OUT_BASIC, next_record.FI_OUT_DILUT);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatFinancialLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_FINANCIAL_LOAD_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/FlatHoldingHistoryLoad.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/FlatHoldingHistoryLoad.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for HOLDING_HISTORY.
|
||||
*/
|
||||
#ifndef FLAT_HOLDING_HISTORY_LOAD_H
|
||||
#define FLAT_HOLDING_HISTORY_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatHoldingHistoryLoad : public CFlatFileLoader<HOLDING_HISTORY_ROW> {
|
||||
private:
|
||||
const std::string HoldingHistoryRowFmt;
|
||||
|
||||
public:
|
||||
CFlatHoldingHistoryLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<HOLDING_HISTORY_ROW>(szFileName, FlatFileOutputMode),
|
||||
HoldingHistoryRowFmt("%" PRId64 "|%" PRId64 "|%d|%d\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const HOLDING_HISTORY_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, HoldingHistoryRowFmt.c_str(), next_record.HH_H_T_ID, next_record.HH_T_ID,
|
||||
next_record.HH_BEFORE_QTY, next_record.HH_AFTER_QTY);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatHoldingHistoryLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_HOLDING_HISTORY_LOAD_H
|
||||
72
external/duckdb/third_party/tpce-tool/include/main/FlatHoldingLoad.h
vendored
Normal file
72
external/duckdb/third_party/tpce-tool/include/main/FlatHoldingLoad.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for HOLDING.
|
||||
*/
|
||||
#ifndef FLAT_HOLDING_LOAD_H
|
||||
#define FLAT_HOLDING_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatHoldingLoad : public CFlatFileLoader<HOLDING_ROW> {
|
||||
private:
|
||||
CDateTime Flat_H_DTS;
|
||||
const std::string HoldingRowFmt;
|
||||
|
||||
public:
|
||||
CFlatHoldingLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<HOLDING_ROW>(szFileName, FlatFileOutputMode),
|
||||
HoldingRowFmt("%" PRId64 "|%" PRId64 "|%s|%s|%.2f|%d\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const HOLDING_ROW &next_record) {
|
||||
Flat_H_DTS = next_record.H_DTS;
|
||||
int rc = fprintf(hOutFile, HoldingRowFmt.c_str(), next_record.H_T_ID, next_record.H_CA_ID, next_record.H_S_SYMB,
|
||||
Flat_H_DTS.ToStr(FlatFileDateTimeFormat), next_record.H_PRICE, next_record.H_QTY);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatHoldingLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_HOLDING_LOAD_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/FlatHoldingSummaryLoad.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/FlatHoldingSummaryLoad.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for HOLDING_SUMMARY.
|
||||
*/
|
||||
#ifndef FLAT_HOLDING_SUMMARY_LOAD_H
|
||||
#define FLAT_HOLDING_SUMMARY_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatHoldingSummaryLoad : public CFlatFileLoader<HOLDING_SUMMARY_ROW> {
|
||||
private:
|
||||
const std::string HoldingSummaryRowFmt;
|
||||
|
||||
public:
|
||||
CFlatHoldingSummaryLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<HOLDING_SUMMARY_ROW>(szFileName, FlatFileOutputMode),
|
||||
HoldingSummaryRowFmt("%" PRId64 "|%s|%d\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const HOLDING_SUMMARY_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, HoldingSummaryRowFmt.c_str(), next_record.HS_CA_ID, next_record.HS_S_SYMB,
|
||||
next_record.HS_QTY);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatHoldingSummaryLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_HOLDING_SUMMARY_LOAD_H
|
||||
71
external/duckdb/third_party/tpce-tool/include/main/FlatIndustryLoad.h
vendored
Normal file
71
external/duckdb/third_party/tpce-tool/include/main/FlatIndustryLoad.h
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for INDUSTRY.
|
||||
*/
|
||||
#ifndef FLAT_INDUSTRY_LOAD_H
|
||||
#define FLAT_INDUSTRY_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
#include "TableTypes.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatIndustryLoad : public CFlatFileLoader<INDUSTRY_ROW> {
|
||||
private:
|
||||
const std::string IndustryRowFmt;
|
||||
|
||||
public:
|
||||
CFlatIndustryLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<INDUSTRY_ROW>(szFileName, FlatFileOutputMode), IndustryRowFmt("%s|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const INDUSTRY_ROW &next_record) {
|
||||
int rc =
|
||||
fprintf(hOutFile, IndustryRowFmt.c_str(), next_record.IN_ID, next_record.IN_NAME, next_record.IN_SC_ID);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatIndustryLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_INDUSTRY_LOAD_H
|
||||
73
external/duckdb/third_party/tpce-tool/include/main/FlatLastTradeLoad.h
vendored
Normal file
73
external/duckdb/third_party/tpce-tool/include/main/FlatLastTradeLoad.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for LAST_TRADE.
|
||||
*/
|
||||
#ifndef FLAT_LAST_TRADE_LOAD_H
|
||||
#define FLAT_LAST_TRADE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatLastTradeLoad : public CFlatFileLoader<LAST_TRADE_ROW> {
|
||||
private:
|
||||
CDateTime Flat_LT_DTS;
|
||||
const std::string LastTradeRowFmt;
|
||||
|
||||
public:
|
||||
CFlatLastTradeLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<LAST_TRADE_ROW>(szFileName, FlatFileOutputMode),
|
||||
LastTradeRowFmt("%s|%s|%.2f|%.2f|%" PRId64 "\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const LAST_TRADE_ROW &next_record) {
|
||||
Flat_LT_DTS = next_record.LT_DTS;
|
||||
int rc =
|
||||
fprintf(hOutFile, LastTradeRowFmt.c_str(), next_record.LT_S_SYMB, Flat_LT_DTS.ToStr(FlatFileDateTimeFormat),
|
||||
next_record.LT_PRICE, next_record.LT_OPEN_PRICE, next_record.LT_VOL);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatLastTradeLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_LAST_TRADE_LOAD_H
|
||||
246
external/duckdb/third_party/tpce-tool/include/main/FlatLoaderFactory.h
vendored
Normal file
246
external/duckdb/third_party/tpce-tool/include/main/FlatLoaderFactory.h
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader class factory.
|
||||
* This class instantiates particular table loader classes.
|
||||
*/
|
||||
#ifndef FLAT_LOADER_FACTORY_H
|
||||
#define FLAT_LOADER_FACTORY_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "FlatFileLoad_stdafx.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatLoaderFactory : public CBaseLoaderFactory {
|
||||
char m_szOutDir[iMaxPath];
|
||||
char m_szFullFileName[iMaxPath];
|
||||
FlatFileOutputModes m_eOutputMode; // overwrite/append
|
||||
|
||||
void SetFileName(const char *szFileName) {
|
||||
snprintf(m_szFullFileName, sizeof(m_szFullFileName), "%s%s", m_szOutDir, szFileName);
|
||||
}
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
CFlatLoaderFactory(char *szOutDir, FlatFileOutputModes eOutputMode) : m_eOutputMode(eOutputMode) {
|
||||
assert(szOutDir);
|
||||
|
||||
strncpy(m_szOutDir, szOutDir, sizeof(m_szOutDir));
|
||||
};
|
||||
|
||||
// Functions to create loader classes for individual tables.
|
||||
|
||||
virtual CBaseLoader<ACCOUNT_PERMISSION_ROW> *CreateAccountPermissionLoader() {
|
||||
SetFileName("AccountPermission.txt");
|
||||
|
||||
return new CFlatAccountPermissionLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<ADDRESS_ROW> *CreateAddressLoader() {
|
||||
SetFileName("Address.txt");
|
||||
|
||||
return new CFlatAddressLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<BROKER_ROW> *CreateBrokerLoader() {
|
||||
SetFileName("Broker.txt");
|
||||
|
||||
return new CFlatBrokerLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<CASH_TRANSACTION_ROW> *CreateCashTransactionLoader() {
|
||||
SetFileName("CashTransaction.txt");
|
||||
|
||||
return new CFlatCashTransactionLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<CHARGE_ROW> *CreateChargeLoader() {
|
||||
SetFileName("Charge.txt");
|
||||
|
||||
return new CFlatChargeLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
|
||||
virtual CBaseLoader<COMMISSION_RATE_ROW> *CreateCommissionRateLoader() {
|
||||
SetFileName("CommissionRate.txt");
|
||||
|
||||
return new CFlatCommissionRateLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
|
||||
virtual CBaseLoader<COMPANY_COMPETITOR_ROW> *CreateCompanyCompetitorLoader() {
|
||||
SetFileName("CompanyCompetitor.txt");
|
||||
|
||||
return new CFlatCompanyCompetitorLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
|
||||
virtual CBaseLoader<COMPANY_ROW> *CreateCompanyLoader() {
|
||||
SetFileName("Company.txt");
|
||||
|
||||
return new CFlatCompanyLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
|
||||
virtual CBaseLoader<CUSTOMER_ACCOUNT_ROW> *CreateCustomerAccountLoader() {
|
||||
SetFileName("CustomerAccount.txt");
|
||||
|
||||
return new CFlatCustomerAccountLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
|
||||
virtual CBaseLoader<CUSTOMER_ROW> *CreateCustomerLoader() {
|
||||
SetFileName("Customer.txt");
|
||||
|
||||
return new CFlatCustomerLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<CUSTOMER_TAXRATE_ROW> *CreateCustomerTaxrateLoader() {
|
||||
SetFileName("CustomerTaxrate.txt");
|
||||
|
||||
return new CFlatCustomerTaxrateLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<DAILY_MARKET_ROW> *CreateDailyMarketLoader() {
|
||||
SetFileName("DailyMarket.txt");
|
||||
|
||||
return new CFlatDailyMarketLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<EXCHANGE_ROW> *CreateExchangeLoader() {
|
||||
SetFileName("Exchange.txt");
|
||||
|
||||
return new CFlatExchangeLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<FINANCIAL_ROW> *CreateFinancialLoader() {
|
||||
SetFileName("Financial.txt");
|
||||
|
||||
return new CFlatFinancialLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<HOLDING_ROW> *CreateHoldingLoader() {
|
||||
SetFileName("Holding.txt");
|
||||
|
||||
return new CFlatHoldingLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<HOLDING_HISTORY_ROW> *CreateHoldingHistoryLoader() {
|
||||
SetFileName("HoldingHistory.txt");
|
||||
|
||||
return new CFlatHoldingHistoryLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<HOLDING_SUMMARY_ROW> *CreateHoldingSummaryLoader() {
|
||||
SetFileName("HoldingSummary.txt");
|
||||
|
||||
return new CFlatHoldingSummaryLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<INDUSTRY_ROW> *CreateIndustryLoader() {
|
||||
SetFileName("Industry.txt");
|
||||
|
||||
return new CFlatIndustryLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<LAST_TRADE_ROW> *CreateLastTradeLoader() {
|
||||
SetFileName("LastTrade.txt");
|
||||
|
||||
return new CFlatLastTradeLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<NEWS_ITEM_ROW> *CreateNewsItemLoader() {
|
||||
SetFileName("NewsItem.txt");
|
||||
|
||||
return new CFlatNewsItemLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<NEWS_XREF_ROW> *CreateNewsXRefLoader() {
|
||||
SetFileName("NewsXRef.txt");
|
||||
|
||||
return new CFlatNewsXRefLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<SECTOR_ROW> *CreateSectorLoader() {
|
||||
SetFileName("Sector.txt");
|
||||
|
||||
return new CFlatSectorLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<SECURITY_ROW> *CreateSecurityLoader() {
|
||||
SetFileName("Security.txt");
|
||||
|
||||
return new CFlatSecurityLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<SETTLEMENT_ROW> *CreateSettlementLoader() {
|
||||
SetFileName("Settlement.txt");
|
||||
|
||||
return new CFlatSettlementLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<STATUS_TYPE_ROW> *CreateStatusTypeLoader() {
|
||||
SetFileName("StatusType.txt");
|
||||
|
||||
return new CFlatStatusTypeLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<TAX_RATE_ROW> *CreateTaxRateLoader() {
|
||||
SetFileName("TaxRate.txt");
|
||||
|
||||
return new CFlatTaxRateLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<TRADE_HISTORY_ROW> *CreateTradeHistoryLoader() {
|
||||
SetFileName("TradeHistory.txt");
|
||||
|
||||
return new CFlatTradeHistoryLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<TRADE_ROW> *CreateTradeLoader() {
|
||||
SetFileName("Trade.txt");
|
||||
|
||||
return new CFlatTradeLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<TRADE_REQUEST_ROW> *CreateTradeRequestLoader() {
|
||||
SetFileName("TradeRequest.txt");
|
||||
|
||||
return new CFlatTradeRequestLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<TRADE_TYPE_ROW> *CreateTradeTypeLoader() {
|
||||
SetFileName("TradeType.txt");
|
||||
|
||||
return new CFlatTradeTypeLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
virtual CBaseLoader<WATCH_ITEM_ROW> *CreateWatchItemLoader() {
|
||||
SetFileName("WatchItem.txt");
|
||||
|
||||
return new CFlatWatchItemLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
|
||||
virtual CBaseLoader<WATCH_LIST_ROW> *CreateWatchListLoader() {
|
||||
SetFileName("WatchList.txt");
|
||||
|
||||
return new CFlatWatchListLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
|
||||
virtual CBaseLoader<ZIP_CODE_ROW> *CreateZipCodeLoader() {
|
||||
SetFileName("ZipCode.txt");
|
||||
|
||||
return new CFlatZipCodeLoad(m_szFullFileName, m_eOutputMode);
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_LOADER_FACTORY_H
|
||||
73
external/duckdb/third_party/tpce-tool/include/main/FlatNewsItemLoad.h
vendored
Normal file
73
external/duckdb/third_party/tpce-tool/include/main/FlatNewsItemLoad.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for NEWS_ITEM.
|
||||
*/
|
||||
#ifndef FLAT_NEWS_ITEM_LOAD_H
|
||||
#define FLAT_NEWS_ITEM_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatNewsItemLoad : public CFlatFileLoader<NEWS_ITEM_ROW> {
|
||||
private:
|
||||
CDateTime Flat_NI_DTS;
|
||||
const std::string NewsItemRowFmt;
|
||||
|
||||
public:
|
||||
CFlatNewsItemLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<NEWS_ITEM_ROW>(szFileName, FlatFileOutputMode),
|
||||
NewsItemRowFmt("%" PRId64 "|%s|%s|%s|%s|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const NEWS_ITEM_ROW &next_record) {
|
||||
Flat_NI_DTS = next_record.NI_DTS;
|
||||
int rc = fprintf(hOutFile, NewsItemRowFmt.c_str(), next_record.NI_ID, next_record.NI_HEADLINE,
|
||||
next_record.NI_SUMMARY, next_record.NI_ITEM, Flat_NI_DTS.ToStr(FlatFileDateTimeFormat),
|
||||
next_record.NI_SOURCE, next_record.NI_AUTHOR);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatNewsItemLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_NEWS_ITEM_LOAD_H
|
||||
68
external/duckdb/third_party/tpce-tool/include/main/FlatNewsXRefLoad.h
vendored
Normal file
68
external/duckdb/third_party/tpce-tool/include/main/FlatNewsXRefLoad.h
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for NEWS_XREF.
|
||||
*/
|
||||
#ifndef FLAT_NEWS_XREF_LOAD_H
|
||||
#define FLAT_NEWS_XREF_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatNewsXRefLoad : public CFlatFileLoader<NEWS_XREF_ROW> {
|
||||
private:
|
||||
const std::string NewsXRefRowFmt;
|
||||
|
||||
public:
|
||||
CFlatNewsXRefLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<NEWS_XREF_ROW>(szFileName, FlatFileOutputMode), NewsXRefRowFmt("%" PRId64 "|%" PRId64 "\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const NEWS_XREF_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, NewsXRefRowFmt.c_str(), next_record.NX_NI_ID, next_record.NX_CO_ID);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatNewsXRefLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_NEWS_XREF_LOAD_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/FlatSectorLoad.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/FlatSectorLoad.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for SECTOR.
|
||||
*/
|
||||
#ifndef FLAT_SECTOR_LOAD_H
|
||||
#define FLAT_SECTOR_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
#include "TableTypes.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatSectorLoad : public CFlatFileLoader<SECTOR_ROW> {
|
||||
private:
|
||||
const std::string SectorRowFmt;
|
||||
|
||||
public:
|
||||
CFlatSectorLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<SECTOR_ROW>(szFileName, FlatFileOutputMode), SectorRowFmt("%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const SECTOR_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, SectorRowFmt.c_str(), next_record.SC_ID, next_record.SC_NAME);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatSectorLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_SECTOR_LOAD_H
|
||||
83
external/duckdb/third_party/tpce-tool/include/main/FlatSecurityLoad.h
vendored
Normal file
83
external/duckdb/third_party/tpce-tool/include/main/FlatSecurityLoad.h
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for SECURITY.
|
||||
*/
|
||||
#ifndef FLAT_SECURITY_LOAD_H
|
||||
#define FLAT_SECURITY_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatSecurityLoad : public CFlatFileLoader<SECURITY_ROW> {
|
||||
private:
|
||||
CDateTime Flat_S_START_DATE;
|
||||
CDateTime Flat_S_EXCH_DATE;
|
||||
CDateTime Flat_S_52WK_HIGH_DATE;
|
||||
CDateTime Flat_S_52WK_LOW_DATE;
|
||||
const std::string SecurityRowFmt;
|
||||
|
||||
public:
|
||||
CFlatSecurityLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<SECURITY_ROW>(szFileName, FlatFileOutputMode),
|
||||
SecurityRowFmt("%s|%s|%s|%s|%s|%" PRId64 "|%" PRId64 "|%s|%s|%.2f|%.2f|%s|%.2f|%s|%.2f|%.2f\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const SECURITY_ROW &next_record) {
|
||||
Flat_S_START_DATE = next_record.S_START_DATE;
|
||||
Flat_S_EXCH_DATE = next_record.S_EXCH_DATE;
|
||||
Flat_S_52WK_HIGH_DATE = next_record.S_52WK_HIGH_DATE;
|
||||
Flat_S_52WK_LOW_DATE = next_record.S_52WK_LOW_DATE;
|
||||
int rc = fprintf(hOutFile, SecurityRowFmt.c_str(), next_record.S_SYMB, next_record.S_ISSUE, next_record.S_ST_ID,
|
||||
next_record.S_NAME, next_record.S_EX_ID, next_record.S_CO_ID, next_record.S_NUM_OUT,
|
||||
Flat_S_START_DATE.ToStr(FlatFileDateFormat), Flat_S_EXCH_DATE.ToStr(FlatFileDateFormat),
|
||||
next_record.S_PE, next_record.S_52WK_HIGH, Flat_S_52WK_HIGH_DATE.ToStr(FlatFileDateFormat),
|
||||
next_record.S_52WK_LOW, Flat_S_52WK_LOW_DATE.ToStr(FlatFileDateFormat), next_record.S_DIVIDEND,
|
||||
next_record.S_YIELD);
|
||||
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatSecurityLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_SECURITY_LOAD_H
|
||||
72
external/duckdb/third_party/tpce-tool/include/main/FlatSettlementLoad.h
vendored
Normal file
72
external/duckdb/third_party/tpce-tool/include/main/FlatSettlementLoad.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for SETTLEMENT.
|
||||
*/
|
||||
#ifndef FLAT_SETTLEMENT_LOAD_H
|
||||
#define FLAT_SETTLEMENT_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatSettlementLoad : public CFlatFileLoader<SETTLEMENT_ROW> {
|
||||
private:
|
||||
CDateTime Flat_SE_CASH_DUE_DATE;
|
||||
const std::string SettlementRowFmt;
|
||||
|
||||
public:
|
||||
CFlatSettlementLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<SETTLEMENT_ROW>(szFileName, FlatFileOutputMode),
|
||||
SettlementRowFmt("%" PRId64 "|%s|%s|%.2f\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const SETTLEMENT_ROW &next_record) {
|
||||
Flat_SE_CASH_DUE_DATE = next_record.SE_CASH_DUE_DATE;
|
||||
int rc = fprintf(hOutFile, SettlementRowFmt.c_str(), next_record.SE_T_ID, next_record.SE_CASH_TYPE,
|
||||
Flat_SE_CASH_DUE_DATE.ToStr(FlatFileDateFormat), next_record.SE_AMT);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatSettlementLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_SETTLEMENT_LOAD_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/FlatStatusTypeLoad.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/FlatStatusTypeLoad.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for STATUS_TYPE.
|
||||
*/
|
||||
#ifndef FLAT_STATUS_TYPE_LOAD_H
|
||||
#define FLAT_STATUS_TYPE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
#include "TableTypes.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatStatusTypeLoad : public CFlatFileLoader<STATUS_TYPE_ROW> {
|
||||
private:
|
||||
const std::string StatusTypeRowFmt;
|
||||
|
||||
public:
|
||||
CFlatStatusTypeLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<STATUS_TYPE_ROW>(szFileName, FlatFileOutputMode), StatusTypeRowFmt("%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const STATUS_TYPE_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, StatusTypeRowFmt.c_str(), next_record.ST_ID, next_record.ST_NAME);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatStatusType::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_STATUS_TYPE_LOAD_H
|
||||
68
external/duckdb/third_party/tpce-tool/include/main/FlatTaxRateLoad.h
vendored
Normal file
68
external/duckdb/third_party/tpce-tool/include/main/FlatTaxRateLoad.h
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for TAXRATE.
|
||||
*/
|
||||
#ifndef FLAT_TAX_RATE_LOAD_H
|
||||
#define FLAT_TAX_RATE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatTaxRateLoad : public CFlatFileLoader<TAX_RATE_ROW> {
|
||||
private:
|
||||
const std::string TaxrateRowFmt;
|
||||
|
||||
public:
|
||||
CFlatTaxRateLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<TAX_RATE_ROW>(szFileName, FlatFileOutputMode), TaxrateRowFmt("%s|%s|%.5f\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const TAX_RATE_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, TaxrateRowFmt.c_str(), next_record.TX_ID, next_record.TX_NAME, next_record.TX_RATE);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatTaxRateLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_TAX_RATE_LOAD_H
|
||||
72
external/duckdb/third_party/tpce-tool/include/main/FlatTradeHistoryLoad.h
vendored
Normal file
72
external/duckdb/third_party/tpce-tool/include/main/FlatTradeHistoryLoad.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for TRADE_HISTORY.
|
||||
*/
|
||||
#ifndef FLAT_TRADE_HISTORY_H
|
||||
#define FLAT_TRADE_HISTORY_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatTradeHistoryLoad : public CFlatFileLoader<TRADE_HISTORY_ROW> {
|
||||
private:
|
||||
CDateTime Flat_TH_DTS;
|
||||
const std::string TradeHistoryRowFmt;
|
||||
|
||||
public:
|
||||
CFlatTradeHistoryLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<TRADE_HISTORY_ROW>(szFileName, FlatFileOutputMode),
|
||||
TradeHistoryRowFmt("%" PRId64 "|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const TRADE_HISTORY_ROW &next_record) {
|
||||
Flat_TH_DTS = next_record.TH_DTS;
|
||||
int rc = fprintf(hOutFile, TradeHistoryRowFmt.c_str(), next_record.TH_T_ID,
|
||||
Flat_TH_DTS.ToStr(FlatFileDateTimeFormat), next_record.TH_ST_ID);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatTradeHistory::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_TRADE_HISTORY_H
|
||||
76
external/duckdb/third_party/tpce-tool/include/main/FlatTradeLoad.h
vendored
Normal file
76
external/duckdb/third_party/tpce-tool/include/main/FlatTradeLoad.h
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for TRADE.
|
||||
*/
|
||||
#ifndef FLAT_TRADE_LOAD_H
|
||||
#define FLAT_TRADE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatTradeLoad : public CFlatFileLoader<TRADE_ROW> {
|
||||
private:
|
||||
CDateTime Flat_T_DTS;
|
||||
const std::string TradeRowFmt;
|
||||
|
||||
public:
|
||||
CFlatTradeLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<TRADE_ROW>(szFileName, FlatFileOutputMode),
|
||||
TradeRowFmt("%" PRId64 "|%s|%s|%s|%s|%s|%d|%.2f|%" PRId64 "|%s|%.2f|%.2f|%.2f|%.2f|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const TRADE_ROW &next_record) {
|
||||
Flat_T_DTS = next_record.T_DTS;
|
||||
int rc = fprintf(hOutFile, TradeRowFmt.c_str(), next_record.T_ID, Flat_T_DTS.ToStr(FlatFileDateTimeFormat),
|
||||
next_record.T_ST_ID, next_record.T_TT_ID,
|
||||
(next_record.T_IS_CASH ? FlatFileBoolTrue : FlatFileBoolFalse), next_record.T_S_SYMB,
|
||||
next_record.T_QTY, next_record.T_BID_PRICE, next_record.T_CA_ID, next_record.T_EXEC_NAME,
|
||||
next_record.T_TRADE_PRICE, next_record.T_CHRG, next_record.T_COMM, next_record.T_TAX,
|
||||
(next_record.T_LIFO ? FlatFileBoolTrue : FlatFileBoolFalse));
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatTradeLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_TRADE_LOAD_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/FlatTradeRequestLoad.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/FlatTradeRequestLoad.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for TRADE_REQUEST.
|
||||
*/
|
||||
#ifndef FLAT_TRADE_REQUEST_LOAD_H
|
||||
#define FLAT_TRADE_REQUEST_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatTradeRequestLoad : public CFlatFileLoader<TRADE_REQUEST_ROW> {
|
||||
private:
|
||||
const std::string TradeRequestRowFmt;
|
||||
|
||||
public:
|
||||
CFlatTradeRequestLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<TRADE_REQUEST_ROW>(szFileName, FlatFileOutputMode),
|
||||
TradeRequestRowFmt("%" PRId64 "|%s|%s|%d|%.2f|%" PRId64 "\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const TRADE_REQUEST_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, TradeRequestRowFmt.c_str(), next_record.TR_T_ID, next_record.TR_TT_ID,
|
||||
next_record.TR_S_SYMB, next_record.TR_QTY, next_record.TR_BID_PRICE, next_record.TR_B_ID);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatTradeRequestLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_TRADE_REQUEST_LOAD_H
|
||||
72
external/duckdb/third_party/tpce-tool/include/main/FlatTradeTypeLoad.h
vendored
Normal file
72
external/duckdb/third_party/tpce-tool/include/main/FlatTradeTypeLoad.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for TRADE_TYPE.
|
||||
*/
|
||||
#ifndef FLAT_TRADE_TYPE_LOAD_H
|
||||
#define FLAT_TRADE_TYPE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
#include "TableTypes.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatTradeTypeLoad : public CFlatFileLoader<TRADE_TYPE_ROW> {
|
||||
private:
|
||||
const std::string TradeTypeRowFmt;
|
||||
|
||||
public:
|
||||
CFlatTradeTypeLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<TRADE_TYPE_ROW>(szFileName, FlatFileOutputMode), TradeTypeRowFmt("%s|%s|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const TRADE_TYPE_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, TradeTypeRowFmt.c_str(), next_record.TT_ID, next_record.TT_NAME,
|
||||
(next_record.TT_IS_SELL ? FlatFileBoolTrue : FlatFileBoolFalse),
|
||||
(next_record.TT_IS_MRKT ? FlatFileBoolTrue : FlatFileBoolFalse));
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatTradeTypeLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_TRADE_TYPE_LOAD_H
|
||||
68
external/duckdb/third_party/tpce-tool/include/main/FlatWatchItemLoad.h
vendored
Normal file
68
external/duckdb/third_party/tpce-tool/include/main/FlatWatchItemLoad.h
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for WATCH_ITEM.
|
||||
*/
|
||||
#ifndef FLAT_WATCH_ITEM_LOAD_H
|
||||
#define FLAT_WATCH_ITEM_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatWatchItemLoad : public CFlatFileLoader<WATCH_ITEM_ROW> {
|
||||
private:
|
||||
const std::string WatchItemRowFmt;
|
||||
|
||||
public:
|
||||
CFlatWatchItemLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<WATCH_ITEM_ROW>(szFileName, FlatFileOutputMode), WatchItemRowFmt("%" PRId64 "|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const WATCH_ITEM_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, WatchItemRowFmt.c_str(), next_record.WI_WL_ID, next_record.WI_S_SYMB);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatWatchItemLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_WATCH_ITEM_LOAD_H
|
||||
69
external/duckdb/third_party/tpce-tool/include/main/FlatWatchListLoad.h
vendored
Normal file
69
external/duckdb/third_party/tpce-tool/include/main/FlatWatchListLoad.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for WATCH_LIST.
|
||||
*/
|
||||
#ifndef FLAT_WATCH_LIST_LOAD_H
|
||||
#define FLAT_WATCH_LIST_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatWatchListLoad : public CFlatFileLoader<WATCH_LIST_ROW> {
|
||||
private:
|
||||
const std::string WatchListRowFmt;
|
||||
|
||||
public:
|
||||
CFlatWatchListLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<WATCH_LIST_ROW>(szFileName, FlatFileOutputMode),
|
||||
WatchListRowFmt("%" PRId64 "|%" PRId64 "\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const WATCH_LIST_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, WatchListRowFmt.c_str(), next_record.WL_ID, next_record.WL_C_ID);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatWatchListLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_WATCH_LIST_LOAD_H
|
||||
68
external/duckdb/third_party/tpce-tool/include/main/FlatZipCodeLoad.h
vendored
Normal file
68
external/duckdb/third_party/tpce-tool/include/main/FlatZipCodeLoad.h
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flat file loader for ZIP_CODE.
|
||||
*/
|
||||
#ifndef FLAT_ZIP_CODE_LOAD_H
|
||||
#define FLAT_ZIP_CODE_LOAD_H
|
||||
|
||||
#include "FlatFileLoad_common.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CFlatZipCodeLoad : public CFlatFileLoader<ZIP_CODE_ROW> {
|
||||
private:
|
||||
const std::string ZipCodeRowFmt;
|
||||
|
||||
public:
|
||||
CFlatZipCodeLoad(char *szFileName, FlatFileOutputModes FlatFileOutputMode)
|
||||
: CFlatFileLoader<ZIP_CODE_ROW>(szFileName, FlatFileOutputMode), ZipCodeRowFmt("%s|%s|%s\n"){};
|
||||
|
||||
/*
|
||||
* Writes a record to the file.
|
||||
*/
|
||||
void WriteNextRecord(const ZIP_CODE_ROW &next_record) {
|
||||
int rc = fprintf(hOutFile, ZipCodeRowFmt.c_str(), next_record.ZC_CODE, next_record.ZC_TOWN, next_record.ZC_DIV);
|
||||
if (rc < 0) {
|
||||
throw CSystemErr(CSystemErr::eWriteFile, "CFlatZipCodeLoad::WriteNextRecord");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // FLAT_ZIP_CODE_LOAD_H
|
||||
327
external/duckdb/third_party/tpce-tool/include/main/HoldingsAndTradesTable.h
vendored
Normal file
327
external/duckdb/third_party/tpce-tool/include/main/HoldingsAndTradesTable.h
vendored
Normal file
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Holdings, Trades, Trade Request, Settlement, Trade
|
||||
* History, and Cash Transaction tables.
|
||||
*/
|
||||
#ifndef HOLDINGS_AND_TRADES_TABLE_H
|
||||
#define HOLDINGS_AND_TRADES_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
#include "CustomerAccountsAndPermissionsTable.h"
|
||||
#include "SecurityPriceRange.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
// Arrays for min and max bounds on the security ranges for different tier
|
||||
// accounts The indices into these arrays are
|
||||
// 1) the customer tier (zero based)
|
||||
// 2) the number of accounts for the customer (zero based)
|
||||
// Entries with 0 mean there cannot be that many accounts for a customer with
|
||||
// that tier.
|
||||
//
|
||||
const int iMinSecuritiesPerAccountRange[3][10] = {
|
||||
{6, 4, 2, 2, 0, 0, 0, 0, 0, 0}, {0, 7, 5, 4, 3, 2, 2, 2, 0, 0}, {0, 0, 0, 0, 4, 4, 3, 3, 2, 2}};
|
||||
const int iMaxSecuritiesPerAccountRange[3][10] = {{14, 16, 18, 18, 00, 00, 00, 00, 00, 00},
|
||||
{00, 13, 15, 16, 17, 18, 18, 18, 00, 00},
|
||||
{00, 00, 00, 00, 16, 16, 17, 17, 18, 18}};
|
||||
const int iMaxSecuritiesPerAccount = 18; // maximum number of securities in a customer account
|
||||
|
||||
// const double fMinSecPrice = 20;
|
||||
// const double fMaxSecPrice = 30;
|
||||
|
||||
// These are used for picking the transaction type at load time.
|
||||
// NOTE that the corresponding "if" tests must be in the same order!
|
||||
const int cMarketBuyLoadThreshold = 30; // 1% - 30%
|
||||
const int cMarketSellLoadThreshold = cMarketBuyLoadThreshold + 30; // 31% - 60%
|
||||
const int cLimitBuyLoadThreshold = cMarketSellLoadThreshold + 20; // 61% - 80%
|
||||
const int cLimitSellLoadThreshold = cLimitBuyLoadThreshold + 10; // 81% - 90%
|
||||
const int cStopLossLoadThreshold = cLimitSellLoadThreshold + 10; // 91% - 100%
|
||||
|
||||
const int iPercentBuysOnMargin = 16;
|
||||
|
||||
// These are used when loading the table, and when generating runtime data.
|
||||
const int cNUM_TRADE_QTY_SIZES = 4;
|
||||
const int cTRADE_QTY_SIZES[cNUM_TRADE_QTY_SIZES] = {100, 200, 400, 800};
|
||||
|
||||
// Percentage of trades modifying holdings in Last-In-First-Out order.
|
||||
//
|
||||
const int iPercentTradeIsLIFO = 35;
|
||||
|
||||
// Number of RNG calls for one simulated trade
|
||||
const int iRNGSkipOneTrade = 11; // average count for v3.5: 6.5
|
||||
|
||||
class CHoldingsAndTradesTable {
|
||||
CRandom m_rnd;
|
||||
CCustomerAccountsAndPermissionsTable m_CustomerAccountTable;
|
||||
|
||||
TIdent m_iSecCount; // number of securities
|
||||
UINT m_iMaxSecuritiesPerCA; // number of securities per account
|
||||
TIdent m_SecurityIds[iMaxSecuritiesPerAccount];
|
||||
bool m_bCacheEnabled;
|
||||
TIdent m_iCacheOffsetNS;
|
||||
int m_iCacheSizeNS;
|
||||
int *m_CacheNS;
|
||||
TIdent m_iCacheOffsetSFFI;
|
||||
int m_iCacheSizeSFFI;
|
||||
TIdent *m_CacheSFFI;
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
CHoldingsAndTradesTable(const DataFileManager &dfm,
|
||||
UINT iLoadUnitSize, // # of customers in one load unit
|
||||
TIdent iCustomerCount, TIdent iStartFromCustomer = iDefaultStartFromCustomer,
|
||||
bool bCacheEnabled = false)
|
||||
: m_rnd(RNGSeedTableDefault),
|
||||
m_CustomerAccountTable(dfm, iLoadUnitSize, iCustomerCount, iStartFromCustomer, bCacheEnabled),
|
||||
m_bCacheEnabled(bCacheEnabled) {
|
||||
m_iSecCount = dfm.SecurityFile().GetConfiguredSecurityCount();
|
||||
|
||||
// Set the max number of holdings per account to be
|
||||
// iMaxSecuritiesPerAccount
|
||||
//
|
||||
m_iMaxSecuritiesPerCA = iMaxSecuritiesPerAccount;
|
||||
|
||||
if (m_bCacheEnabled) {
|
||||
m_iCacheSizeNS = iDefaultLoadUnitSize * iMaxAccountsPerCust;
|
||||
m_iCacheOffsetNS =
|
||||
m_CustomerAccountTable.GetStartingCA_ID(iStartFromCustomer) + (iTIdentShift * iMaxAccountsPerCust);
|
||||
m_CacheNS = new int[m_iCacheSizeNS];
|
||||
for (int i = 0; i < m_iCacheSizeNS; i++) {
|
||||
m_CacheNS[i] = 0;
|
||||
}
|
||||
|
||||
m_iCacheSizeSFFI = iDefaultLoadUnitSize * iMaxAccountsPerCust * iMaxSecuritiesPerAccount;
|
||||
m_iCacheOffsetSFFI =
|
||||
m_CustomerAccountTable.GetStartingCA_ID(iStartFromCustomer) + (iTIdentShift * iMaxAccountsPerCust);
|
||||
m_CacheSFFI = new TIdent[m_iCacheSizeSFFI];
|
||||
for (int i = 0; i < m_iCacheSizeSFFI; i++) {
|
||||
m_CacheSFFI[i] = -1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Destructor
|
||||
~CHoldingsAndTradesTable() {
|
||||
if (m_bCacheEnabled) {
|
||||
delete[] m_CacheNS;
|
||||
delete[] m_CacheSFFI;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
* Called only from the loader (CTradeGen), not the driver.
|
||||
*/
|
||||
void InitNextLoadUnit(INT64 TradesToSkip, TIdent iStartingAccountID) {
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedTableDefault,
|
||||
// there is only 1 call to this RNG per trade
|
||||
(RNGSEED)TradesToSkip));
|
||||
if (m_bCacheEnabled) {
|
||||
m_iCacheOffsetNS = iStartingAccountID;
|
||||
for (int i = 0; i < m_iCacheSizeNS; i++) {
|
||||
m_CacheNS[i] = 0;
|
||||
}
|
||||
|
||||
m_iCacheOffsetSFFI = iStartingAccountID;
|
||||
for (int i = 0; i < m_iCacheSizeSFFI; i++) {
|
||||
m_CacheSFFI[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
m_CustomerAccountTable.InitNextLoadUnit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate the number of securities for a given customer account.
|
||||
*/
|
||||
int GetNumberOfSecurities(TIdent iCA_ID, eCustomerTier iTier, int iAccountCount) {
|
||||
int iNumberOfSecurities = 0;
|
||||
|
||||
// We will sometimes get CA_ID values that are outside the current
|
||||
// load unit (cached range). We need to check for this case
|
||||
// and avoid the lookup (as we will segfault or get bogus data.)
|
||||
TIdent index = iCA_ID - m_iCacheOffsetNS;
|
||||
bool bCheckCache = (index >= 0 && index < m_iCacheSizeNS);
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
iNumberOfSecurities = m_CacheNS[index];
|
||||
}
|
||||
|
||||
if (iNumberOfSecurities == 0) {
|
||||
RNGSEED OldSeed;
|
||||
int iMinRange, iMaxRange;
|
||||
|
||||
iMinRange = iMinSecuritiesPerAccountRange[iTier - eCustomerTierOne][iAccountCount - 1];
|
||||
iMaxRange = iMaxSecuritiesPerAccountRange[iTier - eCustomerTierOne][iAccountCount - 1];
|
||||
|
||||
OldSeed = m_rnd.GetSeed();
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedBaseNumberOfSecurities, (RNGSEED)iCA_ID));
|
||||
iNumberOfSecurities = m_rnd.RndIntRange(iMinRange, iMaxRange);
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
m_CacheNS[index] = iNumberOfSecurities;
|
||||
}
|
||||
}
|
||||
return iNumberOfSecurities;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get seed for the starting security ID seed for a given customer id.
|
||||
*/
|
||||
RNGSEED GetStartingSecIDSeed(TIdent iCA_ID) {
|
||||
return (m_rnd.RndNthElement(RNGSeedBaseStartingSecurityID, (RNGSEED)iCA_ID * m_iMaxSecuritiesPerCA));
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert security index within an account (1-18) into
|
||||
* corresponding security index within the
|
||||
* Security.txt input file (0-6849).
|
||||
*
|
||||
* Needed to be able to get the security symbol
|
||||
* and other information from the input file.
|
||||
*
|
||||
* RETURNS:
|
||||
* security index within the input file (0-based)
|
||||
*/
|
||||
TIdent GetSecurityFlatFileIndex(TIdent iCustomerAccount, UINT iSecurityAccountIndex) {
|
||||
TIdent iSecurityFlatFileIndex = -1;
|
||||
|
||||
// We will sometimes get CA_ID values that are outside the current
|
||||
// load unit (cached range). We need to check for this case
|
||||
// and avoid the lookup (as we will segfault or get bogus data.)
|
||||
TIdent index = (iCustomerAccount - m_iCacheOffsetSFFI) * iMaxSecuritiesPerAccount + iSecurityAccountIndex - 1;
|
||||
bool bCheckCache = (index >= 0 && index < m_iCacheSizeSFFI);
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
iSecurityFlatFileIndex = m_CacheSFFI[index];
|
||||
}
|
||||
|
||||
if (iSecurityFlatFileIndex == -1) {
|
||||
RNGSEED OldSeed;
|
||||
UINT iGeneratedIndexCount = 0; // number of currently generated unique flat file indexes
|
||||
UINT i;
|
||||
|
||||
OldSeed = m_rnd.GetSeed();
|
||||
m_rnd.SetSeed(GetStartingSecIDSeed(iCustomerAccount));
|
||||
|
||||
iGeneratedIndexCount = 0;
|
||||
|
||||
while (iGeneratedIndexCount < iSecurityAccountIndex) {
|
||||
iSecurityFlatFileIndex = m_rnd.RndInt64Range(0, m_iSecCount - 1);
|
||||
|
||||
for (i = 0; i < iGeneratedIndexCount; ++i) {
|
||||
if (m_SecurityIds[i] == iSecurityFlatFileIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
// If a duplicate is found, overwrite it in the same location
|
||||
// so basically no changes are made.
|
||||
//
|
||||
m_SecurityIds[i] = iSecurityFlatFileIndex;
|
||||
|
||||
// If no duplicate is found, increment the count of unique ids
|
||||
//
|
||||
if (i == iGeneratedIndexCount) {
|
||||
++iGeneratedIndexCount;
|
||||
}
|
||||
}
|
||||
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
m_CacheSFFI[index] = iSecurityFlatFileIndex;
|
||||
}
|
||||
}
|
||||
return iSecurityFlatFileIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate random customer account and security to perfrom a trade on.
|
||||
* This function is used by both the runtime driver (CCETxnInputGenerator)
|
||||
* and by the loader when generating initial trades (CTradeGen).
|
||||
*
|
||||
*/
|
||||
void GenerateRandomAccountSecurity(TIdent iCustomer, // in
|
||||
eCustomerTier iTier, // in
|
||||
TIdent *piCustomerAccount, // out
|
||||
TIdent *piSecurityFlatFileIndex, // out
|
||||
UINT *piSecurityAccountIndex) // out
|
||||
{
|
||||
TIdent iCustomerAccount;
|
||||
int iAccountCount;
|
||||
int iTotalAccountSecurities;
|
||||
UINT iSecurityAccountIndex; // index of the selected security in the
|
||||
// account's basket
|
||||
TIdent iSecurityFlatFileIndex; // index of the selected security in the
|
||||
// input flat file
|
||||
|
||||
// Select random account for the customer
|
||||
//
|
||||
m_CustomerAccountTable.GenerateRandomAccountId(m_rnd, iCustomer, iTier, &iCustomerAccount, &iAccountCount);
|
||||
|
||||
iTotalAccountSecurities = GetNumberOfSecurities(iCustomerAccount, iTier, iAccountCount);
|
||||
|
||||
// Select random security in the account
|
||||
//
|
||||
iSecurityAccountIndex = (UINT)m_rnd.RndIntRange(1, iTotalAccountSecurities);
|
||||
|
||||
iSecurityFlatFileIndex = GetSecurityFlatFileIndex(iCustomerAccount, iSecurityAccountIndex);
|
||||
|
||||
// Return data
|
||||
//
|
||||
*piCustomerAccount = iCustomerAccount;
|
||||
*piSecurityFlatFileIndex = iSecurityFlatFileIndex;
|
||||
if (piSecurityAccountIndex != NULL) {
|
||||
*piSecurityAccountIndex = iSecurityAccountIndex;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsAbortedTrade(TIdent TradeId) {
|
||||
bool bResult = false;
|
||||
if (iAbortedTradeModFactor == TradeId % iAbortTrade) {
|
||||
bResult = true;
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // HOLDINGS_AND_TRADES_TABLE_H
|
||||
59
external/duckdb/third_party/tpce-tool/include/main/IndustryTable.h
vendored
Normal file
59
external/duckdb/third_party/tpce-tool/include/main/IndustryTable.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Industry table.
|
||||
*/
|
||||
#ifndef INDUSTRY_TABLE_H
|
||||
#define INDUSTRY_TABLE_H
|
||||
|
||||
#include "FixedTable.h"
|
||||
#include "input/DataFileTypes.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CIndustryTable : public FixedTable<IndustryDataFile_t, INDUSTRY_ROW> {
|
||||
public:
|
||||
CIndustryTable(const IndustryDataFile_t &dataFile);
|
||||
~CIndustryTable();
|
||||
|
||||
virtual void LoadTableRow();
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // INDUSTRY_TABLE_H
|
||||
136
external/duckdb/third_party/tpce-tool/include/main/LastTradeTable.h
vendored
Normal file
136
external/duckdb/third_party/tpce-tool/include/main/LastTradeTable.h
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the LAST_TRADE table.
|
||||
*/
|
||||
#ifndef LAST_TRADE_TABLE_H
|
||||
#define LAST_TRADE_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
#include "MEESecurity.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CLastTradeTable : public TableTemplate<LAST_TRADE_ROW> {
|
||||
TIdent m_iSecurityCount;
|
||||
TIdent m_iStartFromSecurity;
|
||||
const CSecurityFile &m_SecurityFile;
|
||||
CDateTime m_date;
|
||||
CMEESecurity m_MEESecurity;
|
||||
int m_iHoursOfInitialTrades;
|
||||
TIdent m_iSecurityCountForOneLoadUnit;
|
||||
|
||||
/*
|
||||
* LAST_TRADE table row generation
|
||||
*/
|
||||
void GenerateLastTradeRow() {
|
||||
m_SecurityFile.CreateSymbol(m_iLastRowNumber, m_row.LT_S_SYMB, static_cast<int>(sizeof(m_row.LT_S_SYMB)));
|
||||
|
||||
m_row.LT_DTS = m_date;
|
||||
|
||||
m_MEESecurity.Init(m_iHoursOfInitialTrades * SecondsPerHour, NULL, NULL, 0);
|
||||
|
||||
m_row.LT_PRICE = m_MEESecurity.CalculatePrice(m_iLastRowNumber, 0).DollarAmount();
|
||||
|
||||
m_row.LT_OPEN_PRICE = m_MEESecurity.CalculatePrice(m_iLastRowNumber, 0).DollarAmount();
|
||||
|
||||
// LT_VOL tracks the trading volume for the current day. Initial
|
||||
// population ends on a day boundary, so set LT_VOL to 0 for the start
|
||||
// of the next day.
|
||||
m_row.LT_VOL = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
// No RNG calls in this class, so don't need to reset the RNG.
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
}
|
||||
|
||||
public:
|
||||
/*
|
||||
* Constructor.
|
||||
*/
|
||||
CLastTradeTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer,
|
||||
INT32 iHoursOfInitialTrades)
|
||||
: TableTemplate<LAST_TRADE_ROW>(), m_SecurityFile(dfm.SecurityFile()),
|
||||
m_iHoursOfInitialTrades(iHoursOfInitialTrades) {
|
||||
m_iSecurityCount = m_SecurityFile.CalculateSecurityCount(iCustomerCount);
|
||||
m_iStartFromSecurity = m_SecurityFile.CalculateStartFromSecurity(iStartFromCustomer);
|
||||
|
||||
m_iLastRowNumber = m_iStartFromSecurity;
|
||||
|
||||
// Go to the last day of initial trades.
|
||||
//
|
||||
m_date.Set(InitialTradePopulationBaseYear, InitialTradePopulationBaseMonth, InitialTradePopulationBaseDay,
|
||||
InitialTradePopulationBaseHour, InitialTradePopulationBaseMinute, InitialTradePopulationBaseSecond,
|
||||
InitialTradePopulationBaseFraction);
|
||||
m_date.Add(m_iHoursOfInitialTrades / HoursPerWorkDay, 0, true);
|
||||
|
||||
m_iSecurityCountForOneLoadUnit = m_SecurityFile.CalculateSecurityCount(iDefaultLoadUnitSize);
|
||||
};
|
||||
|
||||
bool GenerateNextRecord() {
|
||||
if (m_iLastRowNumber % m_iSecurityCountForOneLoadUnit == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
GenerateLastTradeRow();
|
||||
|
||||
++m_iLastRowNumber;
|
||||
|
||||
// Update state info
|
||||
m_bMoreRecords = m_iLastRowNumber < (m_iStartFromSecurity + m_iSecurityCount);
|
||||
|
||||
return (MoreRecords());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // LAST_TRADE_TABLE_H
|
||||
145
external/duckdb/third_party/tpce-tool/include/main/MEE.h
vendored
Normal file
145
external/duckdb/third_party/tpce-tool/include/main/MEE.h
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This class provides Market Exchange Emulator
|
||||
* functionality. It accepts trade requests for
|
||||
*processing; generates a negative exponential delay for each trade to simulate
|
||||
*the market processing time; manages the timers for all trades being processed;
|
||||
*generates Trade-Result and Market-Feed input data to be used by a sponsor
|
||||
*provided callback interface to the SUT (see MEESUTInterface.h).
|
||||
*
|
||||
* The constructor for this class requires two parameters.
|
||||
* - TradingTimeSoFar: the number of seconds for which
|
||||
* trades have been run against the database. This allows
|
||||
* the MEE to pick up on the price curves from where it
|
||||
* last left off. If doing this isn't important than 0 can
|
||||
* passed in.
|
||||
* - pSUT: a pointer to an instance of a sponsor provided
|
||||
* subclassing of the CMEESUTInterface class.
|
||||
*
|
||||
* - pLogger: a pointer to an instance of CEGenLogger or a
|
||||
* sponsor provided subclassing of the CBaseLogger class.
|
||||
*
|
||||
* The MEE provides the following entry points.
|
||||
*
|
||||
* - SetBaseTime: used to cordinate the price curves
|
||||
* across multiple instances of this class. This method
|
||||
* should be called "at the same time" for all instances.
|
||||
* This call should be made just prior to starting
|
||||
* transactions. There is no return value.
|
||||
*
|
||||
* - SubmitTradeRequest: used for submitting a trade
|
||||
* request into the market. The return value is the number
|
||||
* of milliseconds before the next timer is set to expire.
|
||||
*
|
||||
* - GenerateTradeResult: called whenever the current
|
||||
*timer has expired (i.e. whenever the number of milliseconds returned by either
|
||||
*SubmitTradeRequest or GenerateTradeResult has elapsed). The return value is
|
||||
* the number of milliseconds before the next timer is set
|
||||
* to expire.
|
||||
*
|
||||
* - DisableTickerTape / EnableTickerTape: by default, the
|
||||
* ticker tape functionality of the MEE is enabled. It can
|
||||
* be disabled, or re-enabled by calls to these methods.
|
||||
* Disabling the ticker tape is useful at the end of a
|
||||
* test run to allow processing of submitted orders to
|
||||
* continue (Trade-Results) while not generating any
|
||||
* ticker tape activity (Market-Feeds).
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef MEE_H
|
||||
#define MEE_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "MEETradeRequestActions.h"
|
||||
#include "TxnHarnessStructs.h"
|
||||
#include "MEEPriceBoard.h"
|
||||
#include "MEETickerTape.h"
|
||||
#include "MEETradingFloor.h"
|
||||
#include "MEESUTInterface.h"
|
||||
#include "BaseLogger.h"
|
||||
#include "DriverParamSettings.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CMEE {
|
||||
private:
|
||||
CDriverMEESettings m_DriverMEESettings;
|
||||
|
||||
CMEESUTInterface *m_pSUT;
|
||||
CBaseLogger *m_pLogger;
|
||||
CMEEPriceBoard m_PriceBoard;
|
||||
CMEETickerTape m_TickerTape;
|
||||
CMEETradingFloor m_TradingFloor;
|
||||
CDateTime m_BaseTime;
|
||||
CDateTime m_CurrentTime;
|
||||
|
||||
CMutex m_MEELock;
|
||||
|
||||
// Automatically generate unique RNG seeds
|
||||
void AutoSetRNGSeeds(UINT32 UniqueId);
|
||||
|
||||
public:
|
||||
static const INT32 NO_OUTSTANDING_TRADES = CMEETradingFloor::NO_OUTSTANDING_TRADES;
|
||||
|
||||
// Constructor - automatic RNG seed generation
|
||||
CMEE(INT32 TradingTimeSoFar, CMEESUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &inputFiles,
|
||||
UINT32 UniqueId);
|
||||
|
||||
// Constructor - RNG seed provided
|
||||
CMEE(INT32 TradingTimeSoFar, CMEESUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &inputFiles,
|
||||
UINT32 UniqueId, RNGSEED TickerTapeRNGSeed, RNGSEED TradingFloorRNGSeed);
|
||||
|
||||
~CMEE(void);
|
||||
|
||||
RNGSEED GetTickerTapeRNGSeed(void);
|
||||
RNGSEED GetTradingFloorRNGSeed(void);
|
||||
|
||||
void SetBaseTime(void);
|
||||
|
||||
INT32 SubmitTradeRequest(PTradeRequest pTradeRequest);
|
||||
INT32 GenerateTradeResult(void);
|
||||
|
||||
bool EnableTickerTape(void);
|
||||
bool DisableTickerTape(void);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // MEE_H
|
||||
92
external/duckdb/third_party/tpce-tool/include/main/MEEPriceBoard.h
vendored
Normal file
92
external/duckdb/third_party/tpce-tool/include/main/MEEPriceBoard.h
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This class provides price board functionality for the
|
||||
* MEE. This allows for the lookup of any security's price
|
||||
* at any point in time.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef MEE_PRICE_BOARD_H
|
||||
#define MEE_PRICE_BOARD_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "EGenTables_stdafx.h"
|
||||
#include "MEESecurity.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CMEEPriceBoard {
|
||||
|
||||
private:
|
||||
// Mean delay between Pending and Submission times
|
||||
// for an immediatelly triggered (in-the-money) limit order.
|
||||
//
|
||||
double m_fMeanInTheMoneySubmissionDelay;
|
||||
CMEESecurity m_Security;
|
||||
const CSecurityFile &m_SecurityFile;
|
||||
|
||||
public:
|
||||
TIdent m_iNumberOfSecurities;
|
||||
|
||||
CMEEPriceBoard(INT32 TradingTimeSoFar, CDateTime *pBaseTime, CDateTime *pCurrentTime, const DataFileManager &dfm);
|
||||
~CMEEPriceBoard(void);
|
||||
|
||||
void GetSymbol(TIdent SecurityIndex,
|
||||
char *szOutput, // output buffer
|
||||
size_t iOutputLen); // size of the output buffer (including null));
|
||||
|
||||
CMoney GetMinPrice();
|
||||
|
||||
CMoney GetMaxPrice();
|
||||
|
||||
CMoney GetCurrentPrice(TIdent SecurityIndex);
|
||||
CMoney GetCurrentPrice(char *pSecuritySymbol);
|
||||
|
||||
CMoney CalculatePrice(char *pSecuritySymbol, double fTime);
|
||||
|
||||
double GetSubmissionTime(char *pSecuritySymbol, double fPendingTime, CMoney fLimitPrice, eTradeTypeID TradeType);
|
||||
double GetSubmissionTime(TIdent SecurityIndex, double fPendingTime, CMoney fLimitPrice, eTradeTypeID TradeType);
|
||||
double GetCompletionTime(TIdent SecurityIndex, double fSubmissionTime,
|
||||
CMoney *pCompletionPrice // output param
|
||||
);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // MEE_PRICE_BOARD_H
|
||||
75
external/duckdb/third_party/tpce-tool/include/main/MEESUTInterface.h
vendored
Normal file
75
external/duckdb/third_party/tpce-tool/include/main/MEESUTInterface.h
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
/******************************************************************************
|
||||
* Description: Interface base class to be used for deriving a sponsor
|
||||
* specific class for commmunicating with the SUT. The
|
||||
* recommended implementation for each of method is to
|
||||
* perform a memcpy of the provided data structure and
|
||||
* then return SUCCESS. A seperate thread of execution
|
||||
* can then pick up the copy of the data, and perform the
|
||||
* actual transaction against the SUT. This asynchronicity
|
||||
* prevents the MEE from getting held up doing the actual
|
||||
* Trade-Result or Market-Feed.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef MEE_SUT_INTERFACE_H
|
||||
#define MEE_SUT_INTERFACE_H
|
||||
|
||||
#include "TxnHarnessStructs.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CMEESUTInterface {
|
||||
public:
|
||||
/*
|
||||
* Virtual destructor. Provided so that a sponsor-specific
|
||||
* destructor can be called on destruction from the base-class pointer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
virtual ~CMEESUTInterface(){};
|
||||
|
||||
virtual bool TradeResult(PTradeResultTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
virtual bool MarketFeed(PMarketFeedTxnInput pTxnInput) = 0; // return whether it was successful
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // MEE_SUT_INTERFACE_H
|
||||
246
external/duckdb/third_party/tpce-tool/include/main/MEESecurity.h
vendored
Normal file
246
external/duckdb/third_party/tpce-tool/include/main/MEESecurity.h
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy, Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: This class represents an extension of the
|
||||
* MEEApproximation class orginally written by Sergey for
|
||||
* EGenLoader.
|
||||
* This new class now provides additional functionality
|
||||
* for use at runtime by the MEE as well. All of the
|
||||
* price/time functionality needed to emulate a securities
|
||||
* behavior in the market is captured here.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef MEE_SECURITY_H
|
||||
#define MEE_SECURITY_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "TradeTypeIDs.h"
|
||||
#include "SecurityPriceRange.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CMEESecurity {
|
||||
private:
|
||||
CRandom m_rnd;
|
||||
CMoney m_fRangeLow; // price range start
|
||||
CMoney m_fRangeHigh; // price range end
|
||||
CMoney m_fRange; // price range length (high - low)
|
||||
int m_iPeriod; // time to get to the same price (in seconds)
|
||||
INT32 m_TradingTimeSoFar; // for picking up where we last left off on the
|
||||
// price curve
|
||||
|
||||
CDateTime *m_pBaseTime; // Wall clock time corresponding to m_fInitialTime
|
||||
CDateTime *m_pCurrentTime;
|
||||
|
||||
// Mean delay between Pending and Submission times
|
||||
// for an immediatelly triggered (in-the-money) limit
|
||||
// order. Calculated outside based on scale factor
|
||||
// and the number of customers (e.g. MF rate).
|
||||
//
|
||||
// The actual delay is randomly calculated in the range
|
||||
// [0.5 * Mean .. 1.5 * Mean]
|
||||
//
|
||||
double m_fMeanInTheMoneySubmissionDelay;
|
||||
|
||||
/*
|
||||
* Calculate the "unique" starting offset
|
||||
* in the price curve based on the security ID (0-based)
|
||||
* 0 corresponds to m_fRangeLow price,
|
||||
* m_fPeriod/2 corresponds to m_fRangeHigh price,
|
||||
* m_fPeriod corresponds again to m_fRangeLow price
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN SecurityIndex - unique security index to generate a unique
|
||||
* starting price
|
||||
*
|
||||
* RETURNS:
|
||||
* time from which to calculate initial price
|
||||
*/
|
||||
inline double InitialTime(TIdent SecurityIndex);
|
||||
|
||||
/*
|
||||
* Negative exponential distribution.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN fMean - mean value of the distribution
|
||||
*
|
||||
* RETURNS:
|
||||
* random value according to the negative
|
||||
* exponential distribution with the given mean.
|
||||
*/
|
||||
inline double NegExp(double fMean);
|
||||
|
||||
/*
|
||||
* Calculate time required to move between certain prices
|
||||
* with certain initial direction of price change.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN fStartPrice - price at the start of the time interval
|
||||
* IN fEndPrice - price at the end of the time interval
|
||||
* IN iStartDirection - direction (up or down) on the price curve
|
||||
* at the start of the time interval
|
||||
*
|
||||
* RETURNS:
|
||||
* seconds required to move from the start price to the end price
|
||||
*/
|
||||
double CalculateTime(CMoney fStartPrice, CMoney fEndPrice, int iStartDirection);
|
||||
|
||||
public:
|
||||
/*
|
||||
* Default constructor (no parameters) to be able
|
||||
* to allocate an array of security objects.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
CMEESecurity();
|
||||
|
||||
/*
|
||||
* Initialize before the first use.
|
||||
* Separated from constructor in order to have default (no-parameters)
|
||||
* constructor.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN TradeTimeSoFar - point where we last left
|
||||
* off on the price curve IN pBaseTime - wall clock
|
||||
* time corresponding to the initial time for all securities IN pCurrentTime
|
||||
* - current time for the security (determines current price) IN
|
||||
* fMeanInTheMoneySubmissionDelay - Mean delay between Pending and
|
||||
* Submission times for an immediatelly triggered (in-the-money) limit
|
||||
* order.
|
||||
*
|
||||
* RETURNS:
|
||||
* none
|
||||
*/
|
||||
void Init(INT32 TradingTimeSoFar, CDateTime *pBaseTime, CDateTime *pCurrentTime,
|
||||
double fMeanInTheMoneySubmissionDelay);
|
||||
|
||||
/*
|
||||
* Calculate price at a certain point in time.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN SecurityIndex - unique security index to generate a
|
||||
* unique starting price IN fTime - seconds from initial time
|
||||
*
|
||||
* RETURNS:
|
||||
* price according to the triangular function
|
||||
* that will be achived at the given time
|
||||
*/
|
||||
CMoney CalculatePrice(TIdent SecurityIndex, double fTime);
|
||||
|
||||
/*
|
||||
* Calculate current price for the security identified by its index
|
||||
* (0-based).
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN SecurityIndex - unique identifier for the security.
|
||||
*
|
||||
* RETURNS:
|
||||
* price at this point in time given with integer number of cents.
|
||||
*/
|
||||
CMoney GetCurrentPrice(TIdent SecurityIndex);
|
||||
|
||||
/*
|
||||
* Return minimum price on the price curve for any security.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* minimum price given with integer number of cents.
|
||||
*/
|
||||
CMoney GetMinPrice(void);
|
||||
|
||||
/*
|
||||
* Return maximum price on the price curve for any security.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* maximum price given with integer number of cents.
|
||||
*/
|
||||
CMoney GetMaxPrice(void);
|
||||
|
||||
/*
|
||||
* Calculate triggering time for limit orders.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN SecurityIndex - unique security index to generate a
|
||||
* unique starting price IN fPendingTime - pending time of the order, in
|
||||
* seconds from time 0 IN fLimitPrice - limit price of the order IN
|
||||
* TradeType - order trade type
|
||||
*
|
||||
* RETURNS:
|
||||
* the expected submission time
|
||||
*/
|
||||
double GetSubmissionTime(TIdent SecurityIndex, double fPendingTime, CMoney fLimitPrice, eTradeTypeID TradeType);
|
||||
|
||||
/*
|
||||
* Return the expected completion time and the completion price.
|
||||
* Completion time is between 0 and 5 seconds
|
||||
* with 1 sec mean.
|
||||
*
|
||||
* Used to calculate completion time for
|
||||
* both limit (first must get submission time)
|
||||
* and market orders.
|
||||
*
|
||||
* Equivalent of MEE function sequence
|
||||
* 'receive trade' then 'complete the trade request'.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN SecurityIndex - unique security index to generate a
|
||||
* unique starting price IN fSubmissionTime - time when the order was
|
||||
* submitted, in seconds from time 0 OUT pCompletionPrice - completion
|
||||
* price of the order
|
||||
*
|
||||
* RETURNS:
|
||||
* the approximated completion time for the trade
|
||||
*
|
||||
*/
|
||||
double GetCompletionTime(TIdent SecurityIndex, double fSubmissionTime,
|
||||
CMoney *pCompletionPrice // output parameter
|
||||
);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // MEE_SECURITY_H
|
||||
112
external/duckdb/third_party/tpce-tool/include/main/MEETickerTape.h
vendored
Normal file
112
external/duckdb/third_party/tpce-tool/include/main/MEETickerTape.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: Class that implements the ticker tape functionality of
|
||||
* the market. This class handles the batching up of
|
||||
* individual ticker entries into a batch suitable for the
|
||||
* Market-Feed transaction. For each "real" trade result
|
||||
* that gets added to the ticker, a number of artificial
|
||||
* entries are padded into the batch.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef MEE_TICKER_TAPE_H
|
||||
#define MEE_TICKER_TAPE_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "TxnHarnessStructs.h"
|
||||
#include "TimerWheel.h"
|
||||
#include "MEESUTInterface.h"
|
||||
#include "MEEPriceBoard.h"
|
||||
|
||||
#include "input/DataFileTypes.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CMEETickerTape {
|
||||
private:
|
||||
CMEESUTInterface *m_pSUT;
|
||||
CMEEPriceBoard *m_pPriceBoard;
|
||||
TMarketFeedTxnInput m_TxnInput;
|
||||
INT32 m_BatchIndex;
|
||||
INT32 m_BatchDuplicates;
|
||||
CRandom m_rnd;
|
||||
bool m_Enabled;
|
||||
const StatusTypeDataFile_t &m_StatusType;
|
||||
const TradeTypeDataFile_t &m_TradeType;
|
||||
|
||||
static const int LIMIT_TRIGGER_TRADE_QTY;
|
||||
static const int RANDOM_TRADE_QTY_1;
|
||||
static const int RANDOM_TRADE_QTY_2;
|
||||
|
||||
CTimerWheel<TTickerEntry, CMEETickerTape, 900, 1000> m_LimitOrderTimers; // Size wheel for 900 seconds with 1,000
|
||||
// millisecond resolution.
|
||||
queue<PTickerEntry> m_InTheMoneyLimitOrderQ;
|
||||
|
||||
CDateTime *m_pBaseTime;
|
||||
CDateTime *m_pCurrentTime;
|
||||
|
||||
void AddToBatch(PTickerEntry pTickerEntry);
|
||||
void AddArtificialEntries(void);
|
||||
void AddLimitTrigger(PTickerEntry pTickerEntry);
|
||||
|
||||
// Performs initialization common to all constructors.
|
||||
void Initialize(void);
|
||||
|
||||
public:
|
||||
// Constructor - use default RNG seed
|
||||
CMEETickerTape(CMEESUTInterface *pSUT, CMEEPriceBoard *pPriceBoard, CDateTime *pBaseTime, CDateTime *pCurrentTime,
|
||||
const DataFileManager &inputFiles);
|
||||
|
||||
// Constructor - RNG seed provided
|
||||
CMEETickerTape(CMEESUTInterface *pSUT, CMEEPriceBoard *pPriceBoard, CDateTime *pBaseTime, CDateTime *pCurrentTime,
|
||||
RNGSEED RNGSeed, const DataFileManager &inputFiles);
|
||||
|
||||
~CMEETickerTape(void);
|
||||
|
||||
void AddEntry(PTickerEntry pTickerEntry);
|
||||
void PostLimitOrder(PTradeRequest pTradeRequest);
|
||||
bool DisableTicker(void);
|
||||
bool EnableTicker(void);
|
||||
eTradeTypeID ConvertTradeTypeIdToEnum(char *pTradeType);
|
||||
|
||||
RNGSEED GetRNGSeed(void);
|
||||
void SetRNGSeed(RNGSEED RNGSeed);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // MEE_TICKER_TAPE_H
|
||||
51
external/duckdb/third_party/tpce-tool/include/main/MEETradeRequestActions.h
vendored
Normal file
51
external/duckdb/third_party/tpce-tool/include/main/MEETradeRequestActions.h
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: These are the different actions the MEE can take
|
||||
* with an inbound trade request.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef MEE_TRADE_REQUEST_ACTIONS_H
|
||||
#define MEE_TRADE_REQUEST_ACTIONS_H
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
enum eMEETradeRequestAction { eMEEProcessOrder = 0, eMEESetLimitOrderTrigger };
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // MEE_TRADE_REQUEST_ACTIONS_H
|
||||
99
external/duckdb/third_party/tpce-tool/include/main/MEETradingFloor.h
vendored
Normal file
99
external/duckdb/third_party/tpce-tool/include/main/MEETradingFloor.h
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: Class that handles all of the trading floor activities
|
||||
* for the market. This includes providing functionality
|
||||
* for accepting orders that need to be submitted to the
|
||||
* trading floor, assigning a processing delay time to
|
||||
* the order, and then completing the order after the
|
||||
* processing delay is over.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef MEE_TRADING_FLOOR_H
|
||||
#define MEE_TRADING_FLOOR_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "TxnHarnessStructs.h"
|
||||
#include "TimerWheel.h"
|
||||
#include "MEESUTInterface.h"
|
||||
#include "MEEPriceBoard.h"
|
||||
#include "MEETickerTape.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CMEETradingFloor {
|
||||
private:
|
||||
CMEESUTInterface *m_pSUT;
|
||||
CMEEPriceBoard *m_pPriceBoard;
|
||||
CMEETickerTape *m_pTickerTape;
|
||||
|
||||
CDateTime *m_pBaseTime;
|
||||
CDateTime *m_pCurrentTime;
|
||||
|
||||
CTimerWheel<TTradeRequest, CMEETradingFloor, 5, 1> m_OrderTimers; // Size wheel for 5 seconds with 1 millisecond
|
||||
// resolution.
|
||||
CRandom m_rnd;
|
||||
double m_OrderProcessingDelayMean;
|
||||
static const INT32 m_MaxOrderProcessingDelay = 5;
|
||||
|
||||
double GenProcessingDelay(double fMean);
|
||||
void SendTradeResult(PTradeRequest pTradeRequest);
|
||||
|
||||
public:
|
||||
static const INT32 NO_OUTSTANDING_TRADES =
|
||||
CTimerWheel<TTradeRequest, CMEETradingFloor, 5, 1>::NO_OUTSTANDING_TIMERS;
|
||||
|
||||
// Constructor - use default RNG seed
|
||||
CMEETradingFloor(CMEESUTInterface *pSUT, CMEEPriceBoard *pPriceBoard, CMEETickerTape *pTickerTape,
|
||||
CDateTime *pBaseTime, CDateTime *pCurrentTime);
|
||||
|
||||
// Constructor - RNG seed provided
|
||||
CMEETradingFloor(CMEESUTInterface *pSUT, CMEEPriceBoard *pPriceBoard, CMEETickerTape *pTickerTape,
|
||||
CDateTime *pBaseTime, CDateTime *pCurrentTime, RNGSEED RNGSeed);
|
||||
|
||||
~CMEETradingFloor(void);
|
||||
|
||||
INT32 SubmitTradeRequest(PTradeRequest pTradeRequest);
|
||||
INT32 GenerateTradeResult(void);
|
||||
|
||||
RNGSEED GetRNGSeed(void);
|
||||
void SetRNGSeed(RNGSEED RNGSeed);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // MEE_TRADING_FLOOR_H
|
||||
196
external/duckdb/third_party/tpce-tool/include/main/NewsItemAndXRefTable.h
vendored
Normal file
196
external/duckdb/third_party/tpce-tool/include/main/NewsItemAndXRefTable.h
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the News Item and News XRef tables.
|
||||
*/
|
||||
#ifndef NEWS_ITEM_AND_XREG_TABLE_H
|
||||
#define NEWS_ITEM_AND_XREG_TABLE_H
|
||||
|
||||
#include "EGenTables_common.h"
|
||||
#include "CompanyTable.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
const int iNewsItemsPerCompany = 2;
|
||||
const int iNewsItemMaxDaysAgo = 50; // how many days ago can a news item be dated
|
||||
|
||||
const int iRNGSkipOneRowNews = 4 + cNI_ITEM_len; // number of RNG calls for one row
|
||||
|
||||
typedef struct NEWS_ITEM_AND_XREF_ROW {
|
||||
NEWS_ITEM_ROW news_item;
|
||||
NEWS_XREF_ROW news_xref;
|
||||
} * PNEWS_ITEM_AND_XREF_ROW;
|
||||
|
||||
class CNewsItemAndXRefTable : public TableTemplate<NEWS_ITEM_AND_XREF_ROW> {
|
||||
CCompanyTable m_CompanyTable;
|
||||
const NewsDataFile_t &m_News;
|
||||
const LastNameDataFile_t &m_LastNames;
|
||||
CDateTime m_NewsBaseDate;
|
||||
int m_iNewsItemsGeneratedForCompany;
|
||||
TIdent m_iNewsCountForOneLoadUnit;
|
||||
|
||||
void GenerateNewsItemHeadlineAndSummary(NEWS_ITEM_ROW &news_item) {
|
||||
int iThreshold;
|
||||
unsigned int iLen = 0;
|
||||
const char *szWord;
|
||||
|
||||
while (iLen < sizeof(news_item.NI_ITEM) - 1) {
|
||||
iThreshold = m_rnd.RndIntRange(0, m_News.size() - 1);
|
||||
|
||||
szWord = m_News[iThreshold].WORD_CSTR();
|
||||
|
||||
while (szWord && *szWord && (iLen < sizeof(news_item.NI_ITEM) - 1)) {
|
||||
news_item.NI_ITEM[iLen++] = *szWord++; // copy one letter at a time
|
||||
}
|
||||
|
||||
if (iLen < sizeof(news_item.NI_ITEM) - 1) {
|
||||
news_item.NI_ITEM[iLen++] = ' '; // add space at the end of a word
|
||||
}
|
||||
}
|
||||
|
||||
news_item.NI_ITEM[iLen] = '\0'; // NULL terminate in case if the last
|
||||
// word was copied only partially
|
||||
|
||||
// Now copy the headline and summary from the generated item.
|
||||
memcpy(news_item.NI_HEADLINE, news_item.NI_ITEM, sizeof(news_item.NI_HEADLINE) - 1);
|
||||
// news_item.NI_HEADLINE will be zero-terminated because it is
|
||||
// initialized to all 0s in TableTemplate constructor and the last
|
||||
// character is not overwritten.
|
||||
|
||||
// Now copy the headline and summary from the generated item.
|
||||
memcpy(news_item.NI_SUMMARY, news_item.NI_ITEM, sizeof(news_item.NI_SUMMARY) - 1);
|
||||
// news_item.NI_SUMMARY will be zero-terminated because it is
|
||||
// initialized to all 0s in TableTemplate constructor and the last
|
||||
// character is not overwritten.
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedTableDefault, (RNGSEED)m_iLastRowNumber * iRNGSkipOneRowNews));
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
}
|
||||
|
||||
public:
|
||||
CNewsItemAndXRefTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer,
|
||||
INT32 iHoursOfInitialTrades)
|
||||
: m_CompanyTable(dfm, iCustomerCount, iStartFromCustomer), m_News(dfm.NewsDataFile()),
|
||||
m_LastNames(dfm.LastNameDataFile()), m_iNewsItemsGeneratedForCompany(0) {
|
||||
m_iLastRowNumber = iNewsItemsPerCompany * dfm.CompanyFile().CalculateStartFromCompany(iStartFromCustomer);
|
||||
|
||||
// Go to the last day of initial trades.
|
||||
// News items will be dated up to iNewsItemMaxDaysAgo days back from
|
||||
// that day.
|
||||
//
|
||||
m_NewsBaseDate.Set(InitialTradePopulationBaseYear, InitialTradePopulationBaseMonth,
|
||||
InitialTradePopulationBaseDay, InitialTradePopulationBaseHour,
|
||||
InitialTradePopulationBaseMinute, InitialTradePopulationBaseSecond,
|
||||
InitialTradePopulationBaseFraction);
|
||||
m_NewsBaseDate.Add(iHoursOfInitialTrades / HoursPerWorkDay, 0, true);
|
||||
|
||||
m_iNewsCountForOneLoadUnit =
|
||||
dfm.CompanyFile().CalculateCompanyCount(iDefaultLoadUnitSize) * iNewsItemsPerCompany;
|
||||
};
|
||||
|
||||
/*
|
||||
* Generates all column values for the next row.
|
||||
*/
|
||||
bool GenerateNextRecord() {
|
||||
int iAddDayNo, iAddMSec, iThreshold;
|
||||
|
||||
// Reset RNG at Load Unit boundary, so that all data is repeatable.
|
||||
//
|
||||
if (m_iLastRowNumber % m_iNewsCountForOneLoadUnit == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
// Generate NEWS_ITEM row
|
||||
m_row.news_item.NI_ID = m_iLastRowNumber + 1; // row number starts from 0
|
||||
GenerateNewsItemHeadlineAndSummary(m_row.news_item);
|
||||
iAddDayNo = m_rnd.RndIntRange(0, iNewsItemMaxDaysAgo);
|
||||
iAddMSec = m_rnd.RndIntRange(0, MsPerDay);
|
||||
m_row.news_item.NI_DTS = m_NewsBaseDate; // substruct from the base date
|
||||
m_row.news_item.NI_DTS.Add((-1) * iAddDayNo, (-1) * iAddMSec);
|
||||
|
||||
iThreshold = m_rnd.RndIntRange(0, m_LastNames.size() - 1);
|
||||
strncpy(m_row.news_item.NI_AUTHOR, m_LastNames[iThreshold].NAME_CSTR(), sizeof(m_row.news_item.NI_AUTHOR));
|
||||
|
||||
iThreshold = m_rnd.RndIntRange(0, m_LastNames.size() - 1);
|
||||
strncpy(m_row.news_item.NI_SOURCE, m_LastNames[iThreshold].NAME_CSTR(), sizeof(m_row.news_item.NI_SOURCE));
|
||||
|
||||
// Generate NEWS_XREF row
|
||||
m_row.news_xref.NX_NI_ID = m_row.news_item.NI_ID;
|
||||
m_row.news_xref.NX_CO_ID = m_CompanyTable.GetCurrentCO_ID();
|
||||
|
||||
++m_iNewsItemsGeneratedForCompany;
|
||||
|
||||
++m_iLastRowNumber;
|
||||
|
||||
if (m_iNewsItemsGeneratedForCompany >= iNewsItemsPerCompany) {
|
||||
m_bMoreRecords = m_CompanyTable.GenerateNextCO_ID();
|
||||
m_iNewsItemsGeneratedForCompany = 0;
|
||||
} else {
|
||||
m_bMoreRecords = true; // need to generate more rows for at least
|
||||
// the current company
|
||||
}
|
||||
|
||||
return (MoreRecords());
|
||||
// return (m_iLastRowNumber < 10);
|
||||
};
|
||||
|
||||
const NEWS_ITEM_ROW &GetNewsItemRow() {
|
||||
return m_row.news_item;
|
||||
}
|
||||
const NEWS_XREF_ROW &GetNewsXRefRow() {
|
||||
return m_row.news_xref;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // NEWS_ITEM_AND_XREG_TABLE_H
|
||||
43
external/duckdb/third_party/tpce-tool/include/main/NullLoad_stdafx.h
vendored
Normal file
43
external/duckdb/third_party/tpce-tool/include/main/NullLoad_stdafx.h
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
#ifndef EGEN_NULLLOADER_STDAFX_H
|
||||
#define EGEN_NULLLOADER_STDAFX_H
|
||||
|
||||
#include "NullLoader.h"
|
||||
#include "NullLoaderFactory.h"
|
||||
|
||||
#endif // #ifndef EGEN_NULLLOADER_STDAFX_H
|
||||
80
external/duckdb/third_party/tpce-tool/include/main/NullLoader.h
vendored
Normal file
80
external/duckdb/third_party/tpce-tool/include/main/NullLoader.h
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
/*
|
||||
* Null loader e.g. it throws away the passed in generated data.
|
||||
* Useful for testing.
|
||||
*/
|
||||
|
||||
#ifndef NULL_LOADER_H
|
||||
#define NULL_LOADER_H
|
||||
|
||||
#include "BaseLoader.h"
|
||||
#include "unusedflag.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
template <typename T> class CNullLoader : public CBaseLoader<T> {
|
||||
|
||||
public:
|
||||
/*
|
||||
* Routine to write a new record into the database.
|
||||
* Since this is a NULL loader, it does nothing.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* IN next_record - ignored
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void WriteNextRecord(const T &next_record UNUSED){}; // do not load
|
||||
|
||||
/*
|
||||
* Routine called when the table has been loaded.
|
||||
* Since this is a NULL loader, it does nothing.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
virtual void FinishLoad(){}; // do nothing
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // #ifndef NULL_LOADER_H
|
||||
171
external/duckdb/third_party/tpce-tool/include/main/NullLoaderFactory.h
vendored
Normal file
171
external/duckdb/third_party/tpce-tool/include/main/NullLoaderFactory.h
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Null loader class factory.
|
||||
* This class instantiates particular table loader classes.
|
||||
*/
|
||||
#ifndef NULL_LOADER_FACTORY_H
|
||||
#define NULL_LOADER_FACTORY_H
|
||||
|
||||
#include "BaseLoader.h"
|
||||
#include "BaseLoaderFactory.h"
|
||||
#include "NullLoader.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CNullLoaderFactory : public CBaseLoaderFactory {
|
||||
|
||||
public:
|
||||
// Functions to create loader classes for individual tables.
|
||||
|
||||
virtual CBaseLoader<ACCOUNT_PERMISSION_ROW> *CreateAccountPermissionLoader() {
|
||||
return new CNullLoader<ACCOUNT_PERMISSION_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<ADDRESS_ROW> *CreateAddressLoader() {
|
||||
return new CNullLoader<ADDRESS_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<BROKER_ROW> *CreateBrokerLoader() {
|
||||
return new CNullLoader<BROKER_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<CASH_TRANSACTION_ROW> *CreateCashTransactionLoader() {
|
||||
return new CNullLoader<CASH_TRANSACTION_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<CHARGE_ROW> *CreateChargeLoader() {
|
||||
return new CNullLoader<CHARGE_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<COMMISSION_RATE_ROW> *CreateCommissionRateLoader() {
|
||||
return new CNullLoader<COMMISSION_RATE_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<COMPANY_COMPETITOR_ROW> *CreateCompanyCompetitorLoader() {
|
||||
return new CNullLoader<COMPANY_COMPETITOR_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<COMPANY_ROW> *CreateCompanyLoader() {
|
||||
return new CNullLoader<COMPANY_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<CUSTOMER_ACCOUNT_ROW> *CreateCustomerAccountLoader() {
|
||||
return new CNullLoader<CUSTOMER_ACCOUNT_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<CUSTOMER_ROW> *CreateCustomerLoader() {
|
||||
return new CNullLoader<CUSTOMER_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<CUSTOMER_TAXRATE_ROW> *CreateCustomerTaxrateLoader() {
|
||||
return new CNullLoader<CUSTOMER_TAXRATE_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<DAILY_MARKET_ROW> *CreateDailyMarketLoader() {
|
||||
return new CNullLoader<DAILY_MARKET_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<EXCHANGE_ROW> *CreateExchangeLoader() {
|
||||
return new CNullLoader<EXCHANGE_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<FINANCIAL_ROW> *CreateFinancialLoader() {
|
||||
return new CNullLoader<FINANCIAL_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<HOLDING_ROW> *CreateHoldingLoader() {
|
||||
return new CNullLoader<HOLDING_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<HOLDING_HISTORY_ROW> *CreateHoldingHistoryLoader() {
|
||||
return new CNullLoader<HOLDING_HISTORY_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<HOLDING_SUMMARY_ROW> *CreateHoldingSummaryLoader() {
|
||||
return new CNullLoader<HOLDING_SUMMARY_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<INDUSTRY_ROW> *CreateIndustryLoader() {
|
||||
return new CNullLoader<INDUSTRY_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<LAST_TRADE_ROW> *CreateLastTradeLoader() {
|
||||
return new CNullLoader<LAST_TRADE_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<NEWS_ITEM_ROW> *CreateNewsItemLoader() {
|
||||
return new CNullLoader<NEWS_ITEM_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<NEWS_XREF_ROW> *CreateNewsXRefLoader() {
|
||||
return new CNullLoader<NEWS_XREF_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<SECTOR_ROW> *CreateSectorLoader() {
|
||||
return new CNullLoader<SECTOR_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<SECURITY_ROW> *CreateSecurityLoader() {
|
||||
return new CNullLoader<SECURITY_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<SETTLEMENT_ROW> *CreateSettlementLoader() {
|
||||
return new CNullLoader<SETTLEMENT_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<STATUS_TYPE_ROW> *CreateStatusTypeLoader() {
|
||||
return new CNullLoader<STATUS_TYPE_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<TAX_RATE_ROW> *CreateTaxRateLoader() {
|
||||
return new CNullLoader<TAX_RATE_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<TRADE_HISTORY_ROW> *CreateTradeHistoryLoader() {
|
||||
return new CNullLoader<TRADE_HISTORY_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<TRADE_ROW> *CreateTradeLoader() {
|
||||
return new CNullLoader<TRADE_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<TRADE_REQUEST_ROW> *CreateTradeRequestLoader() {
|
||||
return new CNullLoader<TRADE_REQUEST_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<TRADE_TYPE_ROW> *CreateTradeTypeLoader() {
|
||||
return new CNullLoader<TRADE_TYPE_ROW>();
|
||||
};
|
||||
virtual CBaseLoader<WATCH_ITEM_ROW> *CreateWatchItemLoader() {
|
||||
return new CNullLoader<WATCH_ITEM_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<WATCH_LIST_ROW> *CreateWatchListLoader() {
|
||||
return new CNullLoader<WATCH_LIST_ROW>();
|
||||
};
|
||||
|
||||
virtual CBaseLoader<ZIP_CODE_ROW> *CreateZipCodeLoader() {
|
||||
return new CNullLoader<ZIP_CODE_ROW>();
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // NULL_LOADER_FACTORY_H
|
||||
127
external/duckdb/third_party/tpce-tool/include/main/Person.h
vendored
Normal file
127
external/duckdb/third_party/tpce-tool/include/main/Person.h
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* CPerson class for the Customer table.
|
||||
*/
|
||||
#ifndef PERSON_H
|
||||
#define PERSON_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "utilities/EGenStandardTypes.h"
|
||||
#include "utilities/Random.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
// Used for generating tax ID strings.
|
||||
const int TaxIDFmt_len = 14;
|
||||
const char TaxIDFmt[TaxIDFmt_len + 1] = "nnnaannnnaannn";
|
||||
|
||||
class CPerson {
|
||||
private:
|
||||
const LastNameDataFile_t &m_LastNames;
|
||||
const MaleFirstNameDataFile_t &m_MaleFirstNames;
|
||||
const FemaleFirstNameDataFile_t &m_FemaleFirstNames;
|
||||
|
||||
CRandom m_rnd;
|
||||
bool m_bCacheEnabled;
|
||||
int m_iCacheSize;
|
||||
TIdent m_iCacheOffset;
|
||||
int *m_FirstNameCache;
|
||||
int *m_LastNameCache;
|
||||
char *m_GenderCache;
|
||||
const int INVALID_NAME_CACHE_ENTRY;
|
||||
const char INVALID_GENDER_CACHE_ENTRY;
|
||||
|
||||
template <class DataFileT> const string &getName(TIdent CID, const DataFileT &df, int *cache, RNGSEED seedBase) {
|
||||
// It is possible (and expected) to get CID values that are oustide the
|
||||
// current load unit. For example, AccountPermission CIDs and Broker IDs
|
||||
// can be outside the current load unit. These "out of bounds" CIDs are
|
||||
// not cached so we need to account for this.
|
||||
TIdent index = CID - m_iCacheOffset;
|
||||
bool bCheckCache = (index >= 0 && index < m_iCacheSize);
|
||||
|
||||
// Use the cache if we can.
|
||||
if (m_bCacheEnabled && bCheckCache && (INVALID_NAME_CACHE_ENTRY != cache[index])) {
|
||||
return df[cache[index]].NAME();
|
||||
}
|
||||
|
||||
// We couldn't use the cache.
|
||||
RNGSEED OldSeed;
|
||||
int iThreshold;
|
||||
|
||||
OldSeed = m_rnd.GetSeed();
|
||||
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(seedBase, (RNGSEED)CID));
|
||||
|
||||
// First, generate the threshold.
|
||||
iThreshold = m_rnd.RndIntRange(0, df.size() - 1);
|
||||
|
||||
// Cache the result if appropriate.
|
||||
if (m_bCacheEnabled && bCheckCache) {
|
||||
cache[index] = iThreshold;
|
||||
}
|
||||
|
||||
// Restore the RNG
|
||||
m_rnd.SetSeed(OldSeed);
|
||||
|
||||
return df[iThreshold].NAME();
|
||||
};
|
||||
|
||||
public:
|
||||
CPerson(const DataFileManager &dfm, TIdent iStartFromCustomer, bool bCacheEnabled = false);
|
||||
|
||||
~CPerson();
|
||||
void InitNextLoadUnit(TIdent iCacheOffsetIncrement = iDefaultLoadUnitSize);
|
||||
|
||||
const string &GetLastName(TIdent CID);
|
||||
const string &GetFirstName(TIdent CID);
|
||||
char GetMiddleName(TIdent CID);
|
||||
char GetGender(TIdent CID); //'M' or 'F'
|
||||
bool IsMaleGender(TIdent CID); // TRUE if male, FALSE if female
|
||||
void GetTaxID(TIdent CID, char *buf);
|
||||
|
||||
// get first name, last name, and tax id
|
||||
void GetFirstLastAndTaxID(TIdent C_ID, char *szFirstName, char *szLastName, char *szTaxID);
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // PERSON_H
|
||||
59
external/duckdb/third_party/tpce-tool/include/main/SectorTable.h
vendored
Normal file
59
external/duckdb/third_party/tpce-tool/include/main/SectorTable.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the Sector table.
|
||||
*/
|
||||
#ifndef SECTOR_TABLE_H
|
||||
#define SECTOR_TABLE_H
|
||||
|
||||
#include "FixedTable.h"
|
||||
#include "input/DataFileTypes.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CSectorTable : public FixedTable<SectorDataFile_t, SECTOR_ROW> {
|
||||
public:
|
||||
CSectorTable(const SectorDataFile_t &dataFile);
|
||||
~CSectorTable();
|
||||
|
||||
virtual void LoadTableRow();
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // SECTOR_TABLE_H
|
||||
51
external/duckdb/third_party/tpce-tool/include/main/SecurityPriceRange.h
vendored
Normal file
51
external/duckdb/third_party/tpce-tool/include/main/SecurityPriceRange.h
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: Minimum and maximum values for a security's price range
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef SECURITY_PRICE_RANGE_H
|
||||
#define SECURITY_PRICE_RANGE_H
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
const double fMinSecPrice = 20.00;
|
||||
const double fMaxSecPrice = 30.00;
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // SECURITY_PRICE_RANGE_H
|
||||
187
external/duckdb/third_party/tpce-tool/include/main/SecurityTable.h
vendored
Normal file
187
external/duckdb/third_party/tpce-tool/include/main/SecurityTable.h
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the securities table.
|
||||
*/
|
||||
#ifndef SECURITY_TABLE_H
|
||||
#define SECURITY_TABLE_H
|
||||
|
||||
#include <stdio.h> // for snprintf which is not part of the C++ headers
|
||||
#include "EGenTables_common.h"
|
||||
#include "SecurityPriceRange.h"
|
||||
|
||||
#include "input/DataFileManager.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
const INT64 iS_NUM_OUTMin = INT64_CONST(4000000);
|
||||
const INT64 iS_NUM_OUTMax = INT64_CONST(9500000000);
|
||||
|
||||
const double fS_PEMin = 1.0;
|
||||
const double fS_PEMax = 120.0;
|
||||
|
||||
const double fS_DIVIDNonZeroMin = 0.01;
|
||||
const double fS_DIVIDMax = 10.0;
|
||||
|
||||
const double fS_YIELDNonZeroMin = 0.01;
|
||||
const double fS_YIELDMax = 120.0;
|
||||
|
||||
const int iWeeksPerYear = 52;
|
||||
const int iDaysPerWeek = 7;
|
||||
|
||||
const int iPercentCompaniesWithNonZeroDividend = 60;
|
||||
|
||||
const int iRNGSkipOneRowSecurity = 11; // number of RNG calls for one row
|
||||
|
||||
class CSecurityTable : public TableTemplate<SECURITY_ROW> {
|
||||
TIdent m_iSecurityCount;
|
||||
TIdent m_iStartFromSecurity;
|
||||
const CCompanyFile &m_CompanyFile;
|
||||
const CSecurityFile &m_SecurityFile;
|
||||
CDateTime m_date;
|
||||
int m_iCurrentDayNo;
|
||||
int m_iJan1_1900DayNo;
|
||||
int m_iJan2_2000DayNo;
|
||||
TIdent m_iSecurityCountForOneLoadUnit;
|
||||
|
||||
/*
|
||||
* SECURITY table row generation
|
||||
*/
|
||||
void GenerateSecurityRow() {
|
||||
int iStartDayNo, iExchangeDayNo, i52HighDayNo, i52LowDayNo;
|
||||
|
||||
strncpy(m_row.S_ST_ID, m_SecurityFile.GetRecord(m_iLastRowNumber).S_ST_ID_CSTR(), sizeof(m_row.S_ST_ID));
|
||||
strncpy(m_row.S_ISSUE, m_SecurityFile.GetRecord(m_iLastRowNumber).S_ISSUE_CSTR(), sizeof(m_row.S_ISSUE));
|
||||
|
||||
CreateName(m_iLastRowNumber, m_row.S_NAME, static_cast<int>(sizeof(m_row.S_NAME)));
|
||||
|
||||
m_SecurityFile.CreateSymbol(m_iLastRowNumber, m_row.S_SYMB, static_cast<int>(sizeof(m_row.S_SYMB)));
|
||||
strncpy(m_row.S_EX_ID, m_SecurityFile.GetRecord(m_iLastRowNumber).S_EX_ID_CSTR(), sizeof(m_row.S_EX_ID));
|
||||
m_row.S_CO_ID = m_SecurityFile.GetCompanyId(m_iLastRowNumber);
|
||||
m_row.S_NUM_OUT = m_rnd.RndInt64Range(iS_NUM_OUTMin, iS_NUM_OUTMax);
|
||||
|
||||
iStartDayNo = m_rnd.RndIntRange(m_iJan1_1900DayNo, m_iJan2_2000DayNo); // generate random date
|
||||
m_row.S_START_DATE.Set(iStartDayNo);
|
||||
iExchangeDayNo = m_rnd.RndIntRange(iStartDayNo, m_iJan2_2000DayNo);
|
||||
m_row.S_EXCH_DATE.Set(iExchangeDayNo);
|
||||
m_row.S_PE = m_rnd.RndDoubleIncrRange(fS_PEMin, fS_PEMax, 0.01);
|
||||
// iExchangeDayNo contains S_EXCH_DATE date in days.
|
||||
|
||||
// 52 week high - selected from upper half of security price range
|
||||
m_row.S_52WK_HIGH =
|
||||
(float)m_rnd.RndDoubleIncrRange(fMinSecPrice + ((fMaxSecPrice - fMinSecPrice) / 2), fMaxSecPrice, 0.01);
|
||||
i52HighDayNo = m_rnd.RndIntRange(m_iCurrentDayNo - iDaysPerWeek * iWeeksPerYear, m_iCurrentDayNo);
|
||||
m_row.S_52WK_HIGH_DATE.Set(i52HighDayNo);
|
||||
|
||||
// 52 week low - selected from the minimum security price up to the 52wk
|
||||
// high
|
||||
m_row.S_52WK_LOW = (float)m_rnd.RndDoubleIncrRange(fMinSecPrice, m_row.S_52WK_HIGH, 0.01);
|
||||
i52LowDayNo = m_rnd.RndIntRange(m_iCurrentDayNo - iDaysPerWeek * iWeeksPerYear, m_iCurrentDayNo);
|
||||
m_row.S_52WK_LOW_DATE.Set(i52LowDayNo);
|
||||
|
||||
if (m_rnd.RndPercent(iPercentCompaniesWithNonZeroDividend)) {
|
||||
m_row.S_YIELD = m_rnd.RndDoubleIncrRange(fS_YIELDNonZeroMin, fS_YIELDMax, 0.01);
|
||||
m_row.S_DIVIDEND = m_rnd.RndDoubleIncrRange((m_row.S_YIELD * 0.20), (m_row.S_YIELD * 0.30), 0.01);
|
||||
} else {
|
||||
m_row.S_DIVIDEND = 0.0;
|
||||
m_row.S_YIELD = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the state for the next load unit.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void InitNextLoadUnit() {
|
||||
m_rnd.SetSeed(m_rnd.RndNthElement(RNGSeedTableDefault, (RNGSEED)m_iLastRowNumber * iRNGSkipOneRowSecurity));
|
||||
|
||||
ClearRecord(); // this is needed for EGenTest to work
|
||||
}
|
||||
|
||||
public:
|
||||
CSecurityTable(const DataFileManager &dfm, TIdent iCustomerCount, TIdent iStartFromCustomer)
|
||||
: TableTemplate<SECURITY_ROW>(), m_CompanyFile(dfm.CompanyFile()), m_SecurityFile(dfm.SecurityFile()) {
|
||||
m_iCurrentDayNo = CDateTime::YMDtoDayno(InitialTradePopulationBaseYear, InitialTradePopulationBaseMonth,
|
||||
InitialTradePopulationBaseDay); // last initial trading date
|
||||
m_iJan1_1900DayNo = CDateTime::YMDtoDayno(1900, 1, 1); // find out number of days for Jan-1-1900
|
||||
m_iJan2_2000DayNo = CDateTime::YMDtoDayno(2000, 1, 2); // find out number of days for Jan-2-2000
|
||||
|
||||
m_iSecurityCount = m_SecurityFile.CalculateSecurityCount(iCustomerCount);
|
||||
m_iStartFromSecurity = m_SecurityFile.CalculateStartFromSecurity(iStartFromCustomer);
|
||||
|
||||
m_iSecurityCountForOneLoadUnit = m_SecurityFile.CalculateSecurityCount(iDefaultLoadUnitSize);
|
||||
|
||||
m_iLastRowNumber = m_iStartFromSecurity;
|
||||
};
|
||||
|
||||
bool GenerateNextRecord() {
|
||||
// Reset RNG at Load Unit boundary, so that all data is repeatable.
|
||||
//
|
||||
if (m_iLastRowNumber % m_iSecurityCountForOneLoadUnit == 0) {
|
||||
InitNextLoadUnit();
|
||||
}
|
||||
|
||||
GenerateSecurityRow();
|
||||
|
||||
++m_iLastRowNumber;
|
||||
|
||||
// Update state info
|
||||
m_bMoreRecords = m_iLastRowNumber < (m_iStartFromSecurity + m_iSecurityCount);
|
||||
|
||||
return (MoreRecords());
|
||||
}
|
||||
|
||||
void CreateName(TIdent iIndex, // row number
|
||||
char *szOutput, // output buffer
|
||||
size_t iOutputLen) // size of the output buffer (including null)
|
||||
{
|
||||
char CompanyName[cCO_NAME_len + 1];
|
||||
|
||||
m_CompanyFile.CreateName(m_SecurityFile.GetCompanyIndex(iIndex), CompanyName,
|
||||
static_cast<int>(sizeof(CompanyName)));
|
||||
snprintf(szOutput, iOutputLen, "%s of %s", m_SecurityFile.GetRecord(iIndex).S_ISSUE_CSTR(), CompanyName);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // SECURITY_TABLE_H
|
||||
58
external/duckdb/third_party/tpce-tool/include/main/StatusTypeIDs.h
vendored
Normal file
58
external/duckdb/third_party/tpce-tool/include/main/StatusTypeIDs.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
#ifndef STATUS_TYPE_IDS_H
|
||||
#define STATUS_TYPE_IDS_H
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
// Status Type IDs corresponding to the StatusType.txt flat file.
|
||||
// Note: The order of enumeration members must match the order
|
||||
// of rows in the StatusType.txt flat file.
|
||||
enum eStatusTypeID {
|
||||
eCompleted = 0,
|
||||
eActive,
|
||||
eSubmitted,
|
||||
ePending,
|
||||
eCanceled,
|
||||
|
||||
eMaxStatusTypeID // should be the last - contains the number of items in the
|
||||
// enumeration
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // STATUS_TYPE_IDS_H
|
||||
59
external/duckdb/third_party/tpce-tool/include/main/StatusTypeTable.h
vendored
Normal file
59
external/duckdb/third_party/tpce-tool/include/main/StatusTypeTable.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the StatusType table.
|
||||
*/
|
||||
#ifndef STATUS_TYPE_H
|
||||
#define STATUS_TYPE_H
|
||||
|
||||
#include "FixedTable.h"
|
||||
#include "input/DataFileTypes.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class CStatusTypeTable : public FixedTable<StatusTypeDataFile_t, STATUS_TYPE_ROW> {
|
||||
public:
|
||||
CStatusTypeTable(const StatusTypeDataFile_t &dataFile);
|
||||
~CStatusTypeTable();
|
||||
|
||||
virtual void LoadTableRow();
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // STATUS_TYPE_H
|
||||
381
external/duckdb/third_party/tpce-tool/include/main/TableRows.h
vendored
Normal file
381
external/duckdb/third_party/tpce-tool/include/main/TableRows.h
vendored
Normal file
@@ -0,0 +1,381 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy, Doug Johnson, Larry Loen
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: Simple behaviorless structs representing a row in a table.
|
||||
* These are what is emitted by EGen to database loaders.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TABLE_ROWS_H
|
||||
#define TABLE_ROWS_H
|
||||
|
||||
#include "utilities/EGenStandardTypes.h"
|
||||
#include "utilities/TableConsts.h"
|
||||
#include "utilities/DateTime.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
// ACCOUNT_PERMISSION table
|
||||
typedef struct ACCOUNT_PERMISSION_ROW {
|
||||
TIdent AP_CA_ID;
|
||||
char AP_ACL[cACL_len + 1]; // binary column in the table
|
||||
char AP_TAX_ID[cTAX_ID_len + 1];
|
||||
char AP_L_NAME[cL_NAME_len + 1];
|
||||
char AP_F_NAME[cF_NAME_len + 1];
|
||||
} * PACCOUNT_PERMISSION_ROW;
|
||||
|
||||
// ADDRESS table
|
||||
typedef struct ADDRESS_ROW {
|
||||
TIdent AD_ID;
|
||||
char AD_LINE1[cAD_LINE_len + 1];
|
||||
char AD_LINE2[cAD_LINE_len + 1];
|
||||
char AD_ZC_CODE[cAD_ZIP_len + 1];
|
||||
char AD_CTRY[cAD_CTRY_len + 1];
|
||||
} * PADDRESS_ROW;
|
||||
|
||||
// BROKER table
|
||||
typedef struct BROKER_ROW {
|
||||
TIdent B_ID;
|
||||
char B_ST_ID[cST_ID_len + 1];
|
||||
char B_NAME[cB_NAME_len + 1];
|
||||
int B_NUM_TRADES;
|
||||
double B_COMM_TOTAL;
|
||||
} * PBROKER_ROW;
|
||||
|
||||
// CASH_TRANSACTION table
|
||||
typedef struct CASH_TRANSACTION_ROW {
|
||||
TTrade CT_T_ID;
|
||||
CDateTime CT_DTS;
|
||||
double CT_AMT;
|
||||
char CT_NAME[cCT_NAME_len + 1];
|
||||
} * PCASH_TRANSACTION_ROW;
|
||||
|
||||
// CHARGE table
|
||||
typedef struct CHARGE_ROW {
|
||||
char CH_TT_ID[cTT_ID_len + 1];
|
||||
int CH_C_TIER;
|
||||
double CH_CHRG;
|
||||
} * PCHARGE_ROW;
|
||||
|
||||
// COMMISSION_RATE table
|
||||
typedef struct COMMISSION_RATE_ROW {
|
||||
int CR_C_TIER;
|
||||
char CR_TT_ID[cTT_ID_len + 1];
|
||||
char CR_EX_ID[cEX_ID_len + 1];
|
||||
int CR_FROM_QTY;
|
||||
int CR_TO_QTY;
|
||||
double CR_RATE;
|
||||
} * PCOMMISSION_RATE_ROW;
|
||||
|
||||
// COMPANY table
|
||||
typedef struct COMPANY_ROW {
|
||||
TIdent CO_ID;
|
||||
char CO_ST_ID[cST_ID_len + 1];
|
||||
char CO_NAME[cCO_NAME_len + 1];
|
||||
char CO_IN_ID[cIN_ID_len + 1];
|
||||
char CO_SP_RATE[cSP_RATE_len + 1];
|
||||
char CO_CEO[cCEO_NAME_len + 1];
|
||||
TIdent CO_AD_ID;
|
||||
char CO_DESC[cCO_DESC_len + 1];
|
||||
CDateTime CO_OPEN_DATE;
|
||||
} * PCOMPANY_ROW;
|
||||
|
||||
// COMPANY_COMPETITOR table
|
||||
typedef struct COMPANY_COMPETITOR_ROW {
|
||||
TIdent CP_CO_ID;
|
||||
TIdent CP_COMP_CO_ID;
|
||||
char CP_IN_ID[cIN_ID_len + 1];
|
||||
} * PCOMPANY_COMPETITOR_ROW;
|
||||
|
||||
// CUSTOMER table
|
||||
typedef struct CUSTOMER_ROW {
|
||||
TIdent C_ID;
|
||||
char C_TAX_ID[cTAX_ID_len + 1];
|
||||
char C_ST_ID[cST_ID_len + 1];
|
||||
char C_L_NAME[cL_NAME_len + 1];
|
||||
char C_F_NAME[cF_NAME_len + 1];
|
||||
char C_M_NAME[cM_NAME_len + 1];
|
||||
char C_GNDR;
|
||||
char C_TIER;
|
||||
CDateTime C_DOB;
|
||||
TIdent C_AD_ID;
|
||||
char C_CTRY_1[cCTRY_len + 1];
|
||||
char C_AREA_1[cAREA_len + 1];
|
||||
char C_LOCAL_1[cLOCAL_len + 1];
|
||||
char C_EXT_1[cEXT_len + 1];
|
||||
char C_CTRY_2[cCTRY_len + 1];
|
||||
char C_AREA_2[cAREA_len + 1];
|
||||
char C_LOCAL_2[cLOCAL_len + 1];
|
||||
char C_EXT_2[cEXT_len + 1];
|
||||
char C_CTRY_3[cCTRY_len + 1];
|
||||
char C_AREA_3[cAREA_len + 1];
|
||||
char C_LOCAL_3[cLOCAL_len + 1];
|
||||
char C_EXT_3[cEXT_len + 1];
|
||||
char C_EMAIL_1[cEMAIL_len + 1];
|
||||
char C_EMAIL_2[cEMAIL_len + 1];
|
||||
|
||||
CUSTOMER_ROW() : C_ID(0){};
|
||||
|
||||
} * PCUSTOMER_ROW;
|
||||
|
||||
// CUSTOMER_ACCOUNT table
|
||||
typedef struct CUSTOMER_ACCOUNT_ROW {
|
||||
TIdent CA_ID;
|
||||
TIdent CA_B_ID;
|
||||
TIdent CA_C_ID;
|
||||
char CA_NAME[cCA_NAME_len + 1];
|
||||
char CA_TAX_ST;
|
||||
double CA_BAL;
|
||||
} * PCUSTOMER_ACCOUNT_ROW;
|
||||
|
||||
// CUSTOMER_TAXRATE table
|
||||
typedef struct CUSTOMER_TAXRATE_ROW {
|
||||
char CX_TX_ID[cTX_ID_len + 1];
|
||||
TIdent CX_C_ID;
|
||||
} * PCUSTOMER_TAXRATE_ROW;
|
||||
|
||||
// DAILY_MARKET table
|
||||
typedef struct DAILY_MARKET_ROW {
|
||||
CDateTime DM_DATE;
|
||||
char DM_S_SYMB[cSYMBOL_len + 1];
|
||||
double DM_CLOSE;
|
||||
double DM_HIGH;
|
||||
double DM_LOW;
|
||||
INT64 DM_VOL;
|
||||
} * PDAILY_MARKET_ROW;
|
||||
|
||||
// EXCHANGE table
|
||||
typedef struct EXCHANGE_ROW {
|
||||
char EX_ID[cEX_ID_len + 1];
|
||||
char EX_NAME[cEX_NAME_len + 1];
|
||||
int EX_NUM_SYMB;
|
||||
int EX_OPEN;
|
||||
int EX_CLOSE;
|
||||
char EX_DESC[cEX_DESC_len + 1];
|
||||
TIdent EX_AD_ID;
|
||||
} * PEXCHANGE_ROW;
|
||||
|
||||
// FINANCIAL table
|
||||
typedef struct FINANCIAL_ROW {
|
||||
TIdent FI_CO_ID;
|
||||
int FI_YEAR;
|
||||
int FI_QTR;
|
||||
CDateTime FI_QTR_START_DATE;
|
||||
double FI_REVENUE;
|
||||
double FI_NET_EARN;
|
||||
double FI_BASIC_EPS;
|
||||
double FI_DILUT_EPS;
|
||||
double FI_MARGIN;
|
||||
double FI_INVENTORY;
|
||||
double FI_ASSETS;
|
||||
double FI_LIABILITY;
|
||||
INT64 FI_OUT_BASIC;
|
||||
INT64 FI_OUT_DILUT;
|
||||
} * PFINANCIAL_ROW;
|
||||
|
||||
// HOLDING table
|
||||
typedef struct HOLDING_ROW {
|
||||
TTrade H_T_ID;
|
||||
TIdent H_CA_ID;
|
||||
char H_S_SYMB[cSYMBOL_len + 1];
|
||||
CDateTime H_DTS;
|
||||
double H_PRICE;
|
||||
int H_QTY;
|
||||
} * PHOLDING_ROW;
|
||||
|
||||
// HOLDING_HISTORY table
|
||||
typedef struct HOLDING_HISTORY_ROW {
|
||||
TTrade HH_H_T_ID;
|
||||
TTrade HH_T_ID;
|
||||
int HH_BEFORE_QTY;
|
||||
int HH_AFTER_QTY;
|
||||
} * PHOLDING_HISTORY_ROW;
|
||||
|
||||
// HOLDING_SUMMARY table
|
||||
typedef struct HOLDING_SUMMARY_ROW {
|
||||
TIdent HS_CA_ID;
|
||||
char HS_S_SYMB[cSYMBOL_len + 1];
|
||||
int HS_QTY;
|
||||
} * PHOLDING_SUMMARY_ROW;
|
||||
|
||||
// INDUSTRY table
|
||||
typedef struct INDUSTRY_ROW {
|
||||
char IN_ID[cIN_ID_len + 1];
|
||||
char IN_NAME[cIN_NAME_len + 1];
|
||||
char IN_SC_ID[cSC_ID_len + 1];
|
||||
} * PINDUSTRY_ROW;
|
||||
|
||||
// LAST_TRADE table
|
||||
typedef struct LAST_TRADE_ROW {
|
||||
char LT_S_SYMB[cSYMBOL_len + 1];
|
||||
CDateTime LT_DTS;
|
||||
double LT_PRICE;
|
||||
double LT_OPEN_PRICE;
|
||||
INT64 LT_VOL;
|
||||
} * PLAST_TRADE_ROW;
|
||||
|
||||
// NEWS_ITEM table
|
||||
typedef struct NEWS_ITEM_ROW {
|
||||
TIdent NI_ID;
|
||||
char NI_HEADLINE[cNI_HEADLINE_len + 1];
|
||||
char NI_SUMMARY[cNI_SUMMARY_len + 1];
|
||||
char NI_ITEM[cNI_ITEM_len + 1];
|
||||
CDateTime NI_DTS;
|
||||
char NI_SOURCE[cNI_SOURCE_len + 1];
|
||||
char NI_AUTHOR[cNI_AUTHOR_len + 1];
|
||||
} * PNEWS_ITEM_ROW;
|
||||
|
||||
// NEWS_XREF table
|
||||
typedef struct NEWS_XREF_ROW {
|
||||
TIdent NX_NI_ID;
|
||||
TIdent NX_CO_ID;
|
||||
} * PNEWS_XREF_ROW;
|
||||
|
||||
// SECTOR table
|
||||
typedef struct SECTOR_ROW {
|
||||
char SC_ID[cSC_ID_len + 1];
|
||||
char SC_NAME[cSC_NAME_len + 1];
|
||||
} * PSECTOR_ROW;
|
||||
|
||||
// SECURITY table
|
||||
typedef struct SECURITY_ROW {
|
||||
char S_SYMB[cSYMBOL_len + 1];
|
||||
char S_ISSUE[cS_ISSUE_len + 1];
|
||||
char S_ST_ID[cST_ID_len + 1];
|
||||
char S_NAME[cS_NAME_len + 1];
|
||||
char S_EX_ID[cEX_ID_len + 1];
|
||||
TIdent S_CO_ID;
|
||||
INT64 S_NUM_OUT;
|
||||
CDateTime S_START_DATE;
|
||||
CDateTime S_EXCH_DATE;
|
||||
double S_PE;
|
||||
float S_52WK_HIGH;
|
||||
CDateTime S_52WK_HIGH_DATE;
|
||||
float S_52WK_LOW;
|
||||
CDateTime S_52WK_LOW_DATE;
|
||||
double S_DIVIDEND;
|
||||
double S_YIELD;
|
||||
} * PSECURITY_ROW;
|
||||
|
||||
// SETTLEMENT table
|
||||
typedef struct SETTLEMENT_ROW {
|
||||
TTrade SE_T_ID;
|
||||
char SE_CASH_TYPE[cSE_CASH_TYPE_len + 1];
|
||||
CDateTime SE_CASH_DUE_DATE;
|
||||
double SE_AMT;
|
||||
} * PSETTLEMENT_ROW;
|
||||
|
||||
// STATUS_TYPE table
|
||||
typedef struct STATUS_TYPE_ROW {
|
||||
char ST_ID[cST_ID_len + 1];
|
||||
char ST_NAME[cST_NAME_len + 1];
|
||||
} * PSTATUS_TYPE_ROW;
|
||||
|
||||
// TAXRATE table
|
||||
typedef struct TAX_RATE_ROW {
|
||||
char TX_ID[cTX_ID_len + 1];
|
||||
char TX_NAME[cTX_NAME_len + 1];
|
||||
double TX_RATE;
|
||||
} * PTAX_RATE_ROW;
|
||||
|
||||
// TRADE table
|
||||
typedef struct TRADE_ROW {
|
||||
TTrade T_ID;
|
||||
CDateTime T_DTS;
|
||||
char T_ST_ID[cST_ID_len + 1];
|
||||
char T_TT_ID[cTT_ID_len + 1];
|
||||
bool T_IS_CASH;
|
||||
char T_S_SYMB[cSYMBOL_len + 1];
|
||||
int T_QTY;
|
||||
double T_BID_PRICE;
|
||||
TIdent T_CA_ID;
|
||||
char T_EXEC_NAME[cEXEC_NAME_len + 1];
|
||||
double T_TRADE_PRICE;
|
||||
double T_CHRG;
|
||||
double T_COMM;
|
||||
double T_TAX;
|
||||
bool T_LIFO;
|
||||
} * PTRADE_ROW;
|
||||
|
||||
// TRADE_HISTORY table
|
||||
typedef struct TRADE_HISTORY_ROW {
|
||||
TTrade TH_T_ID;
|
||||
CDateTime TH_DTS;
|
||||
char TH_ST_ID[cST_ID_len + 1];
|
||||
} * PTRADE_HISTORY_ROW;
|
||||
|
||||
// TRADE_REQUEST table
|
||||
typedef struct TRADE_REQUEST_ROW {
|
||||
TTrade TR_T_ID;
|
||||
char TR_TT_ID[cTT_ID_len + 1];
|
||||
char TR_S_SYMB[cSYMBOL_len + 1];
|
||||
int TR_QTY;
|
||||
double TR_BID_PRICE;
|
||||
TIdent TR_B_ID;
|
||||
} * PTRADE_REQUEST_ROW;
|
||||
|
||||
// TRADE_TYPE table
|
||||
typedef struct TRADE_TYPE_ROW {
|
||||
char TT_ID[cTT_ID_len + 1];
|
||||
char TT_NAME[cTT_NAME_len + 1];
|
||||
bool TT_IS_SELL;
|
||||
bool TT_IS_MRKT;
|
||||
} * PTRADE_TYPE_ROW;
|
||||
|
||||
// WATCH_ITEM table
|
||||
typedef struct WATCH_ITEM_ROW {
|
||||
TIdent WI_WL_ID;
|
||||
char WI_S_SYMB[cSYMBOL_len + 1];
|
||||
} * PWATCH_ITEM_ROW;
|
||||
|
||||
// WATCH_LIST table
|
||||
typedef struct WATCH_LIST_ROW {
|
||||
TIdent WL_ID;
|
||||
TIdent WL_C_ID;
|
||||
} * PWATCH_LIST_ROW;
|
||||
|
||||
// ZIP_CODE table
|
||||
typedef struct ZIP_CODE_ROW {
|
||||
char ZC_CODE[cZC_CODE_len + 1];
|
||||
char ZC_TOWN[cZC_TOWN_len + 1];
|
||||
char ZC_DIV[cZC_DIV_len + 1];
|
||||
} * PZIP_CODE_ROW;
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // #ifndef TABLE_ROWS_H
|
||||
152
external/duckdb/third_party/tpce-tool/include/main/TableTemplate.h
vendored
Normal file
152
external/duckdb/third_party/tpce-tool/include/main/TableTemplate.h
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
*/
|
||||
|
||||
/*
|
||||
* This template represents a general table class.
|
||||
* The type specified is the type of the table row.
|
||||
*/
|
||||
#ifndef TABLE_TEMPLATE_H
|
||||
#define TABLE_TEMPLATE_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "utilities/EGenStandardTypes.h"
|
||||
#include "utilities/Random.h"
|
||||
#include "utilities/RNGSeeds.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
template <typename T> class TableTemplate {
|
||||
protected:
|
||||
T m_row; // private row for generation
|
||||
TIdent m_iLastRowNumber; // sequential last row number
|
||||
bool m_bMoreRecords; // true if more records can be generated, otherwise
|
||||
// false
|
||||
CRandom m_rnd; // random generator - present in all tables
|
||||
public:
|
||||
/*
|
||||
* The Constructor - just initializes member variables.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* not applicable.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
TableTemplate()
|
||||
: m_iLastRowNumber(0), m_bMoreRecords(false) // assume
|
||||
{
|
||||
ClearRecord(); // zero the row
|
||||
|
||||
m_rnd.SetSeed(RNGSeedTableDefault);
|
||||
}
|
||||
|
||||
/*
|
||||
* Virtual destructor. Provided so that a sponsor-specific
|
||||
* destructor can be called on destruction from the base-class pointer.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* not applicable.
|
||||
*/
|
||||
virtual ~TableTemplate(){};
|
||||
|
||||
/*
|
||||
* Generate the next record (row).
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* true - if more records are available in the table.
|
||||
* false - if no more records can be generated.
|
||||
*/
|
||||
virtual bool GenerateNextRecord() = 0; // abstract class
|
||||
|
||||
/*
|
||||
* Return whether all records in this table have been generated.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* true - if more records are available in the table.
|
||||
* false - if no more records can be generated.
|
||||
*/
|
||||
bool MoreRecords() {
|
||||
return m_bMoreRecords;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a reference to the data row.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* typed reference to internal row buffer.
|
||||
*/
|
||||
// T const * GetRow() { return &m_row; }
|
||||
const T &GetRow() {
|
||||
return m_row;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the internal record buffer to zero.
|
||||
*
|
||||
* This routine allows bitwise comparison between two versions of a row,
|
||||
* because it clears the unused bytes in string values
|
||||
* (past the NULL terminators).
|
||||
*
|
||||
* Note: the record cannot contain any inter-record state information,
|
||||
* or this information will be lost.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* none.
|
||||
*
|
||||
* RETURNS:
|
||||
* none.
|
||||
*/
|
||||
void ClearRecord() {
|
||||
memset(&m_row, 0, sizeof(m_row));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // TABLE_TEMPLATE_H
|
||||
70
external/duckdb/third_party/tpce-tool/include/main/TableTypes.h
vendored
Normal file
70
external/duckdb/third_party/tpce-tool/include/main/TableTypes.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef TABLE_TYPES_H
|
||||
#define TABLE_TYPES_H
|
||||
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
#include "input/DataFileTypes.h"
|
||||
#include "input/ITaxRateFileRecord.h"
|
||||
#include "input/TaxRateFile.h"
|
||||
#include "FixedTable.h"
|
||||
|
||||
namespace TPCE {
|
||||
// Fixed tables - data file records and table records are the same.
|
||||
//
|
||||
typedef ChargeDataFileRecord ChargeTableRecord_t;
|
||||
typedef FixedTable<ChargeDataFile_t, ChargeTableRecord_t> ChargeTable_t;
|
||||
|
||||
typedef CommissionRateDataFileRecord CommissionRateTableRecord_t;
|
||||
typedef FixedTable<CommissionRateDataFile_t, CommissionRateTableRecord_t> CommissionRateTable_t;
|
||||
|
||||
typedef IndustryDataFileRecord IndustryTableRecord_t;
|
||||
typedef FixedTable<IndustryDataFile_t, IndustryTableRecord_t> IndustryTable_t;
|
||||
|
||||
typedef SectorDataFileRecord SectorTableRecord_t;
|
||||
typedef FixedTable<SectorDataFile_t, SectorTableRecord_t> SectorTable_t;
|
||||
|
||||
typedef StatusTypeDataFileRecord StatusTypeTableRecord_t;
|
||||
typedef FixedTable<StatusTypeDataFile_t, StatusTypeTableRecord_t> StatusTypeTable_t;
|
||||
|
||||
typedef TradeTypeDataFileRecord TradeTypeTableRecord_t;
|
||||
typedef FixedTable<TradeTypeDataFile_t, TradeTypeTableRecord_t> TradeTypeTable_t;
|
||||
|
||||
typedef ITaxRateFileRecord TaxRateTableRecord_t;
|
||||
typedef FixedTable<CTaxRateFile, TaxRateTableRecord_t> TaxRateTable_t;
|
||||
|
||||
} // namespace TPCE
|
||||
#endif // TABLE_TYPES_H
|
||||
60
external/duckdb/third_party/tpce-tool/include/main/TaxRateTable.h
vendored
Normal file
60
external/duckdb/third_party/tpce-tool/include/main/TaxRateTable.h
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Sergey Vasilevskiy
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class representing the TaxRate table.
|
||||
*/
|
||||
#ifndef TAX_RATE_TABLE_H
|
||||
#define TAX_RATE_TABLE_H
|
||||
|
||||
#include "FixedTable.h"
|
||||
#include "input/TaxRateFile.h"
|
||||
#include "TableRows.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
class TaxRateTable : public FixedTable<CTaxRateFile, TAX_RATE_ROW> {
|
||||
public:
|
||||
TaxRateTable(const CTaxRateFile &dataFile);
|
||||
~TaxRateTable();
|
||||
|
||||
virtual void LoadTableRow();
|
||||
};
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // TAX_RATE_TABLE_H
|
||||
188
external/duckdb/third_party/tpce-tool/include/main/TimerWheel.h
vendored
Normal file
188
external/duckdb/third_party/tpce-tool/include/main/TimerWheel.h
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Legal Notice
|
||||
*
|
||||
* This document and associated source code (the "Work") is a part of a
|
||||
* benchmark specification maintained by the TPC.
|
||||
*
|
||||
* The TPC reserves all right, title, and interest to the Work as provided
|
||||
* under U.S. and international laws, including without limitation all patent
|
||||
* and trademark rights therein.
|
||||
*
|
||||
* No Warranty
|
||||
*
|
||||
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
|
||||
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
|
||||
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
|
||||
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
|
||||
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
|
||||
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
|
||||
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
|
||||
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
|
||||
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
|
||||
* WITH REGARD TO THE WORK.
|
||||
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
|
||||
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
|
||||
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
|
||||
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
|
||||
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
|
||||
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
|
||||
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
|
||||
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* Contributors
|
||||
* - Doug Johnson
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Description: Template for a Timer Wheel. This allows for efficient
|
||||
* handling of timers that have a known maximum period.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TIMER_WHEEL_H
|
||||
#define TIMER_WHEEL_H
|
||||
|
||||
#include "utilities/EGenUtilities_stdafx.h"
|
||||
#include "utilities/MiscConsts.h"
|
||||
#include "Wheel.h"
|
||||
#include "WheelTime.h"
|
||||
#include "TimerWheelTimer.h"
|
||||
|
||||
namespace TPCE {
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution> class CTimerWheel {
|
||||
|
||||
private:
|
||||
CDateTime m_BaseTime;
|
||||
|
||||
CWheelTime m_LastTime;
|
||||
CWheelTime m_CurrentTime;
|
||||
CWheelTime m_NextTime;
|
||||
|
||||
TWheelConfig m_WheelConfig;
|
||||
|
||||
list<CTimerWheelTimer<T, T2> *> m_TimerWheel[(Period * (MsPerSecond / Resolution))];
|
||||
|
||||
INT32 m_NumberOfTimers;
|
||||
|
||||
INT32 ExpiryProcessing(void);
|
||||
void ProcessTimerList(list<CTimerWheelTimer<T, T2> *> *pList);
|
||||
INT32 SetNextTime(void);
|
||||
|
||||
public:
|
||||
static const INT32 NO_OUTSTANDING_TIMERS = -1;
|
||||
|
||||
CTimerWheel();
|
||||
~CTimerWheel(void);
|
||||
|
||||
bool Empty(void);
|
||||
INT32 ProcessExpiredTimers(void);
|
||||
INT32 StartTimer(double Offset, T2 *pExpiryObject, void (T2::*pExpiryFunction)(T *), T *pExpiryData);
|
||||
|
||||
}; // class CTimerWheel
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution>
|
||||
CTimerWheel<T, T2, Period, Resolution>::CTimerWheel()
|
||||
: m_BaseTime(), m_LastTime(&m_WheelConfig, 0, 0), m_CurrentTime(&m_WheelConfig, 0, 0),
|
||||
m_NextTime(&m_WheelConfig, MaxWheelCycles, (Period * (MsPerSecond / Resolution)) - 1),
|
||||
m_WheelConfig((Period * (MsPerSecond / Resolution)), Resolution), m_NumberOfTimers(0) {
|
||||
m_BaseTime.Set();
|
||||
}
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution>
|
||||
CTimerWheel<T, T2, Period, Resolution>::~CTimerWheel(void) {
|
||||
typename list<CTimerWheelTimer<T, T2> *>::iterator ExpiredTimer;
|
||||
|
||||
for (INT32 ii = 0; ii < (Period * (MsPerSecond / Resolution)); ii++) {
|
||||
if (!m_TimerWheel[ii].empty()) {
|
||||
ExpiredTimer = m_TimerWheel[ii].begin();
|
||||
while (ExpiredTimer != m_TimerWheel[ii].end()) {
|
||||
delete *ExpiredTimer;
|
||||
m_NumberOfTimers--;
|
||||
ExpiredTimer++;
|
||||
}
|
||||
m_TimerWheel[ii].clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution> bool CTimerWheel<T, T2, Period, Resolution>::Empty(void) {
|
||||
return (m_NumberOfTimers == 0 ? true : false);
|
||||
}
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution>
|
||||
INT32 CTimerWheel<T, T2, Period, Resolution>::StartTimer(double Offset, T2 *pExpiryObject,
|
||||
void (T2::*pExpiryFunction)(T *), T *pExpiryData) {
|
||||
CDateTime Now;
|
||||
CWheelTime RequestedTime(&m_WheelConfig, m_BaseTime, Now, (INT32)(Offset * (MsPerSecond / Resolution)));
|
||||
CTimerWheelTimer<T, T2> *pNewTimer = new CTimerWheelTimer<T, T2>(pExpiryObject, pExpiryFunction, pExpiryData);
|
||||
|
||||
// Update current wheel position
|
||||
m_CurrentTime.Set(m_BaseTime, Now);
|
||||
|
||||
// Since the current time has been updated, we should make sure
|
||||
// any outstanding timers have been processed before proceeding.
|
||||
ExpiryProcessing();
|
||||
|
||||
m_TimerWheel[RequestedTime.Index()].push_back(pNewTimer);
|
||||
m_NumberOfTimers++;
|
||||
|
||||
if (RequestedTime < m_NextTime) {
|
||||
m_NextTime = RequestedTime;
|
||||
}
|
||||
|
||||
return (m_NextTime.Offset(m_CurrentTime));
|
||||
}
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution>
|
||||
INT32 CTimerWheel<T, T2, Period, Resolution>::ProcessExpiredTimers(void) {
|
||||
CDateTime Now;
|
||||
|
||||
// Update current wheel position
|
||||
m_CurrentTime.Set(m_BaseTime, Now);
|
||||
|
||||
return (ExpiryProcessing());
|
||||
}
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution>
|
||||
INT32 CTimerWheel<T, T2, Period, Resolution>::ExpiryProcessing(void) {
|
||||
while (m_LastTime < m_CurrentTime) {
|
||||
m_LastTime++;
|
||||
if (!m_TimerWheel[m_LastTime.Index()].empty()) {
|
||||
ProcessTimerList(&m_TimerWheel[m_LastTime.Index()]);
|
||||
}
|
||||
}
|
||||
return (SetNextTime());
|
||||
}
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution>
|
||||
void CTimerWheel<T, T2, Period, Resolution>::ProcessTimerList(list<CTimerWheelTimer<T, T2> *> *pList) {
|
||||
typename list<CTimerWheelTimer<T, T2> *>::iterator ExpiredTimer;
|
||||
|
||||
ExpiredTimer = pList->begin();
|
||||
while (ExpiredTimer != pList->end()) {
|
||||
(((*ExpiredTimer)->m_pExpiryObject)->*((*ExpiredTimer)->m_pExpiryFunction))((*ExpiredTimer)->m_pExpiryData);
|
||||
delete *ExpiredTimer;
|
||||
m_NumberOfTimers--;
|
||||
ExpiredTimer++;
|
||||
}
|
||||
pList->clear();
|
||||
}
|
||||
|
||||
template <class T, class T2, INT32 Period, INT32 Resolution>
|
||||
INT32 CTimerWheel<T, T2, Period, Resolution>::SetNextTime(void) {
|
||||
if (0 == m_NumberOfTimers) {
|
||||
m_NextTime.Set(MaxWheelCycles, (Period * (MsPerSecond / Resolution)) - 1);
|
||||
return (NO_OUTSTANDING_TIMERS);
|
||||
} else {
|
||||
m_NextTime = m_CurrentTime;
|
||||
while (m_TimerWheel[m_NextTime.Index()].empty()) {
|
||||
m_NextTime++;
|
||||
}
|
||||
return (m_NextTime.Offset(m_CurrentTime));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace TPCE
|
||||
|
||||
#endif // TIMER_WHEEL_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user