├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE.md ├── README.md ├── SECURITY.md ├── SUPPORT.md ├── azure-pipelines.yml ├── code ├── .gitignore ├── TPC_DS_EULA.txt ├── specification │ ├── specification.docx │ └── specification.pdf ├── tests │ ├── Test_Document.txt │ ├── bug24.sh │ ├── bug546.sh │ ├── build_tools.sh │ ├── catv_up.sql │ ├── ccv_up.sql │ ├── chunked_data.sh │ ├── cleanUp.sh │ ├── cr_cc_join.sh │ ├── custv_up.sql │ ├── db2_setup.sh │ ├── dm_c.sql │ ├── dm_c_t.sql │ ├── dm_ca.sql │ ├── dm_ca_t.sql │ ├── dm_ca_v.sql │ ├── dm_cc.sql │ ├── dm_cc_s.sql │ ├── dm_cc_t.sql │ ├── dm_cp.sql │ ├── dm_cp_t.sql │ ├── dm_i.sql │ ├── dm_i_s.sql │ ├── dm_i_t.sql │ ├── dm_p.sql │ ├── dm_p_t.sql │ ├── dm_s.sql │ ├── dm_s_s.sql │ ├── dm_s_t.sql │ ├── dm_w.sql │ ├── dm_w_t.sql │ ├── dm_wp.sql │ ├── dm_wp_s.sql │ ├── dm_wp_t.sql │ ├── dm_ws.sql │ ├── dm_ws_s.sql │ ├── dm_ws_t.sql │ ├── emptyTest.sh │ ├── fail.sh │ ├── gen_base_data.sh │ ├── gen_update_data.sh │ ├── itemv_up.sql │ ├── iv_up.sql │ ├── lf_cr.sql │ ├── lf_cr_t.sql │ ├── lf_cs.sql │ ├── lf_cs_t.sql │ ├── lf_sr.sql │ ├── lf_sr_t.sql │ ├── lf_ss.sql │ ├── lf_ss_t.sql │ ├── lf_wr.sql │ ├── lf_wr_t.sql │ ├── lf_ws.sql │ ├── lf_ws_t.sql │ ├── load_base_data.sh │ ├── mysql_setup.sh │ ├── promv_up.sql │ ├── ri.sh │ ├── ri_base_data.sh │ ├── rowcount_base_data.sh │ ├── sparseKeys.sh │ ├── storv_up.sql │ ├── table_option.sh │ ├── test_list.sh │ ├── websv_up.sql │ ├── webv_up.sql │ └── wrhsv_up.sql └── tools │ ├── Cygwin Tools.props │ ├── Cygwin Tools.targets │ ├── HISTORY │ ├── How_To_Guide-DS-V2.0.0.docx │ ├── How_To_Guide.doc │ ├── Makefile.suite │ ├── PORTING.NOTES │ ├── QGEN.doc │ ├── QgenMain.c │ ├── README │ ├── README_grammar.txt │ ├── ReleaseNotes.txt │ ├── StringBuffer.c │ ├── StringBuffer.h │ ├── address.c │ ├── address.h │ ├── ansi.tpl │ ├── build_support.c │ ├── build_support.h │ ├── calendar.dst │ ├── call_center.dat │ ├── checksum.c │ ├── checksum.vcproj │ ├── checksum.vcxproj │ ├── checksum.vcxproj.filters │ ├── cities.dst │ ├── column_list.txt │ ├── columns.h │ ├── config.h │ ├── constants.h │ ├── date.c │ ├── date.h │ ├── db2.tpl │ ├── dbgen2.bsc │ ├── dbgen2.sln │ ├── dbgen2.vcproj │ ├── dbgen2.vcxproj │ ├── dbgen2.vcxproj.filters │ ├── dbgen_version.c │ ├── dbgen_version.h │ ├── dcgram.c │ ├── dcgram.h │ ├── dcomp.c │ ├── dcomp.h │ ├── dcomp_params.h │ ├── decimal.c │ ├── decimal.h │ ├── dist.c │ ├── dist.h │ ├── distcomp.vcproj │ ├── distcomp.vcxproj │ ├── distcomp.vcxproj.filters │ ├── driver.c │ ├── driver.h │ ├── english.dst │ ├── error_msg.c │ ├── error_msg.h │ ├── eval.c │ ├── eval.h │ ├── expr.c │ ├── expr.h │ ├── fips.dst │ ├── genrand.c │ ├── genrand.h │ ├── grammar.c │ ├── grammar.h │ ├── grammar.vcproj │ ├── grammar.vcxproj │ ├── grammar.vcxproj.filters │ ├── grammar_support.c │ ├── grammar_support.h │ ├── items.dst │ ├── join.c │ ├── joint_distribution.c │ ├── joint_distribution.h │ ├── keywords.c │ ├── keywords.h │ ├── lex.yy.c │ ├── list.c │ ├── list.h │ ├── load.c │ ├── load.h │ ├── makefile │ ├── mathops.h │ ├── misc.c │ ├── misc.h │ ├── mkheader.c │ ├── mkheader.vcproj │ ├── mkheader.vcxproj │ ├── mkheader.vcxproj.filters │ ├── names.dst │ ├── netezza.tpl │ ├── nulls.c │ ├── nulls.h │ ├── oracle.tpl │ ├── parallel.c │ ├── parallel.h │ ├── parallel.sh │ ├── params.h │ ├── permute.c │ ├── permute.h │ ├── porting.c │ ├── porting.h │ ├── pricing.c │ ├── pricing.h │ ├── print.c │ ├── print.h │ ├── qgen.y │ ├── qgen2.vcproj │ ├── qgen2.vcxproj │ ├── qgen2.vcxproj.filters │ ├── qgen_params.h │ ├── query_handler.c │ ├── query_handler.h │ ├── r_params.c │ ├── r_params.h │ ├── release.c │ ├── release.h │ ├── s_brand.c │ ├── s_brand.h │ ├── s_call_center.c │ ├── s_call_center.h │ ├── s_catalog.c │ ├── s_catalog.h │ ├── s_catalog_order.c │ ├── s_catalog_order.h │ ├── s_catalog_order_lineitem.c │ ├── s_catalog_order_lineitem.h │ ├── s_catalog_page.c │ ├── s_catalog_page.h │ ├── s_catalog_promotional_item.c │ ├── s_catalog_promotional_item.h │ ├── s_catalog_returns.c │ ├── s_catalog_returns.h │ ├── s_category.c │ ├── s_category.h │ ├── s_class.c │ ├── s_class.h │ ├── s_company.c │ ├── s_company.h │ ├── s_customer.c │ ├── s_customer.h │ ├── s_customer_address.c │ ├── s_customer_address.h │ ├── s_division.c │ ├── s_division.h │ ├── s_inventory.c │ ├── s_inventory.h │ ├── s_item.c │ ├── s_item.h │ ├── s_manager.c │ ├── s_manager.h │ ├── s_manufacturer.c │ ├── s_manufacturer.h │ ├── s_market.c │ ├── s_market.h │ ├── s_pline.c │ ├── s_pline.h │ ├── s_product.c │ ├── s_product.h │ ├── s_promotion.c │ ├── s_promotion.h │ ├── s_purchase.c │ ├── s_purchase.h │ ├── s_reason.c │ ├── s_reason.h │ ├── s_store.c │ ├── s_store.h │ ├── s_store_promotional_item.c │ ├── s_store_promotional_item.h │ ├── s_store_returns.c │ ├── s_store_returns.h │ ├── s_subcategory.c │ ├── s_subcategory.h │ ├── s_subclass.c │ ├── s_subclass.h │ ├── s_tdefs.h │ ├── s_warehouse.c │ ├── s_warehouse.h │ ├── s_web_order.c │ ├── s_web_order.h │ ├── s_web_order_lineitem.c │ ├── s_web_order_lineitem.h │ ├── s_web_page.c │ ├── s_web_page.h │ ├── s_web_promotinal_item.c │ ├── s_web_promotional_item.h │ ├── s_web_returns.c │ ├── s_web_returns.h │ ├── s_web_site.c │ ├── s_web_site.h │ ├── s_zip_to_gmt.c │ ├── s_zip_to_gmt.h │ ├── scaling.c │ ├── scaling.dst │ ├── scaling.h │ ├── scd.c │ ├── scd.h │ ├── source_schema.wam │ ├── sparse.c │ ├── sparse.h │ ├── streams.h │ ├── streets.dst │ ├── substitution.c │ ├── substitution.h │ ├── tables.h │ ├── tdef_functions.c │ ├── tdef_functions.h │ ├── tdefs.c │ ├── tdefs.h │ ├── template.h │ ├── text.c │ ├── tokenizer.c │ ├── tokenizer.l │ ├── tpcds.dst │ ├── tpcds.idx │ ├── tpcds.idx.h │ ├── tpcds.sql │ ├── tpcds.wam │ ├── tpcds_20080910.sum │ ├── tpcds_ri.sql │ ├── tpcds_source.sql │ ├── utility.c │ ├── utility.h │ ├── validate.c │ ├── validate.h │ ├── w_call_center.c │ ├── w_call_center.h │ ├── w_catalog_page.c │ ├── w_catalog_page.h │ ├── w_catalog_returns.c │ ├── w_catalog_returns.h │ ├── w_catalog_sales.c │ ├── w_catalog_sales.h │ ├── w_customer.c │ ├── w_customer.h │ ├── w_customer_address.c │ ├── w_customer_address.h │ ├── w_customer_demographics.c │ ├── w_customer_demographics.h │ ├── w_datetbl.c │ ├── w_datetbl.h │ ├── w_household_demographics.c │ ├── w_household_demographics.h │ ├── w_income_band.c │ ├── w_income_band.h │ ├── w_inventory.c │ ├── w_inventory.h │ ├── w_item.c │ ├── w_item.h │ ├── w_promotion.c │ ├── w_promotion.h │ ├── w_reason.c │ ├── w_reason.h │ ├── w_ship_mode.c │ ├── w_ship_mode.h │ ├── w_store.c │ ├── w_store.h │ ├── w_store_returns.c │ ├── w_store_returns.h │ ├── w_store_sales.c │ ├── w_store_sales.h │ ├── w_tdefs.h │ ├── w_timetbl.c │ ├── w_timetbl.h │ ├── w_warehouse.c │ ├── w_warehouse.h │ ├── w_web_page.c │ ├── w_web_page.h │ ├── w_web_returns.c │ ├── w_web_returns.h │ ├── w_web_sales.c │ ├── w_web_sales.h │ ├── w_web_site.c │ ├── w_web_site.h │ ├── y.tab.c │ └── y.tab.h ├── query_templates_pg ├── agg_queries │ ├── postgres.tpl │ ├── query013.tpl │ ├── query018.tpl │ ├── query019.tpl │ ├── query025.tpl │ ├── query027.tpl │ ├── query040.tpl │ ├── query050.tpl │ ├── query072.tpl │ ├── query084.tpl │ ├── query085.tpl │ ├── query091.tpl │ ├── query099.tpl │ ├── query100.tpl │ ├── query101.tpl │ └── query102.tpl ├── multi_block_queries │ ├── postgres.tpl │ ├── query001.tpl │ ├── query010.tpl │ ├── query014.tpl │ ├── query023.tpl │ ├── query030.tpl │ ├── query031.tpl │ ├── query032.tpl │ ├── query038.tpl │ ├── query039.tpl │ ├── query054.tpl │ ├── query058.tpl │ ├── query059.tpl │ ├── query064.tpl │ ├── query065.tpl │ ├── query069.tpl │ ├── query075.tpl │ ├── query080.tpl │ ├── query081.tpl │ ├── query083.tpl │ ├── query087.tpl │ ├── query092.tpl │ └── query094.tpl └── spj_queries │ ├── postgres.tpl │ ├── query013_spj.tpl │ ├── query018_spj.tpl │ ├── query019_spj.tpl │ ├── query025_spj.tpl │ ├── query027_spj.tpl │ ├── query040_spj.tpl │ ├── query050_spj.tpl │ ├── query072_spj.tpl │ ├── query084_spj.tpl │ ├── query085_spj.tpl │ ├── query091_spj.tpl │ ├── query099_spj.tpl │ ├── query100_spj.tpl │ ├── query101_spj.tpl │ └── query102_spj.tpl ├── query_templates_sqlserver ├── agg_queries │ ├── query013.tpl │ ├── query018.tpl │ ├── query019.tpl │ ├── query025.tpl │ ├── query027.tpl │ ├── query040.tpl │ ├── query050.tpl │ ├── query072.tpl │ ├── query084.tpl │ ├── query085.tpl │ ├── query091.tpl │ ├── query099.tpl │ ├── query100.tpl │ ├── query101.tpl │ ├── query102.tpl │ └── sqlserver.tpl ├── multi_block_queries │ ├── query001.tpl │ ├── query010.tpl │ ├── query014.tpl │ ├── query023.tpl │ ├── query030.tpl │ ├── query031.tpl │ ├── query032.tpl │ ├── query038.tpl │ ├── query039.tpl │ ├── query054.tpl │ ├── query058.tpl │ ├── query059.tpl │ ├── query064.tpl │ ├── query065.tpl │ ├── query069.tpl │ ├── query075.tpl │ ├── query080.tpl │ ├── query081.tpl │ ├── query083.tpl │ ├── query087.tpl │ ├── query092.tpl │ ├── query094.tpl │ └── sqlserver.tpl └── spj_queries │ ├── query013_spj.tpl │ ├── query018_spj.tpl │ ├── query019_spj.tpl │ ├── query025_spj.tpl │ ├── query027_spj.tpl │ ├── query040_spj.tpl │ ├── query050_spj.tpl │ ├── query072_spj.tpl │ ├── query084_spj.tpl │ ├── query085_spj.tpl │ ├── query091_spj.tpl │ ├── query099_spj.tpl │ ├── query100_spj.tpl │ ├── query101_spj.tpl │ ├── query102_spj.tpl │ └── sqlserver.tpl └── scripts ├── SQL_utils.py ├── create_index_pg.py ├── create_tables.sql ├── dsb_index_pg.sql ├── dsb_index_sqlserver.sql ├── generate_dsb_db_files.py ├── generate_workload.py ├── load_data_pg.py ├── load_data_sqlserver.py ├── load_db_files_sqlserver.sql ├── pg_util.py ├── start_sqlserver.py ├── util.py └── workload_config.json /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This project welcomes contributions and suggestions. Most contributions require you to 4 | agree to a Contributor License Agreement (CLA) declaring that you have the right to, 5 | and actually do, grant us the rights to use your contribution. For details, visit 6 | https://cla.microsoft.com. 7 | 8 | When you submit a pull request, a CLA-bot will automatically determine whether you need 9 | to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the 10 | instructions provided by the bot. You will only need to do this once across all repositories using our CLA. 11 | 12 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 13 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 14 | or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /NOTICE.md: -------------------------------------------------------------------------------- 1 | ## NOTICE 2 | 3 | The DSB benchmark is derived from TPC-DS and as such is not comparable to published TPC-DS results, as the DSB benchmark does not comply with the TPC-DS benchmark. 4 | 5 | The license of TPC-DS benchmark can be found here: http://tpc.org/tpc_documents_current_versions/txt/tpc-eula_v2.2.0.txt 6 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # TODO: The maintainer of this repo has not yet edited this file 2 | 3 | **REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project? 4 | 5 | - **No CSS support:** Fill out this template with information about how to file issues and get help. 6 | - **Yes CSS support:** Fill out an intake form at [aka.ms/spot](https://aka.ms/spot). CSS will work with/help you to determine next steps. More details also available at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). 7 | - **Not sure?** Fill out a SPOT intake as though the answer were "Yes". CSS will help you decide. 8 | 9 | *Then remove this first heading from this SUPPORT.MD file before publishing your repo.* 10 | 11 | # Support 12 | 13 | ## How to file issues and get help 14 | 15 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing 16 | issues before filing new issues to avoid duplicates. For new issues, file your bug or 17 | feature request as a new Issue. 18 | 19 | For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE 20 | FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER 21 | CHANNEL. WHERE WILL YOU HELP PEOPLE?**. 22 | 23 | ## Microsoft Support Policy 24 | 25 | Support for this **PROJECT or PRODUCT** is limited to the resources listed above. 26 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # ASP.NET 2 | 3 | 4 | # Build and test ASP.NET projects. 5 | # Add steps that publish symbols, save build artifacts, deploy, and more: 6 | # https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 7 | 8 | trigger: 9 | - main 10 | 11 | pool: 12 | vmImage: 'windows-latest' 13 | 14 | variables: 15 | solution: '**/*.sln' 16 | buildPlatform: 'Any CPU' 17 | buildConfiguration: 'Release' 18 | 19 | steps: 20 | - task: NuGetToolInstaller@1 21 | 22 | - task: NuGetCommand@2 23 | inputs: 24 | restoreSolution: '$(solution)' 25 | 26 | - task: VSBuild@1 27 | inputs: 28 | solution: '$(solution)' 29 | msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' 30 | platform: '$(buildPlatform)' 31 | configuration: '$(buildConfiguration)' 32 | 33 | - task: VSTest@2 34 | inputs: 35 | platform: '$(buildPlatform)' 36 | configuration: '$(buildConfiguration)' 37 | 38 | - task: CredScan@3 39 | inputs: 40 | toolVersion: Latest 41 | 42 | - task: Semmle@1 43 | inputs: 44 | sourceCodeDirectory: '$(Build.SourcesDirectory)' 45 | language: 'cpp' 46 | querySuite: 'Recommended' 47 | timeout: '1800' 48 | ram: '16384' 49 | addProjectDirToScanningExclusionList: true 50 | 51 | - task: Semmle@1 52 | inputs: 53 | sourceCodeDirectory: '$(Build.SourcesDirectory)' 54 | language: 'python' 55 | querySuite: 'Recommended' 56 | timeout: '1800' 57 | ram: '16384' 58 | addProjectDirToScanningExclusionList: true 59 | 60 | - task: SdtReport@2 61 | inputs: 62 | GdnExportHtmlFile: true 63 | GdnExportAllTools: true 64 | 65 | - task: PublishSecurityAnalysisLogs@3 66 | inputs: 67 | ArtifactName: 'CodeAnalysisLogs' 68 | ArtifactType: 'Container' 69 | AllTools: true 70 | ToolLogsNotFoundAction: 'Standard' 71 | 72 | - task: ComponentGovernanceComponentDetection@0 73 | inputs: 74 | scanType: 'Register' 75 | verbosity: 'Verbose' 76 | alertWarningLevel: 'High' 77 | -------------------------------------------------------------------------------- /code/.gitignore: -------------------------------------------------------------------------------- 1 | # Global excludes across all subdirectories 2 | *junk 3 | *.bak 4 | *.o 5 | *.obj 6 | *.bc 7 | *.so 8 | *.so.[0-9] 9 | *.so.[0-9].[0-9] 10 | *.so.[0-9].[0-9][0-9] 11 | *.sl 12 | *.sl.[0-9] 13 | *.sl.[0-9].[0-9] 14 | *.sl.[0-9].[0-9][0-9] 15 | *.dylib 16 | *.dll 17 | *.exp 18 | *.a 19 | *.mo 20 | *.pot 21 | objfiles.txt 22 | .deps/ 23 | *.gcno 24 | *.gcda 25 | *.gcov 26 | *.gcov.out 27 | lcov*.info 28 | coverage/ 29 | coverage-html-stamp 30 | win32ver.rc 31 | *.exe 32 | lib*dll.def 33 | lib*.pc 34 | *.vcxproj.user 35 | 36 | # Local excludes in root directory 37 | /GNUmakefile 38 | /config.cache 39 | /config.log 40 | /config.status 41 | /pgsql.sln 42 | /pgsql.sln.cache 43 | /Debug/ 44 | /Release/ 45 | /tmp_install/ 46 | -------------------------------------------------------------------------------- /code/TPC_DS_EULA.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/TPC_DS_EULA.txt -------------------------------------------------------------------------------- /code/specification/specification.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/specification/specification.docx -------------------------------------------------------------------------------- /code/specification/specification.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/specification/specification.pdf -------------------------------------------------------------------------------- /code/tests/Test_Document.txt: -------------------------------------------------------------------------------- 1 | This is a test document to test a users permissions to update the TPC-DS SubVersion tree. 2 | Please feel free to change this file by adding your test text changes below. 3 | 4 | Mike Nikolaiev 5 | Chair, TPC-DS 6 | 7 | #August 4, 2011 - Initial creation of the file for testing. 8 | # 9 | # 10 | 8/4/2011 - Running update test - Mike Nikolaiev 11 | -------------------------------------------------------------------------------- /code/tests/bug24.sh: -------------------------------------------------------------------------------- 1 | DIR=/data/tpcds 2 | echo "Building verification data for Bug24 in $DIR" 3 | sleep 5 4 | for s in 1 100 300 1000 3000 10000 30000 100000 5 | do 6 | echo "at scale $s" 7 | ./dsdgen -update 1 -force -dir $DIR -scale $s -ab s_cord -quiet 8 | echo " l = `wc -l $DIR/s_catalog_order_line*`" 9 | echo " r = `wc -l $DIR/s_catalog_return*`" 10 | echo " n = `awk -F\| 'length($7) == 0' $DIR/s_catalog_return* |wc -l`" 11 | done 12 | 13 | -------------------------------------------------------------------------------- /code/tests/build_tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | mkdir temp_build 2> /dev/null 5 | cd temp_build 6 | if [ -f FAILED ] 7 | then 8 | exit 9 | fi 10 | if [ -z "$1" ] 11 | then dstamp=`date '+%Y%m%d'` 12 | else dstamp=$1 13 | fi 14 | unzip ../../tpcds_${dstamp}.zip > /dev/null 2>&1 || exit -1 15 | make -f Makefile.suite OS=LINUX > make.out 2>&1 || exit -1 16 | rm make.out 17 | 18 | -------------------------------------------------------------------------------- /code/tests/catv_up.sql: -------------------------------------------------------------------------------- 1 | create table s_catalog_page as 2 | (select CP_CATALOG_NUMBER cpag_catalog_number 3 | ,CP_CATALOG_PAGE_NUMBER cpag_catalog_page_number 4 | ,CP_DEPARTMENT cpag_department 5 | -------------------------------------------------------------------------------- /code/tests/ccv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_call_center; 2 | create table s_call_center as 3 | (select cc_call_center_id call_center_id 4 | ,d1.d_date call_open_date 5 | ,d2.d_date call_closed_date 6 | ,cc_name call_center_name 7 | ,cc_class call_center_class 8 | ,cc_employees call_center_employees 9 | ,cc_sq_ft call_center_sq_ft 10 | ,CC_HOURS call_center_hours 11 | ,CC_MANAGER call_center_manager 12 | ,CC_TAX_PERCENTAGE call_tax_percentage 13 | from call_center left outer join date_dim d2 on CC_CLOSED_DATE_SK = d2.d_date_sk 14 | left outer join date_dim d1 on CC_OPEN_DATE_SK = d1.d_date_sk 15 | where cc_rec_end_date is NULL -- need this to avoid duplicates 16 | and rownum < 5 17 | ); 18 | -------------------------------------------------------------------------------- /code/tests/chunked_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # created in response to bug 350 3 | # assumes data set has been built in /data 4 | 5 | validate() { 6 | l=`wc -l ${1}_${c1}_$p.csv|awk '{print $1}'` 7 | head -$l ${1}_${c2}_$p2.csv > foo.2 8 | sum ${1}_${c1}_$p.csv foo.2 | awk '{print $1, $2}' > foo 9 | f1=`head -1 foo` 10 | f2=`tail -1 foo` 11 | if [ "$f1" != "$f2" ] 12 | then 13 | echo $1 failed at scale $sc 14 | exit -1 15 | fi 16 | echo $1 ok based on $l lines at scale $sc 17 | rm -f ${1}_* foo.1 foo.2 foo 18 | } 19 | 20 | cd temp_build 21 | if [ -f FAILED ] 22 | then 23 | exit 24 | fi 25 | 26 | # read in the tables that might be parallelized, scaling up 27 | # as required 28 | while read tbl sc p chld 29 | do 30 | c1=`expr $p / 2` 31 | c1=`expr $c1 + 1` 32 | p2=`expr $p / 2` 33 | c2=`expr $p2 / 2` 34 | c2=`expr $c2 + 1` 35 | export p p2 c1 c2 sc 36 | ./dbgen2 -table $tbl -f -scale $sc -parallel $p -child $c1 -q 2> /dev/null & 37 | ./dbgen2 -table $tbl -f -scale $sc -parallel $p2 -child $c2 -q 2> /dev/null & 38 | wait 39 | if [ -f ${tbl}_${c1}_${p}.csv ] 40 | then 41 | validate $tbl 42 | if [ -n "$chld" ] 43 | then 44 | tbl=`basename $chld .csv` 45 | validate $tbl 46 | fi 47 | fi 48 | done << _EOF_ 49 | catalog_page 100 1000 50 | catalog_sales 1 1000 catalog_returns 51 | customer_address 100 1000 52 | customer 10 1000 53 | inventory 1 1000 54 | item 100 1000 55 | store_sales 1 1000 store_returns 56 | web_sales 10 500 web_returns 57 | _EOF_ 58 | -------------------------------------------------------------------------------- /code/tests/cleanUp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | rm -rf temp_build 5 | rm -rf /data/*.csv 6 | -------------------------------------------------------------------------------- /code/tests/cr_cc_join.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | cd temp_build 5 | if [ -f FAILED ] 6 | then 7 | exit 8 | fi 9 | 10 | mysql -Dtpcds -uroot -pmysqlpasswd <<_EOF_ 11 | create index cr_cc on catalog_returns(cr_call_center_sk); 12 | select count(distinct(cr_call_center_sk)) as "unique cr keys" from catalog_returns; 13 | select count(distinct(cc_call_center_sk)) as "unique cc keys" from call_center; 14 | select min(cc_call_center_sk) as "min key", max(cc_call_center_sk) as "max key" from call_center; 15 | select distinct cr_call_center_sk from catalog_returns 16 | where cr_call_center_sk not in (select cc_call_center_sk from call_center ); 17 | drop index cr_cc on catalog_returns; 18 | _EOF_ 19 | -------------------------------------------------------------------------------- /code/tests/custv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_customer; 2 | create table s_customer as 3 | (select C_CUSTOMER_ID CUST_CUSTOMER_ID 4 | ,C_SALUTATION CUST_SALUTATION 5 | ,C_LAST_NAME CUST_LAST_NAME 6 | ,C_FIRST_NAME CUST_FIRST_NAME 7 | ,C_PREFERRED_CUST_FLAG CUST_PREFFERED_FLAG 8 | ,d3.d_date CUST_BIRTH_DATE 9 | ,C_BIRTH_COUNTRY CUST_BIRTH_COUNTRY 10 | ,C_LOGIN CUST_LOGIN_ID 11 | ,C_EMAIL_ADDRESS CUST_EMAIL_ADDRESS 12 | ,d1.d_date CUST_FIRST_SHIPTO_DATE 13 | ,d2.d_date CUST_FIRST_PURCHASE_DATE 14 | ,C_LAST_REVIEW_DATE CUST_LAST_REVIEW_DATE 15 | ,CA_STREET_NUMBER CUST_STREET_NUMBER 16 | ,CA_SUITE_NUMBER CUST_SUITE_NUMBER 17 | ,CA_STREET_NAME CUST_STREET_NAME1 18 | ,CA_STREET_NAME CUST_STREET_NAME2 19 | ,CA_STREET_TYPE CUST_STREET_TYPE 20 | ,CA_CITY CUST_CITY 21 | ,CA_ZIP CUST_ZIP 22 | ,CA_COUNTY CUST_COUNTY 23 | ,CA_STATE CUST_STATE 24 | ,CA_COUNTRY CUST_COUNTRY 25 | ,CA_LOCATION_TYPE CUST_LOC_TYPE 26 | ,CD_GENDER CUST_GENDER_CODE 27 | ,CD_MARITAL_STATUS CUST_MARITAL_STATUS 28 | ,CD_EDUCATION_STATUS CUST_EDUC_STATUS 29 | ,CD_CREDIT_RATING CUST_CREDIT_RATING 30 | ,CD_PURCHASE_ESTIMATE CUST_PURCH_EST 31 | ,HD_BUY_POTENTIAL CUST_BUY_POTENTIAL 32 | ,HD_DEP_COUNT CUST_DEPEND_CNT 33 | ,CD_DEP_EMPLOYED_COUNT CUST_DEPEND_EMP_CNT 34 | ,CD_DEP_COLLEGE_COUNT CUST_DEPEND_COLLEGE_CNT 35 | ,HD_VEHICLE_COUNT CUST_VEHICLE_CNT 36 | ,IB_LOWER_BOUND+800 CUST_ANNUAL_INCOME 37 | from customer 38 | ,customer_address 39 | ,customer_demographics 40 | ,household_demographics 41 | ,income_band 42 | ,date_dim d1 43 | ,date_dim d2 44 | ,date_dim d3 45 | where c_current_addr_sk = ca_address_sk 46 | and d1.d_date_sk = C_FIRST_SHIPTO_DATE_SK 47 | and d2.d_date_sk = C_FIRST_SALES_DATE_SK 48 | and extract (day from d3.d_date) = c_birth_day 49 | and extract (month from d3.d_date) = c_birth_month 50 | and extract (year from d3.d_date) = c_birth_year 51 | and C_CURRENT_CDEMO_SK = cd_demo_sk 52 | and C_CURRENT_HDEMO_SK = hd_demo_sk 53 | and HD_INCOME_BAND_SK = IB_INCOME_BAND_SK 54 | and rownum < 1000 55 | ); 56 | -------------------------------------------------------------------------------- /code/tests/db2_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | create_schema() 3 | { 4 | db2 "drop database $1" > /dev/null 2>&1 5 | db2 "create database $1" || exit -1 6 | db2 "connect to $1" || exit -1 7 | db2batch -d $1 -f $2 || exit -1 8 | } 9 | 10 | load_table() 11 | { 12 | db2 "load from $2 of del modified by coldel| replace into $1" 2>&1 | 13 | grep -i rejected 14 | } 15 | 16 | connect_to() 17 | { 18 | db2 "connect to $1" 19 | } 20 | 21 | activate_constraints() 22 | { 23 | cut -f3 -d' ' $1.sql |sort |uniq | # get a list of table names 24 | while read t 25 | do 26 | db2 "set integrity off " 27 | db2 "set integrity for $t check immediate" 28 | done 29 | } 30 | 31 | run_query() 32 | { 33 | db2batch -d $1 -f $2 34 | } 35 | 36 | -------------------------------------------------------------------------------- /code/tests/dm_c.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON; 2 | BEGIN 3 | FOR c_rec IN (SELECT C_CUSTOMER_ID 4 | ,C_CURRENT_CDEMO_SK 5 | ,C_CURRENT_HDEMO_SK 6 | ,C_CURRENT_ADDR_SK 7 | ,C_FIRST_SHIPTO_DATE_SK 8 | ,C_FIRST_SALES_DATE_SK 9 | ,C_SALUTATION 10 | ,C_FIRST_NAME 11 | ,C_LAST_NAME 12 | ,C_PREFERRED_CUST_FLAG 13 | ,C_BIRTH_DAY 14 | ,C_BIRTH_MONTH 15 | ,C_BIRTH_YEAR 16 | ,C_BIRTH_COUNTRY 17 | ,C_LOGIN 18 | ,C_EMAIL_ADDRESS 19 | ,C_LAST_REVIEW_DATE 20 | from custv) LOOP 21 | update customer set 22 | C_CUSTOMER_ID=c_rec.C_CUSTOMER_ID 23 | ,C_CURRENT_CDEMO_SK=c_rec.C_CURRENT_CDEMO_SK 24 | ,C_CURRENT_HDEMO_SK=c_rec.C_CURRENT_HDEMO_SK 25 | ,C_CURRENT_ADDR_SK=c_rec.C_CURRENT_ADDR_SK 26 | ,C_FIRST_SHIPTO_DATE_SK=c_rec.C_FIRST_SHIPTO_DATE_SK 27 | ,C_FIRST_SALES_DATE_SK=c_rec.C_FIRST_SALES_DATE_SK 28 | ,C_SALUTATION=c_rec.C_SALUTATION 29 | ,C_FIRST_NAME=c_rec.C_FIRST_NAME 30 | ,C_LAST_NAME=c_rec.C_LAST_NAME 31 | ,C_PREFERRED_CUST_FLAG=c_rec.C_PREFERRED_CUST_FLAG 32 | ,C_BIRTH_DAY=c_rec.C_BIRTH_DAY 33 | ,C_BIRTH_MONTH=c_rec.C_BIRTH_MONTH 34 | ,C_BIRTH_YEAR=c_rec.C_BIRTH_YEAR 35 | ,C_BIRTH_COUNTRY=c_rec.C_BIRTH_COUNTRY 36 | ,C_LOGIN=c_rec.C_LOGIN 37 | ,C_EMAIL_ADDRESS=c_rec.C_EMAIL_ADDRESS 38 | ,C_LAST_REVIEW_DATE=c_rec.C_LAST_REVIEW_DATE 39 | where c_customer_id=c_rec.c_customer_id; 40 | END LOOP; 41 | commit; 42 | END; 43 | 44 | . 45 | 46 | run; 47 | -------------------------------------------------------------------------------- /code/tests/dm_c_t.sql: -------------------------------------------------------------------------------- 1 | drop table custv; 2 | create table custv as 3 | select cust_customer_id c_customer_id 4 | ,cd_demo_sk c_current_cdemo_sk 5 | ,hd_demo_sk c_current_hdemo_sk 6 | ,ca_address_sk c_current_addr_sk 7 | ,d1.d_date_sk c_first_shipto_date_sk 8 | ,d2.d_date_sk c_first_sales_date_sk 9 | ,cust_salutation c_salutation 10 | ,cust_first_name c_first_name 11 | ,cust_last_name c_last_name 12 | ,cust_preffered_flag c_preferred_cust_flag 13 | ,extract(day from cast(cust_birth_date as date)) c_birth_day 14 | ,extract(month from cast(cust_birth_date as date)) c_birth_month 15 | ,extract(year from cast(cust_birth_date as date)) c_birth_year 16 | ,cust_birth_country c_birth_country 17 | ,cust_login_id c_login 18 | ,cust_email_address c_email_address 19 | ,cust_last_review_date c_last_review_date 20 | from 21 | s_customer_m left outer join customer on (c_customer_id=cust_customer_id) 22 | left outer join customer_address on (c_current_addr_sk = ca_address_sk) 23 | ,customer_demographics 24 | ,household_demographics 25 | ,income_band ib 26 | ,date_dim d1 27 | ,date_dim d2 28 | where 29 | cust_gender = cd_gender 30 | and cust_marital_status = cd_marital_status 31 | and cust_educ_status = cd_education_status 32 | and cust_purch_est = cd_purchase_estimate 33 | and cust_credit_rating = cd_credit_rating 34 | and cust_depend_cnt = cd_dep_count 35 | and cust_depend_emp_cnt = cd_dep_employed_count 36 | and cust_depend_college_cnt = cd_dep_college_count 37 | and round(cust_annual_income, 0) between ib.ib_lower_bound and ib.ib_upper_bound 38 | and hd_income_band_sk = ib_income_band_sk 39 | and cust_buy_potential = hd_buy_potential 40 | and cust_depend_cnt= hd_dep_count 41 | and cust_vehicle_cnt = hd_vehicle_count 42 | and d1.d_date = cust_first_purchase_date 43 | and d2.d_date = cust_first_shipto_date 44 | ; 45 | select count(*) from s_customer_m; 46 | select count(*) from custv; 47 | -------------------------------------------------------------------------------- /code/tests/dm_ca.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON; 2 | DECLARE 3 | max_sk NUMBER; 4 | BEGIN 5 | FOR ca_rec IN (SELECT CA_ADDRESS_ID 6 | ,CA_STREET_NUMBER 7 | ,CA_STREET_NAME 8 | ,CA_STREET_TYPE 9 | ,CA_SUITE_NUMBER 10 | ,CA_CITY 11 | ,CA_COUNTY 12 | ,CA_STATE 13 | ,CA_ZIP 14 | ,CA_COUNTRY 15 | ,CA_GMT_OFFSET 16 | ,CA_LOCATION_TYPE 17 | from cadrv) LOOP 18 | update customer_address set 19 | CA_STREET_NUMBER=ca_rec.CA_STREET_NUMBER 20 | ,CA_STREET_NAME=ca_rec.CA_STREET_NAME 21 | ,CA_STREET_TYPE=ca_rec.CA_STREET_TYPE 22 | ,CA_SUITE_NUMBER=ca_rec.CA_SUITE_NUMBER 23 | ,CA_CITY=ca_rec.CA_CITY 24 | ,CA_COUNTY=ca_rec.CA_COUNTY 25 | ,CA_STATE=ca_rec.CA_STATE 26 | ,CA_ZIP=ca_rec.CA_ZIP 27 | ,CA_COUNTRY=ca_rec.CA_COUNTRY 28 | ,CA_GMT_OFFSET=ca_rec.CA_GMT_OFFSET 29 | ,CA_LOCATION_TYPE=ca_rec.CA_LOCATION_TYPE 30 | where CA_ADDRESS_ID=ca_rec.CA_ADDRESS_ID; 31 | END LOOP; 32 | commit; 33 | END; 34 | 35 | . 36 | 37 | run; 38 | -------------------------------------------------------------------------------- /code/tests/dm_ca_t.sql: -------------------------------------------------------------------------------- 1 | drop table cadrv; 2 | create table cadrv as 3 | select ca_address_id ca_address_id 4 | ,cust_street_number ca_street_number 5 | ,concat(concat(rtrim(cust_street_name1),' '),rtrim(cust_street_name2)) ca_street_name 6 | ,cust_street_type ca_street_type 7 | ,cust_suite_number ca_suite_number 8 | ,cust_city ca_city 9 | ,cust_county ca_county 10 | ,cust_state ca_state 11 | ,cust_zip ca_zip 12 | ,cust_country ca_country 13 | ,zipg_gmt_offset ca_gmt_offset 14 | ,cust_loc_type ca_location_type 15 | from s_customer_m 16 | ,customer 17 | ,customer_address 18 | ,s_zip_to_gmt_m 19 | where cust_zip = zipg_zip 20 | and cust_customer_id = c_customer_id 21 | and c_current_addr_sk = ca_address_sk; 22 | 23 | select count(*) from s_customer_m; 24 | select count(*) from cadrv; 25 | -------------------------------------------------------------------------------- /code/tests/dm_ca_v.sql: -------------------------------------------------------------------------------- 1 | drop view cadrv; 2 | create view cadrv as 3 | select cust_customer_id 4 | ,cust_street_number 5 | ,concat(cust_street_name1,cust_street_name2) street 6 | ,cust_street_type 7 | ,cust_suite_number 8 | ,cust_city 9 | ,cust_county 10 | ,cust_state 11 | ,cust_zip 12 | ,cust_country 13 | ,zipg_gmt_offset 14 | from s_customer_m 15 | ,s_zip_to_gmt 16 | where cust_zip = zipg_zip; 17 | select count(*) from s_customer_m; 18 | select count(*) from cadrv; 19 | -------------------------------------------------------------------------------- /code/tests/dm_cc.sql: -------------------------------------------------------------------------------- 1 | update call_center set cc_rec_end_date = sysdate where cc_call_center_id in (select cc_call_center_id from call_center) and cc_rec_end_date is NULL; 2 | insert into call_center(select * from ccv); 3 | -------------------------------------------------------------------------------- /code/tests/dm_cc_s.sql: -------------------------------------------------------------------------------- 1 | drop SEQUENCE item_seq; 2 | SET SERVEROUTPUT ON; 3 | DECLARE 4 | max_sk NUMBER; 5 | BEGIN 6 | SELECT max(cc_call_center_sk)+1 INTO max_sk FROM call_center; 7 | dbms_output.put_line('max call center sk '||max_sk); 8 | EXECUTE IMMEDIATE 'CREATE SEQUENCE callcenter_seq INCREMENT BY 1 START WITH '||max_sk||' ORDER'; 9 | END; 10 | 11 | . 12 | 13 | run; 14 | -------------------------------------------------------------------------------- /code/tests/dm_cc_t.sql: -------------------------------------------------------------------------------- 1 | drop table ccv; 2 | create table CCV as 3 | select callcenter_seq.nextval cc_call_center_sk 4 | ,call_center_id cc_call_center_id 5 | ,sysdate cc_rec_start_date 6 | ,cast(NULL as date) cc_rec_end_date 7 | ,d1.d_date_sk cc_closed_date_sk 8 | ,d2.d_date_sk cc_open_date_sk 9 | ,call_center_name cc_name 10 | ,call_center_class cc_class 11 | ,call_center_employees cc_employees 12 | ,call_center_sq_ft cc_sq_ft 13 | ,call_center_hours cc_hours 14 | ,call_center_manager cc_manager 15 | ,cc_mkt_id 16 | ,cc_mkt_class 17 | ,cc_mkt_desc 18 | ,cc_market_manager 19 | ,cc_division 20 | ,cc_division_name 21 | ,cc_company 22 | ,cc_company_name 23 | ,cc_street_number 24 | ,cc_street_name 25 | ,cc_street_type 26 | ,cc_suite_number 27 | ,cc_city 28 | ,cc_county 29 | ,cc_state 30 | ,cc_zip 31 | ,cc_country 32 | ,cc_gmt_offset 33 | ,call_center_tax_percentage cc_tax_percentage 34 | from s_call_center_m left outer join date_dim d2 on d2.d_date = cast(call_closed_date as date) 35 | left outer join date_dim d1 on d1.d_date = cast(call_open_date as date), 36 | call_center 37 | where call_center_id = cc_call_center_id 38 | and cc_rec_end_date is null; 39 | select count(*) from s_call_center_m; 40 | select count(*) from ccv; 41 | -------------------------------------------------------------------------------- /code/tests/dm_cp.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON; 2 | DECLARE 3 | max_sk NUMBER; 4 | BEGIN 5 | FOR cp_rec IN (SELECT CP_CATALOG_PAGE_ID 6 | ,CP_START_DATE_SK 7 | ,CP_END_DATE_SK 8 | ,CP_DEPARTMENT 9 | ,CP_CATALOG_NUMBER 10 | ,CP_DESCRIPTION 11 | ,CP_TYPE 12 | FROM catv) LOOP 13 | update catalog_page set CP_CATALOG_PAGE_ID=cp_rec.CP_CATALOG_PAGE_ID 14 | ,CP_START_DATE_SK=cp_rec.CP_START_DATE_SK 15 | ,CP_END_DATE_SK=cp_rec.CP_END_DATE_SK 16 | ,CP_DEPARTMENT=cp_rec.CP_DEPARTMENT 17 | ,CP_CATALOG_NUMBER=cp_rec.CP_CATALOG_NUMBER 18 | ,CP_DESCRIPTION=cp_rec.CP_DESCRIPTION 19 | ,CP_TYPE=cp_rec.CP_TYPE 20 | where CP_CATALOG_PAGE_ID=cp_rec.CP_CATALOG_PAGE_ID; 21 | END LOOP; 22 | commit; 23 | END; 24 | 25 | . 26 | 27 | run; 28 | -------------------------------------------------------------------------------- /code/tests/dm_cp_t.sql: -------------------------------------------------------------------------------- 1 | drop table catv; 2 | create table catv as 3 | select cpag_id cp_catalog_page_id 4 | ,startd.d_date_sk cp_start_date_sk 5 | ,endd.d_date_sk cp_end_date_sk 6 | ,cpag_department cp_department 7 | ,cpag_catalog_number cp_catalog_number 8 | ,cpag_description cp_description 9 | ,cpag_type cp_type 10 | from s_catalog_page 11 | ,date_dim startd 12 | ,date_dim endd 13 | where cpag_start_date = startd.d_date 14 | and cpag_end_date = endd.d_date; 15 | select count(*) from catv; 16 | select count(*) from s_catalog_page; 17 | -------------------------------------------------------------------------------- /code/tests/dm_i.sql: -------------------------------------------------------------------------------- 1 | update item set i_rec_end_date = sysdate where i_item_id in (select i_item_id from itemv) and i_rec_end_date is NULL; 2 | insert into item (select * from itemv); 3 | -------------------------------------------------------------------------------- /code/tests/dm_i_s.sql: -------------------------------------------------------------------------------- 1 | drop SEQUENCE item_seq; 2 | --SET SERVEROUTPUT ON; 3 | DECLARE 4 | max_sk NUMBER; 5 | BEGIN 6 | SELECT max(i_item_sk)+1 INTO max_sk FROM item; 7 | dbms_output.put_line('max item sk '||max_sk); 8 | EXECUTE IMMEDIATE 'CREATE SEQUENCE item_seq INCREMENT BY 1 START WITH '||max_sk||' ORDER'; 9 | END; 10 | 11 | . 12 | 13 | run; 14 | -------------------------------------------------------------------------------- /code/tests/dm_i_t.sql: -------------------------------------------------------------------------------- 1 | drop table itemv; 2 | create table itemv as 3 | select item_seq.nextVal i_item_sk 4 | ,item_item_id i_item_id 5 | ,sysdate i_rec_start_date 6 | ,cast(NULL as date) i_rec_end_date 7 | ,item_item_description i_item_desc 8 | ,item_list_price i_current_price 9 | ,item_wholesale_cost i_wholesalecost 10 | ,i_brand_id 11 | ,i_brand 12 | ,i_class_id 13 | ,i_class 14 | ,i_category_id 15 | ,i_category 16 | ,i_manufact_id 17 | ,i_manufact 18 | ,item_size i_size 19 | ,item_formulation i_formulation 20 | ,item_color i_color 21 | ,item_units i_units 22 | ,item_container i_container 23 | ,item_manager_id i_manager 24 | ,i_product_name 25 | from s_item_m, 26 | item 27 | where item_item_id = i_item_id 28 | and i_rec_end_date is null; 29 | select count(*) from s_item_m; 30 | select count(*) from itemv; 31 | -------------------------------------------------------------------------------- /code/tests/dm_p.sql: -------------------------------------------------------------------------------- 1 | 2 | select count(*) from promv; 3 | select count(*) 4 | from promv s,promotion d 5 | where s.P_PROMO_ID=d.P_PROMO_ID; 6 | 7 | SET SERVEROUTPUT ON; 8 | DECLARE 9 | max_sk NUMBER; 10 | BEGIN 11 | FOR p_rec IN (SELECT P_PROMO_ID 12 | ,P_START_DATE_SK 13 | ,P_END_DATE_SK 14 | ,P_COST 15 | ,P_RESPONSE_TARGET 16 | ,P_PROMO_NAME 17 | ,P_CHANNEL_DMAIL 18 | ,P_CHANNEL_EMAIL 19 | ,P_CHANNEL_CATALOG 20 | ,P_CHANNEL_TV 21 | ,P_CHANNEL_RADIO 22 | ,P_CHANNEL_PRESS 23 | ,P_CHANNEL_EVENT 24 | ,P_CHANNEL_DEMO 25 | ,P_CHANNEL_DETAILS 26 | ,P_PURPOSE 27 | ,P_DISCOUNT_ACTIVE 28 | FROM promv) LOOP 29 | update promotion set 30 | P_END_DATE_SK=p_rec.P_END_DATE_SK 31 | ,P_COST=p_rec.P_COST 32 | ,P_RESPONSE_TARGET=p_rec.P_RESPONSE_TARGET 33 | ,P_PROMO_NAME=p_rec.P_PROMO_NAME 34 | ,P_CHANNEL_DMAIL=p_rec.P_CHANNEL_DMAIL 35 | ,P_CHANNEL_EMAIL=p_rec.P_CHANNEL_EMAIL 36 | ,P_CHANNEL_CATALOG=p_rec.P_CHANNEL_CATALOG 37 | ,P_CHANNEL_TV=p_rec.P_CHANNEL_TV 38 | ,P_CHANNEL_RADIO=p_rec.P_CHANNEL_RADIO 39 | ,P_CHANNEL_PRESS=p_rec.P_CHANNEL_PRESS 40 | ,P_CHANNEL_EVENT=p_rec.P_CHANNEL_EVENT 41 | ,P_CHANNEL_DEMO=p_rec.P_CHANNEL_DEMO 42 | ,P_CHANNEL_DETAILS=p_rec.P_CHANNEL_DETAILS 43 | ,P_PURPOSE=p_rec.P_PURPOSE 44 | ,P_DISCOUNT_ACTIVE=p_rec.P_DISCOUNT_ACTIVE 45 | where P_PROMO_ID=p_rec.P_PROMO_ID; 46 | END LOOP; 47 | commit; 48 | END; 49 | 50 | . 51 | 52 | run; 53 | -------------------------------------------------------------------------------- /code/tests/dm_p_t.sql: -------------------------------------------------------------------------------- 1 | drop table promv; 2 | create table promv as 3 | select prom_promotion_id p_promo_id 4 | ,d1.d_date_sk p_start_date_sk 5 | ,d2.d_date_sk p_end_date_sk 6 | ,prom_cost p_cost 7 | ,prom_response_target p_response_target 8 | ,prom_promotion_name p_promo_name 9 | ,prom_channel_dmail p_channel_dmail 10 | ,prom_channel_email p_channel_email 11 | ,prom_channel_catalog p_channel_catalog 12 | ,prom_channel_tv p_channel_tv 13 | ,prom_channel_radio p_channel_radio 14 | ,prom_channel_press p_channel_press 15 | ,prom_channel_event p_channel_event 16 | ,prom_channel_demo p_channel_demo 17 | ,prom_channel_details p_channel_details 18 | ,prom_purpose p_purpose 19 | ,prom_discount_active p_discount_active 20 | from s_promotion_m left outer join date_dim d1 on prom_start_date = d1.d_date 21 | left outer join date_dim d2 on prom_end_date = d2.d_date; 22 | select count(*) from s_promotion_m; 23 | select count(*) from promv; 24 | 25 | -------------------------------------------------------------------------------- /code/tests/dm_s.sql: -------------------------------------------------------------------------------- 1 | update store set s_rec_end_date = sysdate where s_store_id in (select s_store_id from storv) and s_rec_end_date is NULL; 2 | insert into store (select * from storv); 3 | 4 | -------------------------------------------------------------------------------- /code/tests/dm_s_s.sql: -------------------------------------------------------------------------------- 1 | drop SEQUENCE store_seq; 2 | --SET SERVEROUTPUT ON; 3 | DECLARE 4 | max_sk NUMBER; 5 | BEGIN 6 | SELECT max(s_store_sk)+1 INTO max_sk FROM store; 7 | dbms_output.put_line('max store sk '||max_sk); 8 | EXECUTE IMMEDIATE 'CREATE SEQUENCE store_seq INCREMENT BY 1 START WITH '||max_sk||' ORDER'; 9 | END; 10 | 11 | . 12 | 13 | run; 14 | -------------------------------------------------------------------------------- /code/tests/dm_s_t.sql: -------------------------------------------------------------------------------- 1 | drop table storv; 2 | create table storv as 3 | select store_seq.nextVal s_store_sk 4 | ,stor_store_id s_store_id 5 | ,sysdate s_rec_start_date 6 | ,cast(NULL as date) s_rec_end_date 7 | ,d1.d_date_sk s_closed_date_sk 8 | ,stor_name s_store_name 9 | ,stor_employees s_number_employees 10 | ,stor_floor_space s_floor_space 11 | ,stor_hours s_hours 12 | ,stor_store_manager s_manager 13 | ,stor_market_id s_market_id 14 | ,stor_geography_class s_geography_class 15 | ,s_market_desc 16 | ,stor_market_manager s_market_manager 17 | ,s_division_id 18 | ,s_division_name 19 | ,s_company_id 20 | ,s_company_name 21 | ,s_street_number 22 | ,s_street_name 23 | ,s_street_type 24 | ,s_suite_number 25 | ,s_city 26 | ,s_county 27 | ,s_state 28 | ,s_zip 29 | ,s_country 30 | ,s_gmt_offset 31 | ,stor_tax_percentage s_tax_percentage 32 | from s_store_m left outer join date_dim d1 on TO_DATE(stor_closed_date,'YYYY-MM-DD')= d1.d_date 33 | ,store 34 | where stor_store_id = s_store_id 35 | and s_rec_end_date is null; 36 | select 's_store_m '||count(*) from s_store_m; 37 | select 's_storv '||count(*) from storv; 38 | select 'null date_dim '||count(*) from storv where s_closed_date_sk is null; 39 | -------------------------------------------------------------------------------- /code/tests/dm_w.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON; 2 | DECLARE 3 | max_sk NUMBER; 4 | BEGIN 5 | FOR w_rec IN (SELECT W_WAREHOUSE_ID 6 | ,W_WAREHOUSE_NAME 7 | ,W_WAREHOUSE_SQ_FT 8 | ,W_STREET_NUMBER 9 | ,W_STREET_NAME 10 | ,W_STREET_TYPE 11 | ,W_SUITE_NUMBER 12 | ,W_CITY 13 | ,W_COUNTY 14 | ,W_STATE 15 | ,W_ZIP 16 | ,W_COUNTRY 17 | ,W_GMT_OFFSET 18 | FROM wrhsv) LOOP 19 | update warehouse set 20 | W_WAREHOUSE_NAME=w_rec.W_WAREHOUSE_NAME 21 | ,W_WAREHOUSE_SQ_FT=w_rec.W_WAREHOUSE_SQ_FT 22 | ,W_STREET_NUMBER=w_rec.W_STREET_NUMBER 23 | ,W_STREET_NAME=w_rec.W_STREET_NAME 24 | ,W_STREET_TYPE=w_rec.W_STREET_TYPE 25 | ,W_SUITE_NUMBER=w_rec.W_SUITE_NUMBER 26 | ,W_CITY=w_rec.W_CITY 27 | ,W_COUNTY=w_rec.W_COUNTY 28 | ,W_STATE=w_rec.W_STATE 29 | ,W_ZIP=w_rec.W_ZIP 30 | ,W_COUNTRY=w_rec.W_COUNTRY 31 | ,W_GMT_OFFSET=w_rec.W_GMT_OFFSET 32 | where W_WAREHOUSE_ID=w_rec.W_WAREHOUSE_ID; 33 | END LOOP; 34 | commit; 35 | END; 36 | 37 | . 38 | 39 | run; 40 | -------------------------------------------------------------------------------- /code/tests/dm_w_t.sql: -------------------------------------------------------------------------------- 1 | drop table wrhsv; 2 | create table wrhsv as 3 | select wrhs_warehouse_id w_warehouse_id 4 | ,wrhs_warehouse_desc w_warehouse_name 5 | ,wrhs_warehouse_sq_ft w_warehouse_sq_ft 6 | ,w_street_number 7 | ,w_street_name 8 | ,w_street_type 9 | ,w_suite_number 10 | ,w_city 11 | ,w_county 12 | ,w_state 13 | ,w_zip 14 | ,w_country 15 | ,w_gmt_offset 16 | from s_warehouse_m, 17 | warehouse 18 | where wrhs_warehouse_id = w_warehouse_id; 19 | select count(*) from s_warehouse_m; 20 | select count(*) from wrhsv; 21 | -------------------------------------------------------------------------------- /code/tests/dm_wp.sql: -------------------------------------------------------------------------------- 1 | update web_page set wp_rec_end_date = sysdate where wp_web_page_id in (select wp_web_page_id from webv) and wp_rec_end_date is NULL; 2 | insert into web_page (select * from webv); 3 | -------------------------------------------------------------------------------- /code/tests/dm_wp_s.sql: -------------------------------------------------------------------------------- 1 | drop SEQUENCE web_page_seq; 2 | --SET SERVEROUTPUT ON; 3 | DECLARE 4 | max_sk NUMBER; 5 | BEGIN 6 | SELECT max(WP_WEB_PAGE_SK)+1 INTO max_sk FROM web_page; 7 | dbms_output.put_line('max WP_WEB_PAGE_SK '||max_sk); 8 | EXECUTE IMMEDIATE 'CREATE SEQUENCE web_page_seq INCREMENT BY 1 START WITH '||max_sk||' ORDER'; 9 | END; 10 | 11 | . 12 | 13 | run; 14 | -------------------------------------------------------------------------------- /code/tests/dm_wp_t.sql: -------------------------------------------------------------------------------- 1 | drop table webv; 2 | create table webv as 3 | select web_page_seq.nextVal wp_web_page_sk 4 | ,wpag_web_page_id wp_web_page_id 5 | ,sysdate wp_rec_start_date 6 | ,cast(null as date) wp_rec_end_date 7 | ,d1.d_date_sk wp_creation_date_sk 8 | ,d2.d_date_sk wp_access_date_sk 9 | ,wpag_autogen_flag wp_autogen_flag 10 | ,wpag_url wp_url 11 | ,wpag_type wp_type 12 | ,wpag_char_cnt wp_char_count 13 | ,wpag_link_cnt wp_link_count 14 | ,wpag_image_cnt wp_image_count 15 | ,wpag_max_ad_cnt wp_max_ad_count 16 | from s_web_page_m left outer join date_dim d1 on wpag_create_date = d1.d_date 17 | left outer join date_dim d2 on wpag_access_date = d2.d_date; 18 | select count(*) from s_web_page; 19 | select count(*) from webv; 20 | -------------------------------------------------------------------------------- /code/tests/dm_ws.sql: -------------------------------------------------------------------------------- 1 | update web_site set web_rec_end_date = sysdate where web_site_id in (select web_site_id from websv) and web_rec_end_date is NULL; 2 | insert into web_site (select * from websv); 3 | rollback; 4 | -------------------------------------------------------------------------------- /code/tests/dm_ws_s.sql: -------------------------------------------------------------------------------- 1 | drop SEQUENCE web_site_seq; 2 | --SET SERVEROUTPUT ON; 3 | DECLARE 4 | max_sk NUMBER; 5 | BEGIN 6 | SELECT max(web_site_sk)+1 INTO max_sk FROM web_site; 7 | dbms_output.put_line('max web_site_sk'||max_sk); 8 | EXECUTE IMMEDIATE 'CREATE SEQUENCE web_site_seq INCREMENT BY 1 START WITH '||max_sk||' ORDER'; 9 | END; 10 | 11 | . 12 | 13 | run; 14 | -------------------------------------------------------------------------------- /code/tests/dm_ws_t.sql: -------------------------------------------------------------------------------- 1 | drop table websv; 2 | create table websv as 3 | select web_site_seq.nextVal web_site_sk 4 | ,wsit_web_site_id web_site_id 5 | ,sysdate web_rec_start_date 6 | ,cast(null as date) web_rec_end_date 7 | ,wsit_site_name web_name 8 | ,d1.d_date_sk web_open_date_sk 9 | ,d2.d_date_sk web_close_date_sk 10 | ,wsit_site_class web_class 11 | ,wsit_site_manager web_manager 12 | ,web_mkt_id 13 | ,web_mkt_class 14 | ,web_mkt_desc 15 | ,web_market_manager 16 | ,web_company_id 17 | ,web_company_name 18 | ,web_street_number 19 | ,web_street_name 20 | ,web_street_type 21 | ,web_suite_number 22 | ,web_city 23 | ,web_county 24 | ,web_state 25 | ,web_zip 26 | ,web_country 27 | ,web_gmt_offset 28 | ,wsit_tax_percentage web_tax_percentage 29 | from s_web_site_m left outer join date_dim d1 on (d1.d_date = wsit_open_date) 30 | left outer join date_dim d2 on (d2.d_date = wsit_closed_date), 31 | web_site 32 | where web_site_id = wsit_web_site_id 33 | and web_rec_end_date is null; 34 | select count(*) from s_web_site_m; 35 | select count(*) from websv; 36 | -------------------------------------------------------------------------------- /code/tests/emptyTest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | cd temp_build 5 | if [ -f FAILED ] 6 | then 7 | exit 8 | fi 9 | 10 | -------------------------------------------------------------------------------- /code/tests/fail.sh: -------------------------------------------------------------------------------- 1 | # $id:$ 2 | # $log:$ 3 | echo $1 FAILED | tee -a FAILED 4 | exit -1 5 | -------------------------------------------------------------------------------- /code/tests/gen_base_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | cd temp_build 5 | rm -rf /data/*.csv 6 | child=1 7 | while [ $child -le $DOP ] 8 | do 9 | ./dbgen2 -f -dir /data -scale $SCALE -parallel $DOP -child $child > datagen_out.$child 2>&1 & 10 | child=`expr $child + 1` 11 | done 12 | wait 13 | ./dbgen2 -f -dir /data -scale $1 -update 1 > datagen_out.update 2>&1 14 | 15 | wc -l /data/*.csv |grep -i total > /tmp/results 16 | diff -w ../linecount_${SCALE}.req /tmp/results > gen_base_data.out 17 | [ -s gen_base_data.out ] && exit -1 18 | rm /tmp/results datagen_out.* 19 | -------------------------------------------------------------------------------- /code/tests/gen_update_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | cd temp_build 5 | if [ -f FAILED ] 6 | then 7 | exit 8 | fi 9 | rm -rf /data/s_*.csv 10 | ./dbgen2 -f -dir /data -update 1 > gen_update_data.out 2>&1 || exit -1 11 | cat - << _EOF_ > /tmp/goal 12 | 100 s_brand.csv 13 | 100 s_business_address.csv 14 | 100 s_call_center.csv 15 | 100 s_catalog.csv 16 | 100 s_catalog_order.csv 17 | 900 s_catalog_order_lineitem.csv 18 | 100 s_catalog_page.csv 19 | 100 s_catalog_promotional_item.csv 20 | 84 s_catalog_returns.csv 21 | 100 s_category.csv 22 | 100 s_class.csv 23 | 100 s_company.csv 24 | 100 s_customer.csv 25 | 100 s_division.csv 26 | 100 s_inventory.csv 27 | 100 s_item.csv 28 | 100 s_manager.csv 29 | 100 s_manufacturer.csv 30 | 100 s_market.csv 31 | 100 s_product.csv 32 | 100 s_promotion.csv 33 | 3 s_purchase.csv 34 | 15 s_purchase_lineitem.csv 35 | 100 s_reason.csv 36 | 100 s_store.csv 37 | 100 s_store_promotional_item.csv 38 | 2 s_store_returns.csv 39 | 100 s_subcategory.csv 40 | 100 s_subclass.csv 41 | 100 s_warehouse.csv 42 | 3 s_web_order.csv 43 | 27 s_web_order_lineitem.csv 44 | 100 s_web_page.csv 45 | 100 s_web_promotional_item.csv 46 | 3 s_web_returns.csv 47 | 100 s_web_site.csv 48 | 99400 s_zip_to_gmt.csv 49 | 103237 total 50 | _EOF_ 51 | wc -l /data/*.csv > /tmp/results 52 | diff -w /tmp/goal /tmp/results || exit -1 53 | rm /tmp/goal /tmp/results gen_update_data.out 54 | -------------------------------------------------------------------------------- /code/tests/itemv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_item; 2 | create table s_item as 3 | (select i_item_id item_item_id 4 | ,i_item_desc item_item_description 5 | ,i_current_price item_list_price 6 | ,i_wholesale_cost item_wholesale_cost 7 | ,i_manager_id item_manager_id 8 | ,i_size item_size 9 | ,i_formulation item_formulation 10 | ,i_color item_color 11 | ,i_units item_units 12 | ,i_container item_container 13 | from item 14 | where i_rec_end_date is null 15 | and rownum < 1000); 16 | -- I need the following statement because of a bug in dbgen that generates some duplicates in item 17 | delete from s_item where item_item_id in (select ITEM_ITEM_ID from (select ITEM_ITEM_ID ,count(*) cnt from s_item group by ITEM_ITEM_ID) where cnt > 1); 18 | -------------------------------------------------------------------------------- /code/tests/iv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_inventory; 2 | create table s_inventory as 3 | (select w_warehouse_id invn_warehouse_id 4 | ,i_item_id invn_item_id 5 | ,d_date invn_date 6 | ,inv_quantity_on_hand invn_qty_on_hand 7 | from inventory 8 | ,warehouse 9 | ,item 10 | ,date_dim 11 | where inv_warehouse_sk = w_warehouse_sk 12 | and inv_item_sk = i_item_sk 13 | and i_rec_end_date is null 14 | and inv_date_sk = d_date_sk 15 | and d_year = 2001 16 | and d_dom between 10 and 15 17 | ); 18 | delete from s_inventory where (invn_warehouse_id,invn_item_id,invn_date) in (select invn_warehouse_id,invn_item_id,invn_date from (select invn_warehouse_id,invn_item_id,invn_date,count(*) from s_inventory group by invn_warehouse_id,invn_item_id,invn_date having count(*) > 1)); 19 | -------------------------------------------------------------------------------- /code/tests/lf_cr.sql: -------------------------------------------------------------------------------- 1 | insert into catalog_returns (select * from crv); 2 | rollback; 3 | -------------------------------------------------------------------------------- /code/tests/lf_cs.sql: -------------------------------------------------------------------------------- 1 | insert into catalog_sales (select * from csv); 2 | rollback; 3 | 4 | -------------------------------------------------------------------------------- /code/tests/lf_sr.sql: -------------------------------------------------------------------------------- 1 | insert into store_returns (select * from srv); 2 | rollback; 3 | -------------------------------------------------------------------------------- /code/tests/lf_sr_t.sql: -------------------------------------------------------------------------------- 1 | drop table srv; 2 | create table srv as 3 | select d_date_sk sr_returned_date_sk 4 | ,t_time_sk sr_return_time_sk 5 | ,i_item_sk sr_item_sk 6 | ,c_customer_sk sr_customer_sk 7 | ,c_current_cdemo_sk sr_cdemo_sk 8 | ,c_current_hdemo_sk sr_hdemo_sk 9 | ,c_current_addr_sk sr_addr_sk 10 | ,s_store_sk sr_store_sk 11 | ,r_reason_sk sr_reason_sk 12 | ,sret_ticket_number sr_ticket_number 13 | ,sret_return_qty sr_return_quantity 14 | ,sret_return_amount sr_return_amt 15 | ,sret_return_tax sr_return_tax 16 | ,sret_return_amount + sret_return_tax sr_return_amt_inc_tax 17 | ,sret_return_fee sr_fee 18 | ,sret_return_ship_cost sr_return_ship_cost 19 | ,sret_refunded_cash sr_refunded_cash 20 | ,sret_reversed_charge sr_reversed_charde 21 | ,sret_store_credit sr_store_credit 22 | ,sret_return_amount+sret_return_tax+sret_return_fee 23 | -sret_refunded_cash-sret_reversed_charge-sret_store_credit sr_net_loss 24 | from s_store_returns_m left outer join date_dim on (sret_return_date = d_date) 25 | left outer join time_dim on (( cast(substr(sret_return_time,1,2) as integer)*3600 26 | +cast(substr(sret_return_time,4,2) as integer)*60 27 | +cast(substr(sret_return_time,7,2) as integer)) = t_time) 28 | left outer join item on (sret_item_id = i_item_id) 29 | left outer join customer on (sret_customer_id = c_customer_id) 30 | left outer join store on (sret_store_id = s_store_id) 31 | left outer join reason on (sret_reason_id = r_reason_id) 32 | where i_rec_end_date is NULL 33 | and s_rec_end_date is NULL; 34 | select count(*) from srv where sr_item_sk is null; 35 | select count(*) from s_store_returns_m; 36 | select count(*) from srv; 37 | -------------------------------------------------------------------------------- /code/tests/lf_ss.sql: -------------------------------------------------------------------------------- 1 | insert into store_sales (select * from ssv); 2 | rollback; 3 | -------------------------------------------------------------------------------- /code/tests/lf_wr.sql: -------------------------------------------------------------------------------- 1 | insert into web_returns (select * from wrv); 2 | rollback; 3 | -------------------------------------------------------------------------------- /code/tests/lf_ws.sql: -------------------------------------------------------------------------------- 1 | insert into web_sales (select * from wsv); 2 | rollback; 3 | 4 | -------------------------------------------------------------------------------- /code/tests/load_base_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | V_DATABASE=${DATABASE:-"tpcds"} # name of the database to be create 5 | V_DBMS=${DBMS:-"db2"} # dbms flavor to use 6 | # must match xx_setup.sh file name 7 | V_DATA_DIR=${DATA_DIR:-"/data"} # flat file directory 8 | DOP=${DOP:-"1"} 9 | 10 | if [ ! -f ${V_DBMS}_setup.sh ] 11 | then 12 | echo "Cannot find setup file for DBMS: ${V_DBMS}_setup.sh" 13 | exit 1 14 | fi 15 | 16 | . ${V_DBMS}_setup.sh 17 | 18 | cd temp_build 19 | 20 | if [ "$1" != "tbl" ] 21 | then 22 | cat tpcds.sql tpcds_source.sql > combined.sql 23 | create_schema $V_DATABASE combined.sql 24 | for f in ${V_DATA_DIR}/*.dat 25 | do 26 | tbl=`basename $f .dat` 27 | if [ $DOP -ne 1 ] 28 | then tbl=`echo $tbl |sed -e "s/_[0-9]_[0-9]//"` 29 | fi 30 | echo -n "$tbl: " 31 | load_table $f $tbl 32 | echo done 33 | done 34 | rm combined.sql 35 | else 36 | connect_to $V_DATABASE 37 | load_table ${V_DATA_DIR}/$2.dat $2 38 | fi 39 | -------------------------------------------------------------------------------- /code/tests/mysql_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # assumptions: 3 | # user tpcds 4 | # password tpcds 5 | # database tpcds exists (required for privilege settings, below) 6 | # privileges 7 | # global 8 | # file (to allow load data infile to work) 9 | # database: tpcds 10 | # all 11 | 12 | create_schema() 13 | { 14 | mysql -utpcds -ptpcds -e "drop database $1" > /dev/null 2>&1 15 | mysql -utpcds -ptpcds -e "create database $1" || exit -1 16 | mysql -utpcds -ptpcds -D$1 < $2 || exit -1 17 | } 18 | 19 | load_table() 20 | { 21 | mysql -utpcds -ptpcds -D$V_DATABASE -e "load data infile '$1' replace into table $2 fields terminated by '|'" 2>&1 22 | } 23 | 24 | connect_to() 25 | { 26 | return 27 | } 28 | 29 | activate_constraints() 30 | { 31 | count=0 32 | 33 | while read c 34 | do 35 | indcount="ind$count"; 36 | echo $c | 37 | awk -v indcount=$indcount '{print "create index ",indcount," on ",$3,$9,";"}' > /tmp/foo 38 | count=`expr $count + 1` 39 | indcount="ind$count" 40 | echo $c |awk -v indcount=$indcount '{print "create index ",indcount," on ",$11,$12,";"}' >> /tmp/foo 41 | count=`expr $count + 1` 42 | echo $c >> /tmp/foo 43 | run_query create_ri /tmp/foo 44 | done < $1 45 | 46 | return 47 | } 48 | 49 | run_query() 50 | { 51 | mysql -utpcds -ptpcds -Dtpcds 52 | } 53 | 54 | -------------------------------------------------------------------------------- /code/tests/promv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_promotion; 2 | create table s_promotion as 3 | (select P_PROMO_ID PROM_PROMOTION_ID 4 | ,d1.d_date PROM_START_DATE 5 | ,d2.d_date PROM_END_DATE 6 | ,P_COST PROM_COST 7 | ,P_RESPONSE_TARGET PROM_RESPONSE_TARGET 8 | ,P_PROMO_NAME PROM_PROMO_NAME 9 | ,P_CHANNEL_DMAIL PROM_CHANNEL_DMAIL 10 | ,P_CHANNEL_EMAIL PROM_CHANNEL_EMAIL 11 | ,P_CHANNEL_CATALOG PROM_CHANNEL_CATALOG 12 | ,P_CHANNEL_TV PROM_CHANNEL_TV 13 | ,P_CHANNEL_RADIO PROM_CHANNEL_RADIO 14 | ,P_CHANNEL_PRESS PROM_CHANNEL_PRESS 15 | ,P_CHANNEL_EVENT PROM_CHANNEL_EVENT 16 | ,P_CHANNEL_DEMO PROM_CHANNEL_DEMO 17 | ,P_CHANNEL_DETAILS PROM_CHANNEL_DETAILS 18 | ,P_PURPOSE PROM_PURPOSE 19 | ,P_DISCOUNT_ACTIVE PROM_DISCOUNT_ACTIVE 20 | from promotion left outer join date_dim d1 on P_START_DATE_SK = d1.d_date_sk 21 | left outer join date_dim d2 on P_END_DATE_SK = d2.d_date_sk 22 | where rownum < 100 23 | ); 24 | -------------------------------------------------------------------------------- /code/tests/ri.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | enforce_ri() { 5 | db2 connect to tpcds 6 | db2 "set integrity for $1 off no access cascade immediate to all tables " 2>&1 7 | db2 "set integrity for $1 immediate checked" 8 | db2 connect reset 9 | } 10 | 11 | cd temp_build 12 | if [ -f FAILED ] 13 | then 14 | exit 15 | fi 16 | 17 | . ~jms/db2profile 18 | if [ -n "$1" ] 19 | then 20 | awk "\$3 == \"$1\"" tpcds_ri.sql | 21 | tr -d ";" | 22 | while read ri 23 | do 24 | db2 "connect to tpcds" 25 | echo \"$ri\" 26 | db2 "connect reset" 27 | enforce_ri $1 28 | done 29 | else 30 | while read t 31 | do 32 | db2 db2stop 33 | db2 db2start 34 | awk "\$3 == \"$t\"" tpcds_ri.sql | 35 | tr -d ";" | 36 | while read ri 37 | do 38 | db2 "connect to tpcds" 39 | echo \"$ri\" 40 | db2 "connect reset" 41 | done 42 | enforce_ri $t 43 | done <<_EOF_ 44 | date_dim 45 | reason 46 | ship_mode 47 | income_band 48 | time_dim 49 | customer_address 50 | customer_demographics 51 | household_demographics 52 | customer 53 | promotion 54 | call_center 55 | catalog_page 56 | inventory 57 | item 58 | store 59 | warehouse 60 | web_site 61 | web_page 62 | catalog_returns 63 | catalog_sales 64 | store_returns 65 | store_sales 66 | web_returns 67 | web_sales 68 | _EOF_ 69 | fi 70 | -------------------------------------------------------------------------------- /code/tests/ri_base_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | V_DATABASE=${DATABASE:-"tpcds"} # name of the database to be create 5 | V_DBMS=${DBMS:-"db2"} # dbms flavor to use 6 | # must match xx_setup.sh file name 7 | V_DATA_DIR=${DATA_DIR:-"/data"} # flat file directory 8 | 9 | if [ ! -f ${V_DBMS}_setup.sh ] 10 | then 11 | echo "Cannot find setup file for DBMS: ${V_DBMS}_setup.sh" 12 | exit 1 13 | fi 14 | 15 | . ${V_DBMS}_setup.sh 16 | connect_to $V_DATABASE 17 | 18 | cd temp_build 19 | if [ -f FAILED ] 20 | then 21 | exit 22 | fi 23 | 24 | if [ -z "$1" ] 25 | then 26 | activate_constraints tpcds_ri.sql 27 | else 28 | run_query $V_DATABASE tpcds_ri.sql 29 | activate_constraints tpcds_ri.sql 30 | fi 31 | -------------------------------------------------------------------------------- /code/tests/rowcount_base_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | cd temp_build 5 | if [ -f FAILED ] 6 | then 7 | exit 8 | fi 9 | 10 | for f in /data/*.csv 11 | do 12 | tbl=`basename $f .csv` 13 | echo "select '$tbl', count(*) from $tbl;" 14 | done | 15 | mysql -utpcds -ptpcds -Dtpcds | 16 | grep -v count > /tmp/rowcount.out || exit -1 17 | diff /tmp/rowcount.out rowcount_${1}.req || exit -1 18 | rm -rf /tmp/rowcount.out /tmp/rowcount.req 19 | -------------------------------------------------------------------------------- /code/tests/sparseKeys.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $id:$ 3 | # $log:$ 4 | cd temp_build 5 | if [ -f FAILED ] 6 | then 7 | exit 8 | fi 9 | 10 | mysql -Dtpcds -uroot -pmysqlpasswd <<_EOF_ 11 | create index ss_cd on store_sales(ss_cdemo_sk); 12 | select count(distinct(ss_cdemo_sk)) as "unique keys" from store_sales; 13 | select min(cd_demo_sk) as "min key", max(cd_demo_sk) as "max key" from customer_demographics; 14 | select count(*) as "cd join" from store_sales where 15 | not exists (select cd_demo_sk from customer_demographics where 16 | ss_cdemo_sk = cd_demo_sk); 17 | drop index ss_cd on table store_sales; 18 | _EOF_ 19 | -------------------------------------------------------------------------------- /code/tests/storv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_store; 2 | create table s_store as 3 | select * from 4 | (select s_store_id stor_store_id 5 | --,stor_address_id 6 | --,stor_divison_id 7 | --,stor_opened_date 8 | ,d1.d_date stor_closed_date 9 | ,s_store_name stor_name 10 | --,stor_store_class 11 | ,s_number_employees stor_employees 12 | ,s_floor_space stor_floor_space 13 | ,s_hours stor_hours 14 | ,s_market_manager stor_market_manager 15 | ,s_manager stor_store_manager 16 | ,s_market_id stor_market_id 17 | ,s_geography_class stor_geography_class 18 | ,s_tax_precentage stor_tax_percentage 19 | from store 20 | ,date_dim d1 21 | where d_date_sk = s_closed_date_sk 22 | and s_rec_end_date is null) 23 | where rownum < 4; 24 | -------------------------------------------------------------------------------- /code/tests/table_option.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # created in response to bug 350 3 | # assumes data set has been built in /data 4 | cd temp_build 5 | if [ -f FAILED ] 6 | then 7 | exit 8 | fi 9 | 10 | . ~jms/db2profile 11 | if [ -z "$1" ] 12 | then 13 | for f in /data/*.csv 14 | do 15 | tbl=`basename $f .csv` 16 | ./dbgen2 -table $tbl -f 17 | sum $f $tbl.csv |awk '{print $1, $2}' > foo 18 | f1=`head -1 foo` 19 | f2=`tail -1 foo` 20 | if [ $f1 != $f2 ] 21 | then exit -1 22 | fi 23 | rm -f $tbl.csv foo 24 | done 25 | fi 26 | -------------------------------------------------------------------------------- /code/tests/test_list.sh: -------------------------------------------------------------------------------- 1 | # $id:$ 2 | # $log:$ 3 | # 4 | # usage: sh test_list.sh 5 | rm -rf temp_build 6 | if [ $# -ne 3 ] 7 | then 8 | echo "USAGE: test_list.sh " 9 | echo " where " 10 | echo " is the date stamp of the build to be tested" 11 | echo " is the scale factor to be built" 12 | echo " is the degree of parallelism to be used" 13 | exit -1 14 | fi 15 | SCALE=$2 16 | DOP=$3 17 | export SCALE DOP 18 | 19 | # baseline checks 20 | rm -f FAILED 21 | sh ./build_tools.sh $1 || sh fail.sh build_tools 22 | [ ! -f FAILED ] && sh ./gen_base_data.sh || sh fail.sh gen_base_data 23 | [ ! -f FAILED ] && sh ./load_base_data.sh || sh fail.sh load_base_data 24 | sh ./rowcount_base_data.sh $2 || sh fail.sh rowcount_base_data 25 | sh ./ri_base_data.sh || sh fail.sh ri_base_data 26 | sh ./ri_update_data.sh || sh fail.sh ri_update_data 27 | # bug fix checks 28 | sh table_option.sh > table_option.out 2>&1 || sh fail.sh table_option 29 | sh chunked_data.sh > chunked_data.out 2>&1 || sh fail.sh chunked_data 30 | sh -x ./cleanUP.sh 31 | -------------------------------------------------------------------------------- /code/tests/websv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_web_site; 2 | create table s_web_site as 3 | select * from 4 | (select web_site_id wsit_web_site_id 5 | ,d1.d_date wsit_open_date 6 | ,d2.d_date wsit_closed_date 7 | ,web_name wsit_site_name 8 | ,web_class wsit_site_class 9 | ,web_manager wsit_site_manager 10 | ,web_tax_percentage wsit_tax_percentage 11 | from web_site 12 | ,date_dim d1 13 | ,date_dim d2 14 | where web_open_date_sk = d1.d_date_sk 15 | and web_close_date_sk = d2.d_date_sk 16 | and web_rec_end_date is null) 17 | where rownum < 6; 18 | 19 | -------------------------------------------------------------------------------- /code/tests/webv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_web_page; 2 | create table s_web_page as 3 | (select WP_WEB_PAGE_ID WPAG_WEB_PAGE_ID 4 | ,d1.d_date WPAG_CREATE_DATE 5 | ,d2.d_date WPAG_ACCESS_DATE 6 | ,WP_AUTOGEN_FLAG WPAG_AUTOGEN_FLAG 7 | ,WP_URL WPAG_URL 8 | ,WP_TYPE WPAG_TYPE 9 | ,WP_CHAR_COUNT WPAG_CHAR_COUNT 10 | ,WP_LINK_COUNT WPAG_LINK_COUNT 11 | ,WP_IMAGE_COUNT WPAG_IMAGE_COUNT 12 | ,WP_MAX_AD_COUNT WPAG_MAX_AD_COUNT 13 | from web_page left outer join date_dim d1 on wp_creation_date_sk = d1.d_date_sk 14 | left outer join date_dim d2 on wp_access_date_sk = d2.d_date_sk 15 | where wp_rec_end_date is null -- need this to eliminate duplicates 16 | and rownum < 10 17 | ); 18 | -------------------------------------------------------------------------------- /code/tests/wrhsv_up.sql: -------------------------------------------------------------------------------- 1 | drop table s_warehouse; 2 | create table s_warehouse as 3 | (select W_WAREHOUSE_ID WRHS_WAREHOUSE_ID 4 | ,W_WAREHOUSE_name WRHS_WAREHOUSE_DESC 5 | ,W_WAREHOUSE_SQ_FT WRHS_WAREHOUSE_SQ_FT 6 | from warehouse 7 | where rownum < 10); 8 | -------------------------------------------------------------------------------- /code/tools/Cygwin Tools.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 5 | Midl 6 | CustomBuild 7 | 8 | 9 | _SelectedFiles;$(BisonDependsOn) 11 | 12 | 13 | 14 | bison -y -d [inputs] -o y.tab.c 15 | y.tab.c;y.tab.h 16 | Generating parser... 17 | 18 | 19 | 21 | Midl 22 | CustomBuild 23 | 24 | 25 | _SelectedFiles;$(FlexDependsOn) 27 | 28 | 29 | 30 | flex -otokenizer.c [inputs] 31 | tokenizer.c 32 | Generating scanner... 33 | 34 | 35 | -------------------------------------------------------------------------------- /code/tools/HISTORY: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | 37 | -------------------------------------------------------------------------------- /code/tools/How_To_Guide-DS-V2.0.0.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/tools/How_To_Guide-DS-V2.0.0.docx -------------------------------------------------------------------------------- /code/tools/How_To_Guide.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/tools/How_To_Guide.doc -------------------------------------------------------------------------------- /code/tools/QGEN.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/tools/QGEN.doc -------------------------------------------------------------------------------- /code/tools/ansi.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = "top %d"; 37 | define __LIMITC = ""; 38 | -------------------------------------------------------------------------------- /code/tools/call_center.dat: -------------------------------------------------------------------------------- 1 | 1|AAAAAAAABAAAAAAA|1998-01-01|||2450952|NY Metro|large|2|1138|8AM-4PM|Bob Belcher|6|More than other authori|Shared others could not count fully dollars. New members ca|Julius Tran|3|pri|6|cally|730|Ash Hill|Boulevard|Suite 0|Midway|Williamson County|TN|31904|United States|-5|0.11| 2 | 2|AAAAAAAACAAAAAAA|1998-01-01|2000-12-31||2450806|Mid Atlantic|medium|6|2268|8AM-8AM|Felipe Perkins|2|A bit narrow forms matter animals. Consist|Largely blank years put substantially deaf, new others. Question|Julius Durham|5|anti|1|ought|984|Center Hill|Way|Suite 70|Midway|Williamson County|TN|31904|United States|-5|0.12| 3 | 3|AAAAAAAACAAAAAAA|2001-01-01|||2450806|Mid Atlantic|medium|6|4134|8AM-4PM|Mark Hightower|2|Wrong troops shall work sometimes in a opti|Largely blank years put substantially deaf, new others. Question|Julius Durham|1|ought|2|able|984|Center Hill|Way|Suite 70|Midway|Williamson County|TN|31904|United States|-5|0.01| 4 | 4|AAAAAAAAEAAAAAAA|1998-01-01|2000-01-01||2451063|North Midwest|medium|1|649|8AM-4PM|Larry Mccray|2|Dealers make most historical, direct students|Rich groups catch longer other fears; future,|Matthew Clifton|4|ese|3|pri|463|Pine Ridge|RD|Suite U|Midway|Williamson County|TN|31904|United States|-5|0.05| 5 | 5|AAAAAAAAEAAAAAAA|2000-01-02|2001-12-31||2451063|North Midwest|small|3|795|8AM-8AM|Larry Mccray|2|Dealers make most historical, direct students|Blue, due beds come. Politicians would not make far thoughts. Specifically new horses partic|Gary Colburn|4|ese|3|pri|463|Pine Ridge|RD|Suite U|Midway|Williamson County|TN|31904|United States|-5|0.12| 6 | 6|AAAAAAAAEAAAAAAA|2002-01-01|||2451063|North Midwest|medium|7|3514|8AM-4PM|Larry Mccray|5|Silly particles could pro|Blue, due beds come. Politicians would not make far thoughts. Specifically new horses partic|Gary Colburn|5|anti|3|pri|463|Pine Ridge|RD|Suite U|Midway|Williamson County|TN|31904|United States|-5|0.11| 7 | -------------------------------------------------------------------------------- /code/tools/checksum.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /code/tools/db2.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = ""; 37 | define __LIMITC = " fetch first %d rows only"; 38 | -------------------------------------------------------------------------------- /code/tools/dbgen2.bsc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/tools/dbgen2.bsc -------------------------------------------------------------------------------- /code/tools/dbgen_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef DBGEN_VERSION_H 37 | #define DBGEN_VERSION_H 38 | 39 | #define RS_VERSION_LENGTH 100 40 | #define RS_CMDLINARGS_LENGTH 200 41 | 42 | struct DBGEN_VERSION_TBL { 43 | char szVersion[RS_VERSION_LENGTH + 1]; 44 | char szDate[26]; 45 | char szTime[26]; 46 | char szCmdLineArgs[RS_CMDLINARGS_LENGTH + 1]; 47 | }; 48 | 49 | int mk_dbgen_version(void *pDest, ds_key_t kIndex); 50 | int pr_dbgen_version(void *pSrc); 51 | int ld_dbgen_version(void *pSrc); 52 | #endif 53 | -------------------------------------------------------------------------------- /code/tools/dcgram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | d_idx_t *AddDistribution(distindex_t *pDistIndex, char *szName); 37 | int ProcessSet (char *stmt, token_t * tokens); 38 | int ProcessDistribution (char *stmt, token_t * tokens); 39 | int ProcessTypes (char *stmt, token_t * tokens); 40 | int ProcessInclude (char *stmt, token_t * tokens); 41 | int ProcessOther (char *stmt, token_t * tokens); 42 | int ProcessNames (char *stmt, token_t * tokens); 43 | -------------------------------------------------------------------------------- /code/tools/eval.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef EVAL_H 37 | #define EVAL_H 38 | #endif 39 | -------------------------------------------------------------------------------- /code/tools/grammar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef GRAMMAR_H 37 | #define GRAMMAR_H 38 | 39 | typedef struct TOKEN_T { 40 | int index; 41 | char word[40]; 42 | int (*handler)(char *s, struct TOKEN_T *t); 43 | } token_t; 44 | 45 | #define COMMENT_CHAR '-' 46 | #define STMT_END ';' 47 | int ParseFile(char *szPath); 48 | int FindToken(char *name); 49 | void SetTokens(token_t *t); 50 | char *ProcessStr(char *stmt, token_t *pTokens); 51 | char *SafeStrtok(char *string, char *delims); 52 | extern token_t *pTokens; 53 | 54 | #endif /* GRAMMAR_H */ 55 | -------------------------------------------------------------------------------- /code/tools/grammar.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c2c20f4c-74bc-4acf-8e35-65b550bfdf7c} 6 | h;hpp;hxx;hm;inl 7 | 8 | 9 | {5e7f3e5d-badd-48f6-8b1c-bae7c8ae694b} 10 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 11 | 12 | 13 | {5e96a16d-9c09-45f4-b0a2-bdd0b7f961fb} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /code/tools/keywords.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef KEYWORDS_H 37 | #define KEYWORDS_H 38 | #include "expr.h" 39 | typedef struct KEYWORD_T { 40 | char *szName; 41 | int nFlags; 42 | int nIndex; 43 | } keyword_t; 44 | 45 | /* flag values for keywords */ 46 | #define KYWD_SUBSTITUION 0x01 /* this is actually a pre-defined substitution */ 47 | 48 | void InitKeywords(); 49 | int FindKeyword(char *szWord); 50 | char *KeywordText(int nKeyword); 51 | expr_t *getKeywordValue(int nIndex); 52 | #endif 53 | -------------------------------------------------------------------------------- /code/tools/load.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef LOAD_H 37 | #define LOAD_H 38 | #include "tables.h" 39 | void load_init(void); 40 | void load_close(void); 41 | int create_table(int nTable); 42 | #endif 43 | -------------------------------------------------------------------------------- /code/tools/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef MISC_H 37 | #define MISC_H 38 | int prep_direct(int dialect); 39 | int close_direct(int dialect); 40 | int pick_tbl(char *dname); 41 | int itostr(char *dest, int i); 42 | int char_op(char *dest, int op, char *s1, char *s2); 43 | char *gen_text(char *dest, int min, int max, int stream); 44 | int int_op(int *dest, int op, int arg1, int arg2); 45 | 46 | char *env_config (char *var, char *dflt); 47 | int a_rnd (int min, int max, int column, char *dest); 48 | #endif 49 | -------------------------------------------------------------------------------- /code/tools/mkheader.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {2ab3c578-9e71-41c8-8dcb-110c9cfae229} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {979aec80-df35-4844-be69-b0932782c436} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {d6773c89-0cd4-43f5-a4b9-be20a89c338a} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /code/tools/netezza.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = ""; 37 | define __LIMITC = "limit %d"; 38 | -------------------------------------------------------------------------------- /code/tools/nulls.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | int nullCheck(int nColumn); 37 | void nullSet(ds_key_t *pDest, int nStream); 38 | 39 | -------------------------------------------------------------------------------- /code/tools/oracle.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = "select * from ("; 36 | define __LIMITB = ""; 37 | define __LIMITC = " ) where rownum <= %d"; 38 | -------------------------------------------------------------------------------- /code/tools/parallel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef PARALLEL_H 37 | #define PARALLEL_H 38 | int split_work(int nTable, ds_key_t *pkFirstRow, ds_key_t *pkRowCount); 39 | int row_stop(int tbl); 40 | int row_skip(int tbl, ds_key_t count); 41 | #endif /* PARALLEL_H */ 42 | -------------------------------------------------------------------------------- /code/tools/porting.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | /********************* 37 | ** Define some routines that, while common, are not ANSI standard 38 | *********************/ 39 | #include "config.h" 40 | #include "porting.h" 41 | #include 42 | 43 | #ifndef strdup 44 | char *strdup(const char *szSrc) 45 | { 46 | char *szResult; 47 | 48 | szResult = (char *)malloc(strlen(szSrc) + 1); 49 | if (szResult) 50 | { 51 | strcpy(szResult, szSrc); 52 | } 53 | 54 | return(szResult); 55 | } 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /code/tools/query_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | void GenerateQuery(FILE *pOutFile, FILE *pLogFile, int nQuery); 37 | void PrintTemplate(template_t *t); 38 | void PrintQuery(FILE *pOutput, template_t *t); 39 | substitution_t *defineSubstitution(template_t *pQuery, char *szSubstitutionName, expr_t *pDefinition); 40 | -------------------------------------------------------------------------------- /code/tools/release.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef RELEASE_H 37 | #define RELEASE_H 38 | 39 | /*** 40 | *** RELEASE INFORMATION 41 | ***/ 42 | #define VERSION 2 43 | #define RELEASE 11 44 | #define MODIFICATION 0 45 | #define PATCH "" 46 | #define COPYRIGHT "Transaction Processing Performance Council (TPC)" 47 | #define C_DATES "2001 - 2019" 48 | 49 | int printReleaseInfo(char *param, char *val); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /code/tools/s_brand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef s_brand_H 37 | #define s_brand_H 38 | 39 | #define RS_BRAND_NAME 30 40 | #define BRAND_SUBCLASS_COUNT 5 /* number of subrands per brand */ 41 | 42 | struct S_BRAND_TBL { 43 | ds_key_t brand_id; 44 | ds_key_t subclass_id; 45 | ds_key_t manager_id; 46 | ds_key_t manufacturer_id; 47 | char brand_name[RS_BRAND_NAME + 1]; 48 | }; 49 | 50 | int mk_s_brand(void *pDest, ds_key_t kIndex); 51 | int pr_s_brand(void *pSrc); 52 | int ld_s_brand(void *pSrc); 53 | #endif 54 | -------------------------------------------------------------------------------- /code/tools/s_call_center.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_CALL_CENTER_H 37 | #define S_CALL_CENTER_H 38 | 39 | int mk_s_call_center(void *row,ds_key_t kIndex); 40 | int pr_s_call_center(void *pSrc); 41 | int ld_s_call_center(void *pSrc); 42 | #endif 43 | -------------------------------------------------------------------------------- /code/tools/s_catalog_page.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_CATALOG_PAGE_H 37 | #define S_CATALOG_PAGE_H 38 | int mk_s_catalog_page(void *pDest, ds_key_t kIndex); 39 | int pr_s_catalog_page(void *pSrc); 40 | int ld_s_catalog_page(void *pSrc); 41 | int vld_s_catalog_page(int nTable, ds_key_t kRow, int *Permutation); 42 | #endif 43 | -------------------------------------------------------------------------------- /code/tools/s_class.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_CLASS_H 37 | #define S_CLASS_H 38 | 39 | #define RS_CLASS_DESC 50 40 | #define S_CLASS_DESC_MIN 35 41 | 42 | /* 43 | * S_CLASS table structure 44 | */ 45 | struct S_CLASS_TBL { 46 | ds_key_t id; 47 | ds_key_t subcat_id; 48 | char desc[RS_CLASS_DESC + 1]; 49 | }; 50 | 51 | int mk_s_class(void *pDest, ds_key_t kIndex); 52 | int pr_s_class(void *pSrc); 53 | int ld_s_class(void *pSrc); 54 | #endif 55 | -------------------------------------------------------------------------------- /code/tools/s_company.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_COMPANY_H 37 | #define S_COMPANY_H 38 | 39 | #define RS_COMPANY_NAME 50 40 | 41 | /* 42 | * S_COMPANY table structure 43 | */ 44 | struct S_COMPANY_TBL { 45 | ds_key_t company_id; 46 | char company_name[RS_COMPANY_NAME + 1]; 47 | }; 48 | 49 | int mk_s_company(void *pDest, ds_key_t kIndex); 50 | int pr_s_company(void *pSrc); 51 | int ld_s_company(void *pSrc); 52 | #endif 53 | -------------------------------------------------------------------------------- /code/tools/s_customer_address.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_BUSINESS_ADDRESS_H 37 | #define S_BUSINESS_ADDRESS_H 38 | 39 | 40 | int pr_s_customer_address(void *pSrc); 41 | int ld_s_customer_address(void *pSrc); 42 | int vld_s_customer_address(int nTable, ds_key_t kRow, int *Permutation); 43 | #endif 44 | -------------------------------------------------------------------------------- /code/tools/s_division.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_DIVISION_H 37 | #define S_DIVISION_H 38 | 39 | #define RS_DIVISION_NAME 40 40 | #define RS_DIVISION_COMPANY_NAME 40 41 | #define DIVISIONS_PER_COMPANY 4 42 | 43 | struct S_DIVISION_TBL { 44 | ds_key_t id; 45 | char name[RS_DIVISION_NAME + 1]; 46 | ds_key_t company; 47 | char szCompanyName[RS_DIVISION_COMPANY_NAME + 1]; 48 | }; 49 | 50 | int mk_s_division(void *pDest, ds_key_t kIndex); 51 | int pr_s_division(void *pSrc); 52 | int ld_s_division(void *pSrc); 53 | #endif 54 | -------------------------------------------------------------------------------- /code/tools/s_item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_ITEM_H 37 | #define S_ITEM_H 38 | 39 | int mk_s_item(void *row, ds_key_t kIndex); 40 | int pr_s_item(void *pSrc); 41 | int ld_s_item(void *pSrc); 42 | int vld_s_item(int nTable, ds_key_t kIndex, int *Permutation); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /code/tools/s_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_MANAGER_H 37 | #define S_MANAGER_H 38 | 39 | #define RS_S_MANAGER_NAME 500 40 | 41 | struct S_MANAGER_TBL { 42 | ds_key_t id; 43 | char name[RS_S_MANAGER_NAME + 1]; 44 | }; 45 | 46 | int mk_s_manager(void *pDest, ds_key_t kIndex); 47 | int pr_s_manager(void *pSrc); 48 | int ld_s_manager(void *pSrc); 49 | #endif 50 | -------------------------------------------------------------------------------- /code/tools/s_manufacturer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_MANUFACTURER_H 37 | #define S_MANUFACTURER_H 38 | 39 | #define RS_S_MANUFACTURER_NAME 50 40 | 41 | struct S_MANUFACTURER_TBL { 42 | ds_key_t id; 43 | char name [RS_S_MANUFACTURER_NAME + 1]; 44 | }; 45 | 46 | int mk_s_manufacturer(void *pDest, ds_key_t kIndex); 47 | int pr_s_manufacturer(void *pSrc); 48 | int ld_s_manufacturer(void *pSrc); 49 | #endif 50 | -------------------------------------------------------------------------------- /code/tools/s_market.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef s_market_H 37 | #define s_market_H 38 | 39 | #define RS_S_MARKET_CLASS_NAME 50 40 | #define RS_S_MARKET_CLASS_DESC 100 41 | 42 | struct S_MARKET_TBL { 43 | ds_key_t id; 44 | char class_name[RS_S_MARKET_CLASS_NAME + 1]; 45 | char desc[RS_S_MARKET_CLASS_DESC + 1]; 46 | ds_key_t manager_id; 47 | }; 48 | 49 | int mk_s_market(void *pDest, ds_key_t kIndex); 50 | int pr_s_market(void *pSrc); 51 | int ld_s_market(void *pSrc); 52 | #endif 53 | -------------------------------------------------------------------------------- /code/tools/s_product.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_PRODUCT_H 37 | #define S_PRODUCT_H 38 | 39 | #define RS_S_PRODUCT_NAME 50 40 | 41 | struct S_PRODUCT_TBL { 42 | char id[RS_BKEY + 1]; 43 | char brand_id[RS_BKEY + 1]; 44 | char name[RS_S_PRODUCT_NAME + 1]; 45 | char* type; 46 | }; 47 | 48 | int mk_s_product(void *pDest, ds_key_t kIndex); 49 | int pr_s_product(void *pSrc); 50 | int ld_s_product(void *pSrc); 51 | #endif 52 | -------------------------------------------------------------------------------- /code/tools/s_promotion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_PROMOTION_H 37 | #define S_PROMOTION_H 38 | 39 | int mk_s_promotion(void *pRow, ds_key_t kIndex); 40 | int pr_s_promotion(void *pSrc); 41 | int ld_s_promotion(void *pSrc); 42 | int vld_s_promotion(int nTable, ds_key_t kIndex, int *Permutation); 43 | #endif 44 | -------------------------------------------------------------------------------- /code/tools/s_reason.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef s_reason_H 37 | #define s_reason_H 38 | 39 | #define RS_S_REASON_DESC 200 40 | 41 | struct S_REASON_TBL { 42 | ds_key_t kID; 43 | char szDesc[RS_S_REASON_DESC + 1]; 44 | }; 45 | 46 | int mk_s_reason(void *pDest, ds_key_t kIndex); 47 | int pr_s_reason(void *pSrc); 48 | int ld_s_reason(void *pSrc); 49 | #endif 50 | -------------------------------------------------------------------------------- /code/tools/s_store.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_STORE_H 37 | #define S_STORE_H 38 | int mk_s_store(void *row, ds_key_t kIndex); 39 | int pr_s_store(void *pSrc); 40 | int ld_s_store(void *pSrc); 41 | #endif 42 | -------------------------------------------------------------------------------- /code/tools/s_store_promotional_item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_STORE_PROMOTIONAL_ITEM_H 37 | #define S_STORE_PROMOTIONAL_ITEM_H 38 | 39 | struct S_STORE_PROMOTIONAL_ITEM_TBL { 40 | ds_key_t promotion_id; 41 | ds_key_t item_id; 42 | ds_key_t store_id; 43 | }; 44 | 45 | int mk_s_store_promotional_item(void *pDest, ds_key_t kIndex); 46 | int pr_s_store_promotional_item(void *pSrc); 47 | int ld_s_store_promotional_item(void *pSrc); 48 | #endif 49 | -------------------------------------------------------------------------------- /code/tools/s_store_returns.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_STORE_RETURNS_H 37 | #define S_STORE_RETURNS_H 38 | #include "pricing.h" 39 | 40 | struct S_STORE_RETURNS_TBL { 41 | date_t dtReturnDate; 42 | ds_key_t kReturnTime; 43 | ds_pricing_t Pricing; 44 | ds_key_t kReasonID; 45 | 46 | }; 47 | 48 | int mk_s_store_returns(void *pDest, ds_key_t kIndex); 49 | int pr_s_store_returns(void *pSrc); 50 | int ld_s_store_returns(void *pSrc); 51 | #endif 52 | -------------------------------------------------------------------------------- /code/tools/s_subcategory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_SUBCATEGORY_H 37 | #define S_SUBCATEGORY_H 38 | 39 | #define RS_S_SBCT_NAME 30 40 | #define RS_S_SBCT_DESC 100 41 | 42 | struct S_SUBCATEGORY_TBL { 43 | ds_key_t kID; 44 | ds_key_t kCategoryID; 45 | char szName[RS_S_SBCT_NAME + 1]; 46 | char szDesc[RS_S_SBCT_DESC + 1]; 47 | }; 48 | 49 | int mk_s_subcategory(void *pDest, ds_key_t kIndex); 50 | int pr_s_subcategory(void *pSrc); 51 | int ld_s_subcategory(void *pSrc); 52 | #endif 53 | -------------------------------------------------------------------------------- /code/tools/s_subclass.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_SUBCLASS_H 37 | #define S_SUBCLASS_H 38 | 39 | #define RS_S_SUBC_NAME 30 40 | #define RS_S_SUBC_DESC 100 41 | 42 | struct S_SUBCLASS_TBL { 43 | ds_key_t kID; 44 | ds_key_t kClassID; 45 | char szName[RS_S_SUBC_NAME + 1]; 46 | char szDesc[RS_S_SUBC_DESC + 1]; 47 | }; 48 | 49 | int mk_s_subclass(void *pDest, ds_key_t kIndex); 50 | int pr_s_subclass(void *pSrc); 51 | int ld_s_subclass(void *pSrc); 52 | #endif 53 | -------------------------------------------------------------------------------- /code/tools/s_warehouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_WAREHOUSE_H 37 | #define S_WAREHOUSE_H 38 | 39 | int mk_s_warehouse(void *pRow, ds_key_t kIndex); 40 | int pr_s_warehouse(void *pSrc); 41 | int ld_s_warehouse(void *pSrc); 42 | #endif 43 | -------------------------------------------------------------------------------- /code/tools/s_web_page.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_WEB_PAGE_H 37 | #define S_WEB_PAGE_H 38 | int mk_s_web_page(void *pRow, ds_key_t kIndex); 39 | int pr_s_web_page(void *pSrc); 40 | int ld_s_web_page(void *pSrc); 41 | int vld_s_web_page(int nTable, ds_key_t kIndex, int *Permutation); 42 | #endif 43 | -------------------------------------------------------------------------------- /code/tools/s_web_promotional_item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_WEB_PROMOTIONAL_ITEM_H 37 | #define S_WEB_PROMOTIONAL_ITEM_H 38 | 39 | struct S_WEB_PROMOTIONAL_ITEM_TBL { 40 | ds_key_t kSiteID; 41 | ds_key_t kPageID; 42 | ds_key_t kItemID; 43 | ds_key_t kPromotionID; 44 | }; 45 | 46 | int mk_s_web_promotional_item(void *pDest, ds_key_t kIndex); 47 | int pr_s_web_promotional_item(void *pSrc); 48 | int ld_s_web_promotional_item(void *pSrc); 49 | #endif 50 | -------------------------------------------------------------------------------- /code/tools/s_web_site.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_WEB_SITE_H 37 | #define S_WEB_SITE_H 38 | 39 | int pr_s_web_site(void *pSrc); 40 | int ld_s_web_site(void *pSrc); 41 | #endif 42 | -------------------------------------------------------------------------------- /code/tools/s_zip_to_gmt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef S_ZIP_H 37 | #define S_ZIP_H 38 | 39 | struct S_ZIP_GMT_TBL { 40 | char szZip[RS_ZIPG_ZIP + 1]; 41 | int nGMTOffset; 42 | }; 43 | 44 | int mk_s_zip(void *pDest, ds_key_t kIndex); 45 | int pr_s_zip(void *pSrc); 46 | int ld_s_zip(void *pSrc); 47 | int vld_s_zip(int nTable, ds_key_t kRow, int *Permutation); 48 | #endif 49 | -------------------------------------------------------------------------------- /code/tools/sparse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | int initSparseKeys(int nTable); /* populate the set of valid keys */ 37 | ds_key_t randomSparseKey(int nTable, int nColumn); /* select a random sparse key */ 38 | -------------------------------------------------------------------------------- /code/tools/tables.h: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS IS A GENERATED FILE 3 | * SEE COLUMNS.LIST 4 | */ 5 | #ifndef TABLES_H 6 | #define TABLES_H 7 | #define CALL_CENTER 0 8 | #define ITEM 1 9 | #define CUSTOMER_ADDRESS 2 10 | #define CUSTOMER_DEMOGRAPHICS 3 11 | #define HOUSEHOLD_DEMOGRAPHICS 4 12 | #define CUSTOMER 5 13 | #define CATALOG_PAGE 6 14 | #define CATALOG_RETURNS 7 15 | #define CATALOG_SALES 8 16 | #define DATE 9 17 | #define INCOME_BAND 10 18 | #define INVENTORY 11 19 | #define PROMOTION 12 20 | #define REASON 13 21 | #define SHIP_MODE 14 22 | #define STORE 15 23 | #define STORE_RETURNS 16 24 | #define STORE_SALES 17 25 | #define TIME 18 26 | #define WAREHOUSE 19 27 | #define WEB_PAGE 20 28 | #define WEB_RETURNS 21 29 | #define WEB_SALES 22 30 | #define WEB_SITE 23 31 | #define DBGEN_VERSION 24 32 | #define S_BRAND 25 33 | #define S_CUSTOMER_ADDRESS 26 34 | #define S_CALL_CENTER 27 35 | #define S_CATALOG 28 36 | #define S_CATALOG_ORDER 29 37 | #define S_CATALOG_ORDER_LINEITEM 30 38 | #define S_CATALOG_PAGE 31 39 | #define S_CATALOG_PROMOTIONAL_ITEM 32 40 | #define S_CATALOG_RETURNS 33 41 | #define S_CATEGORY 34 42 | #define S_CLASS 35 43 | #define S_COMPANY 36 44 | #define S_CUSTOMER 37 45 | #define S_DIVISION 38 46 | #define S_INVENTORY 39 47 | #define S_ITEM 40 48 | #define S_MANAGER 41 49 | #define S_MANUFACTURER 42 50 | #define S_MARKET 43 51 | #define S_PRODUCT 44 52 | #define S_PROMOTION 45 53 | #define S_PURCHASE 46 54 | #define S_PURCHASE_LINEITEM 47 55 | #define S_REASON 48 56 | #define S_STORE 49 57 | #define S_STORE_PROMOTIONAL_ITEM 50 58 | #define S_STORE_RETURNS 51 59 | #define S_SUBCATEGORY 52 60 | #define S_SUBCLASS 53 61 | #define S_WAREHOUSE 54 62 | #define S_WEB_ORDER 55 63 | #define S_WEB_ORDER_LINEITEM 56 64 | #define S_WEB_PAGE 57 65 | #define S_WEB_PROMOTIONAL_ITEM 58 66 | #define S_WEB_RETURNS 59 67 | #define S_WEB_SITE 60 68 | #define S_ZIPG 61 69 | #define PSEUDO_TABLE_START 62 70 | /* PSEUDO TABLES from here on; used in hierarchies */ 71 | #define ITEM_BRAND 62 72 | #define ITEM_CLASS 63 73 | #define ITEM_CATEGORY 64 74 | #define DIVISIONS 65 75 | #define COMPANY 66 76 | #define CONCURRENT_WEB_SITES 67 77 | #define ACTIVE_CITIES 68 78 | #define ACTIVE_COUNTIES 69 79 | #define ACTIVE_STATES 70 80 | #define MAX_TABLE 70 81 | #endif 82 | -------------------------------------------------------------------------------- /code/tools/tpcds.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/tools/tpcds.idx -------------------------------------------------------------------------------- /code/tools/tpcds.wam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/dsb/ec9a156ceee923db1114cbe388f6183b53d49787/code/tools/tpcds.wam -------------------------------------------------------------------------------- /code/tools/tpcds_20080910.sum: -------------------------------------------------------------------------------- 1 | 64596 2 /data/call_center.dat 2 | 48360 1594 /data/catalog_page.dat 3 | 45145 20878 /data/catalog_returns.dat 4 | 30332 288975 /data/catalog_sales.dat 5 | 07662 5374 /data/customer_address.dat 6 | 30099 12900 /data/customer.dat 7 | 42736 78770 /data/customer_demographics.dat 8 | 48793 10076 /data/date_dim.dat 9 | 31157 1 /data/dbgen_version.dat 10 | 38653 1 /data/delete_1.dat 11 | 16797 149 /data/household_demographics.dat 12 | 37381 1 /data/income_band.dat 13 | 52107 230880 /data/inventory.dat 14 | 05457 1 /data/inventory_delete_1.dat 15 | 64120 4934 /data/item.dat 16 | 38824 37 /data/promotion.dat 17 | 63826 2 /data/reason.dat 18 | 22734 1 /data/s_call_center_1.dat 19 | 62338 114 /data/s_catalog_order_1.dat 20 | 27175 579 /data/s_catalog_order_lineitem_1.dat 21 | 27728 21 /data/s_catalog_page_1.dat 22 | 34808 113 /data/s_catalog_returns_1.dat 23 | 48322 1531 /data/s_customer_1.dat 24 | 38831 3 /data/s_customer_address_1.dat 25 | 12464 2 /data/ship_mode.dat 26 | 02088 13069 /data/s_inventory_1.dat 27 | 48037 87 /data/s_item_1.dat 28 | 36940 1 /data/s_promotion_1.dat 29 | 61285 140 /data/s_purchase_1.dat 30 | 60237 1278 /data/s_purchase_lineitem_1.dat 31 | 33907 1 /data/s_store_1.dat 32 | 64116 152 /data/s_store_returns_1.dat 33 | 51622 4 /data/store.dat 34 | 39326 31944 /data/store_returns.dat 35 | 46816 379342 /data/store_sales.dat 36 | 55603 1 /data/s_warehouse_1.dat 37 | 20816 43 /data/s_web_order_1.dat 38 | 12255 317 /data/s_web_order_lineitem_1.dat 39 | 46413 1 /data/s_web_page_1.dat 40 | 33863 45 /data/s_web_returns_1.dat 41 | 20753 1 /data/s_web_site_1.dat 42 | 09210 971 /data/s_zip_to_gmt_1.dat 43 | 58143 4989 /data/time_dim.dat 44 | 18256 1 /data/warehouse.dat 45 | 10140 6 /data/web_page.dat 46 | 07260 9577 /data/web_returns.dat 47 | 63256 143436 /data/web_sales.dat 48 | 30904 9 /data/web_site.dat 49 | -------------------------------------------------------------------------------- /code/tools/utility.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include "porting.h" 3 | #include "utility.h" 4 | 5 | unsigned int addIntToHash(unsigned int hash, int val) 6 | { 7 | return (hash * HASH_MULTIPLIER + val) % MAXINT; 8 | } 9 | 10 | int intcmp(const void *aa, const void *bb) 11 | { 12 | const int *a = aa, *b = bb; 13 | return (*a < *b) ? -1 : (*a > *b); 14 | } 15 | 16 | int keycmp(const void *aa, const void *bb) 17 | { 18 | const ds_key_t *a = aa, *b = bb; 19 | return (*a < *b) ? -1 : (*a > *b); 20 | } -------------------------------------------------------------------------------- /code/tools/utility.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef UTILITY_H 37 | #define UTILITY_H 38 | 39 | #define HASH_MULTIPLIER 2654435761 40 | 41 | unsigned int addIntToHash(unsigned int hash, int val); 42 | int intcmp(const void *aa, const void *bb); 43 | int keycmp(const void *aa, const void *bb); 44 | 45 | #endif -------------------------------------------------------------------------------- /code/tools/validate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef VALIDATE_H 37 | #define VALIDATE_H 38 | #include "config.h" 39 | #include "porting.h" 40 | 41 | int validateGeneric(int nTable, ds_key_t kRow, int *Permute); 42 | void printValidation(int nTable, ds_key_t kRow); 43 | int validateSCD(int nTable, ds_key_t kRow, int *Permutation); 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /code/tools/w_income_band.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | /* 37 | * INCOME_BAND table structure 38 | */ 39 | struct W_INCOME_BAND_TBL { 40 | int ib_income_band_id; 41 | int ib_lower_bound; 42 | int ib_upper_bound; 43 | }; 44 | 45 | int mk_w_income_band(void *pDest, ds_key_t kIndex); 46 | int pr_w_income_band(void *pSrc); 47 | int ld_w_income_band(void *pSrc); 48 | 49 | -------------------------------------------------------------------------------- /code/tools/w_inventory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | /* 37 | * INVENTORY table structure 38 | */ 39 | struct W_INVENTORY_TBL { 40 | ds_key_t inv_date_sk; 41 | ds_key_t inv_item_sk; 42 | ds_key_t inv_warehouse_sk; 43 | int inv_quantity_on_hand; 44 | }; 45 | 46 | 47 | int mk_w_inventory(void *pDest, ds_key_t kIndex); 48 | int pr_w_inventory(void *pSrc); 49 | int ld_w_inventory(void *pSrc); 50 | ds_key_t sc_w_inventory(int nScale); 51 | 52 | -------------------------------------------------------------------------------- /code/tools/w_reason.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors: 34 | * Gradient Systems 35 | */ 36 | #ifndef W_REASON_H 37 | #define W_REASON_H 38 | #include "constants.h" 39 | /* 40 | * REASON table structure 41 | */ 42 | struct W_REASON_TBL { 43 | ds_key_t r_reason_sk; 44 | char r_reason_id[RS_BKEY + 1]; 45 | char *r_reason_description; 46 | }; 47 | 48 | int mk_w_reason(void *pDest, ds_key_t kIndex); 49 | int pr_w_reason(void *pSrc); 50 | int ld_w_reason(void *pSrc); 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /query_templates_pg/agg_queries/postgres.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = ""; 37 | define __LIMITC = "limit %d"; 38 | define _END = ""; 39 | -------------------------------------------------------------------------------- /query_templates_pg/agg_queries/query100.tpl: -------------------------------------------------------------------------------- 1 | -- Query 100 2 | -- Find 2 products that are sold together frequently, ordered by how frequently they are sold together. 3 | -- Query type: self-joins, PKFK joins 4 | 5 | define YEAR = random(1998,2000,uniform); 6 | define CATEGORY = sulist(dist(categories,1,1), 2); 7 | define MANAGER = range(random(1, 100, uniform), 20); 8 | define MS= dist(marital_status, 1, 1); 9 | define ES= dist(education, 1, 1); 10 | define PRICE = range(random(1, 300, uniform), 5); 11 | define _LIMIT=100; 12 | 13 | [_LIMITA] select [_LIMITB] item1.i_item_sk, item2.i_item_sk, count(*) as cnt 14 | FROM item AS item1, 15 | item AS item2, 16 | store_sales AS s1, 17 | store_sales AS s2, 18 | date_dim, 19 | customer, 20 | customer_address, 21 | customer_demographics 22 | WHERE 23 | item1.i_item_sk < item2.i_item_sk 24 | AND s1.ss_ticket_number = s2.ss_ticket_number 25 | AND s1.ss_item_sk = item1.i_item_sk and s2.ss_item_sk = item2.i_item_sk 26 | AND s1.ss_customer_sk = c_customer_sk 27 | and c_current_addr_sk = ca_address_sk 28 | and c_current_cdemo_sk = cd_demo_sk 29 | AND d_year between [YEAR] and [YEAR] + 1 30 | and d_date_sk = s1.ss_sold_date_sk 31 | and item1.i_category in ('[CATEGORY.1]', '[CATEGORY.2]') 32 | and item2.i_manager_id between [MANAGER.begin] and [MANAGER.end] 33 | and cd_marital_status = '[MS]' 34 | and cd_education_status = '[ES]' 35 | and s1.ss_list_price between [PRICE.begin] and [PRICE.end] 36 | and s2.ss_list_price between [PRICE.begin] and [PRICE.end] 37 | GROUP BY item1.i_item_sk, item2.i_item_sk 38 | ORDER BY cnt 39 | ; 40 | -------------------------------------------------------------------------------- /query_templates_pg/agg_queries/query101.tpl: -------------------------------------------------------------------------------- 1 | -- Query 101 2 | -- Find the cities and item brands where a customer first buys and returns on web, and then buys again from store. 3 | -- Query type: non PKFK joins 4 | 5 | define YEAR = random(1998,2000,uniform); 6 | define CATEGORY = sulist(dist(categories,1,1), 3); 7 | define STATE= sulist(dist(fips_county, 3, 1), 5); 8 | define INCOME = range(random(0, 20, uniform), 30); 9 | define BUY_POTENTIAL = dist(buy_potential, 1, 2); 10 | define DISCOUNT = RANGE(RANDOM (0, 100, UNIFORM), 20); 11 | define _LIMIT=100; 12 | 13 | [_LIMITA] select [_LIMITB] c_customer_sk, c_first_name, c_last_name, count(*) as cnt 14 | FROM 15 | store_sales, 16 | store_returns, 17 | web_sales, 18 | date_dim d1, 19 | date_dim d2, 20 | item, 21 | customer, 22 | customer_address, 23 | household_demographics 24 | WHERE 25 | ss_ticket_number = sr_ticket_number 26 | AND ss_customer_sk = ws_bill_customer_sk 27 | AND ss_customer_sk = c_customer_sk 28 | AND c_current_addr_sk = ca_address_sk 29 | AND c_current_hdemo_sk = hd_demo_sk 30 | AND ss_item_sk = sr_item_sk 31 | AND sr_item_sk = ws_item_sk 32 | AND i_item_sk = ss_item_sk 33 | AND i_category IN ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]') 34 | AND sr_returned_date_sk = d1.d_date_sk 35 | AND ws_sold_date_sk = d2.d_date_sk 36 | AND d2.d_date between d1.d_date AND (d1.d_date + interval '90 day') 37 | AND ca_state in ('[STATE.1]', '[STATE.2]', '[STATE.3]', '[STATE.4]', '[STATE.5]') 38 | AND d1.d_year = [YEAR] 39 | AND hd_income_band_sk BETWEEN [INCOME.begin] AND [INCOME.end] 40 | AND hd_buy_potential = '[BUY_POTENTIAL]' 41 | AND ss_sales_price / ss_list_price BETWEEN [DISCOUNT.begin] * 0.01 AND [DISCOUNT.end] * 0.01 42 | GROUP BY c_customer_sk, c_first_name, c_last_name 43 | ORDER BY cnt 44 | ; 45 | -------------------------------------------------------------------------------- /query_templates_pg/agg_queries/query102.tpl: -------------------------------------------------------------------------------- 1 | -- Query 102 2 | -- Find the customer demographics where the customer buys an item from the store and buys it again from web, 3 | -- where the initial purchase could have been made from the web as well. 4 | -- Query type: non PKFK joins 5 | 6 | define YEAR = random(1998,2002,uniform); 7 | define STATE= sulist(dist(fips_county, 3, 1), 5); 8 | define MANAGER = sulist(random(1, 100, uniform), 10); 9 | define CATEGORY = sulist(dist(categories,1,1), 3); 10 | define WHOLESALE_COST = range(random (0, 100, uniform), 20); 11 | define _LIMIT=100; 12 | 13 | 14 | [_LIMITA] select [_LIMITB] 15 | cd_gender, 16 | cd_marital_status, 17 | cd_education_status, 18 | hd_vehicle_count, 19 | count(*) as cnt 20 | from 21 | store_sales, 22 | web_sales, 23 | date_dim d1, 24 | date_dim d2, 25 | customer, 26 | inventory, 27 | store, 28 | warehouse, 29 | item, 30 | customer_demographics, 31 | household_demographics, 32 | customer_address 33 | where 34 | ss_item_sk = i_item_sk 35 | and ws_item_sk = ss_item_sk 36 | and ss_sold_date_sk = d1.d_date_sk 37 | and ws_sold_date_sk = d2.d_date_sk 38 | and d2.d_date between d1.d_date and (d1.d_date + interval '30 day') 39 | and ss_customer_sk = c_customer_sk 40 | and ws_bill_customer_sk = c_customer_sk 41 | and ws_warehouse_sk = inv_warehouse_sk 42 | and ws_warehouse_sk = w_warehouse_sk 43 | and inv_item_sk = ss_item_sk 44 | and inv_date_sk = ss_sold_date_sk 45 | and inv_quantity_on_hand >= ss_quantity 46 | and s_state = w_state 47 | AND i_category IN ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]') 48 | and i_manager_id IN ([MANAGER.1], [MANAGER.2], [MANAGER.3], [MANAGER.4], [MANAGER.5], [MANAGER.6], [MANAGER.7], [MANAGER.8], [MANAGER.9], [MANAGER.10]) 49 | and c_current_cdemo_sk = cd_demo_sk 50 | and c_current_hdemo_sk = hd_demo_sk 51 | and c_current_addr_sk = ca_address_sk 52 | and ca_state in ('[STATE.1]', '[STATE.2]', '[STATE.3]', '[STATE.4]', '[STATE.5]') 53 | and d1.d_year = [YEAR] 54 | and ws_wholesale_cost BETWEEN [WHOLESALE_COST.begin] AND [WHOLESALE_COST.end] 55 | group by cd_gender, cd_marital_status, cd_education_status, hd_vehicle_count 56 | order by cnt 57 | ; 58 | -------------------------------------------------------------------------------- /query_templates_pg/multi_block_queries/postgres.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = ""; 37 | define __LIMITC = "limit %d"; 38 | define _END = ""; 39 | -------------------------------------------------------------------------------- /query_templates_pg/spj_queries/postgres.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = ""; 37 | define __LIMITC = "limit %d"; 38 | define _END = ""; 39 | -------------------------------------------------------------------------------- /query_templates_pg/spj_queries/query100_spj.tpl: -------------------------------------------------------------------------------- 1 | -- Query 100 2 | -- Find 2 products that are sold together frequently, ordered by how frequently they are sold together. 3 | -- Query type: self-joins, PKFK joins 4 | 5 | define YEAR = random(1998,2000,uniform); 6 | define CATEGORY = sulist(dist(categories,1,1), 2); 7 | define MANAGER = range(random(1, 100, uniform), 20); 8 | define MS= dist(marital_status, 1, 1); 9 | define ES= dist(education, 1, 1); 10 | define PRICE = range(random(1, 300, uniform), 5); 11 | 12 | select min(item1.i_item_sk), 13 | min(item2.i_item_sk), 14 | min(s1.ss_ticket_number), 15 | min(s1.ss_item_sk) 16 | FROM item AS item1, 17 | item AS item2, 18 | store_sales AS s1, 19 | store_sales AS s2, 20 | date_dim, 21 | customer, 22 | customer_address, 23 | customer_demographics 24 | WHERE 25 | item1.i_item_sk < item2.i_item_sk 26 | AND s1.ss_ticket_number = s2.ss_ticket_number 27 | AND s1.ss_item_sk = item1.i_item_sk and s2.ss_item_sk = item2.i_item_sk 28 | AND s1.ss_customer_sk = c_customer_sk 29 | and c_current_addr_sk = ca_address_sk 30 | and c_current_cdemo_sk = cd_demo_sk 31 | AND d_year between [YEAR] and [YEAR] + 1 32 | and d_date_sk = s1.ss_sold_date_sk 33 | and item1.i_category in ('[CATEGORY.1]', '[CATEGORY.2]') 34 | and item2.i_manager_id between [MANAGER.begin] and [MANAGER.end] 35 | and cd_marital_status = '[MS]' 36 | and cd_education_status = '[ES]' 37 | and s1.ss_list_price between [PRICE.begin] and [PRICE.end] 38 | and s2.ss_list_price between [PRICE.begin] and [PRICE.end] 39 | ; 40 | -------------------------------------------------------------------------------- /query_templates_pg/spj_queries/query101_spj.tpl: -------------------------------------------------------------------------------- 1 | -- Query 101 2 | -- Find the cities and item brands where a customer first buys and returns on web, and then buys again from store. 3 | -- Query type: non PKFK joins 4 | 5 | define YEAR = random(1998,2000,uniform); 6 | define CATEGORY = sulist(dist(categories,1,1), 3); 7 | define STATE= sulist(dist(fips_county, 3, 1), 5); 8 | define INCOME = range(random(0, 20, uniform), 30); 9 | define BUY_POTENTIAL = dist(buy_potential, 1, 2); 10 | define DISCOUNT = RANGE(RANDOM (0, 100, UNIFORM), 20); 11 | 12 | select min(c_customer_sk), min(ss_item_sk), min(sr_ticket_number), min(ws_order_number) 13 | FROM 14 | store_sales, 15 | store_returns, 16 | web_sales, 17 | date_dim d1, 18 | date_dim d2, 19 | item, 20 | customer, 21 | customer_address, 22 | household_demographics 23 | WHERE 24 | ss_ticket_number = sr_ticket_number 25 | AND ss_customer_sk = ws_bill_customer_sk 26 | AND ss_customer_sk = c_customer_sk 27 | AND c_current_addr_sk = ca_address_sk 28 | AND c_current_hdemo_sk = hd_demo_sk 29 | AND ss_item_sk = sr_item_sk 30 | AND sr_item_sk = ws_item_sk 31 | AND i_item_sk = ss_item_sk 32 | AND i_category IN ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]') 33 | AND sr_returned_date_sk = d1.d_date_sk 34 | AND ws_sold_date_sk = d2.d_date_sk 35 | AND d2.d_date between d1.d_date AND (d1.d_date + interval '90 day') 36 | AND ca_state in ('[STATE.1]', '[STATE.2]', '[STATE.3]', '[STATE.4]', '[STATE.5]') 37 | AND d1.d_year = [YEAR] 38 | AND hd_income_band_sk BETWEEN [INCOME.begin] AND [INCOME.end] 39 | AND hd_buy_potential = '[BUY_POTENTIAL]' 40 | AND ss_sales_price / ss_list_price BETWEEN [DISCOUNT.begin] * 0.01 AND [DISCOUNT.end] * 0.01 41 | ; 42 | -------------------------------------------------------------------------------- /query_templates_pg/spj_queries/query102_spj.tpl: -------------------------------------------------------------------------------- 1 | -- Query 102 2 | -- Find the customer demographics where the customer buys an item from the store and buys it again from web, 3 | -- where the initial purchase could have been made from the web as well. 4 | -- Query type: non PKFK joins 5 | 6 | define YEAR = random(1998,2002,uniform); 7 | define STATE= sulist(dist(fips_county, 3, 1), 5); 8 | define MANAGER = sulist(random(1, 100, uniform), 10); 9 | define CATEGORY = sulist(dist(categories,1,1), 3); 10 | define WHOLESALE_COST = range(random (0, 100, uniform), 20); 11 | 12 | select min(ss_item_sk), 13 | min(ss_ticket_number), 14 | min(ws_order_number), 15 | min(c_customer_sk), 16 | min(cd_demo_sk), 17 | min(hd_demo_sk) 18 | from 19 | store_sales, 20 | web_sales, 21 | date_dim d1, 22 | date_dim d2, 23 | customer, 24 | inventory, 25 | store, 26 | warehouse, 27 | item, 28 | customer_demographics, 29 | household_demographics, 30 | customer_address 31 | where 32 | ss_item_sk = i_item_sk 33 | and ws_item_sk = ss_item_sk 34 | and ss_sold_date_sk = d1.d_date_sk 35 | and ws_sold_date_sk = d2.d_date_sk 36 | and d2.d_date between d1.d_date and (d1.d_date + interval '30 day') 37 | and ss_customer_sk = c_customer_sk 38 | and ws_bill_customer_sk = c_customer_sk 39 | and ws_warehouse_sk = inv_warehouse_sk 40 | and ws_warehouse_sk = w_warehouse_sk 41 | and inv_item_sk = ss_item_sk 42 | and inv_date_sk = ss_sold_date_sk 43 | and inv_quantity_on_hand >= ss_quantity 44 | and s_state = w_state 45 | AND i_category IN ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]') 46 | and i_manager_id IN ([MANAGER.1], [MANAGER.2], [MANAGER.3], [MANAGER.4], [MANAGER.5], [MANAGER.6], [MANAGER.7], [MANAGER.8], [MANAGER.9], [MANAGER.10]) 47 | and c_current_cdemo_sk = cd_demo_sk 48 | and c_current_hdemo_sk = hd_demo_sk 49 | and c_current_addr_sk = ca_address_sk 50 | and ca_state in ('[STATE.1]', '[STATE.2]', '[STATE.3]', '[STATE.4]', '[STATE.5]') 51 | and d1.d_year = [YEAR] 52 | and ws_wholesale_cost BETWEEN [WHOLESALE_COST.begin] AND [WHOLESALE_COST.end] 53 | ; 54 | -------------------------------------------------------------------------------- /query_templates_sqlserver/agg_queries/query100.tpl: -------------------------------------------------------------------------------- 1 | -- Query 100 2 | -- Find 2 products that are sold together frequently, ordered by how frequently they are sold together. 3 | -- Query type: self-joins, PKFK joins 4 | 5 | define YEAR = random(1998,2000,uniform); 6 | define CATEGORY = sulist(dist(categories,1,1), 2); 7 | define MANAGER = range(random(1, 100, uniform), 20); 8 | define MS= dist(marital_status, 1, 1); 9 | define ES= dist(education, 1, 1); 10 | define PRICE = range(random(1, 300, uniform), 5); 11 | define _LIMIT=100; 12 | 13 | [_LIMITA] select [_LIMITB] item1.i_item_sk, item2.i_item_sk, count(*) as cnt 14 | FROM item AS item1, 15 | item AS item2, 16 | store_sales AS s1, 17 | store_sales AS s2, 18 | date_dim, 19 | customer, 20 | customer_address, 21 | customer_demographics 22 | WHERE 23 | item1.i_item_sk < item2.i_item_sk 24 | AND s1.ss_ticket_number = s2.ss_ticket_number 25 | AND s1.ss_item_sk = item1.i_item_sk and s2.ss_item_sk = item2.i_item_sk 26 | AND s1.ss_customer_sk = c_customer_sk 27 | and c_current_addr_sk = ca_address_sk 28 | and c_current_cdemo_sk = cd_demo_sk 29 | AND d_year between [YEAR] and [YEAR] + 1 30 | and d_date_sk = s1.ss_sold_date_sk 31 | and item1.i_category in ('[CATEGORY.1]', '[CATEGORY.2]') 32 | and item2.i_manager_id between [MANAGER.begin] and [MANAGER.end] 33 | and cd_marital_status = '[MS]' 34 | and cd_education_status = '[ES]' 35 | and s1.ss_list_price between [PRICE.begin] and [PRICE.end] 36 | and s2.ss_list_price between [PRICE.begin] and [PRICE.end] 37 | GROUP BY item1.i_item_sk, item2.i_item_sk 38 | ORDER BY cnt 39 | ; 40 | -------------------------------------------------------------------------------- /query_templates_sqlserver/agg_queries/query101.tpl: -------------------------------------------------------------------------------- 1 | -- Query 101 2 | -- Find the cities and item brands where a customer first buys and returns on web, and then buys again from store. 3 | -- Query type: non PKFK joins 4 | 5 | define YEAR = random(1998,2000,uniform); 6 | define CATEGORY = sulist(dist(categories,1,1), 3); 7 | define STATE= sulist(dist(fips_county, 3, 1), 5); 8 | define INCOME = range(random(0, 20, uniform), 30); 9 | define BUY_POTENTIAL = dist(buy_potential, 1, 2); 10 | define DISCOUNT = RANGE(RANDOM (0, 100, UNIFORM), 20); 11 | define _LIMIT=100; 12 | 13 | [_LIMITA] select [_LIMITB] c_customer_sk, c_first_name, c_last_name, count(*) as cnt 14 | FROM 15 | store_sales, 16 | store_returns, 17 | web_sales, 18 | date_dim d1, 19 | date_dim d2, 20 | item, 21 | customer, 22 | customer_address, 23 | household_demographics 24 | WHERE 25 | ss_ticket_number = sr_ticket_number 26 | AND ss_customer_sk = ws_bill_customer_sk 27 | AND ss_customer_sk = c_customer_sk 28 | AND c_current_addr_sk = ca_address_sk 29 | AND c_current_hdemo_sk = hd_demo_sk 30 | AND ss_item_sk = sr_item_sk 31 | AND sr_item_sk = ws_item_sk 32 | AND i_item_sk = ss_item_sk 33 | AND i_category IN ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]') 34 | AND sr_returned_date_sk = d1.d_date_sk 35 | AND ws_sold_date_sk = d2.d_date_sk 36 | AND d2.d_date between d1.d_date AND dateadd(day, 90, d1.d_date) 37 | AND ca_state in ('[STATE.1]', '[STATE.2]', '[STATE.3]', '[STATE.4]', '[STATE.5]') 38 | AND d1.d_year = [YEAR] 39 | AND hd_income_band_sk BETWEEN [INCOME.begin] AND [INCOME.end] 40 | AND hd_buy_potential = '[BUY_POTENTIAL]' 41 | AND ss_sales_price / ss_list_price BETWEEN [DISCOUNT.begin] * 0.01 AND [DISCOUNT.end] * 0.01 42 | GROUP BY c_customer_sk, c_first_name, c_last_name 43 | ORDER BY cnt 44 | ; 45 | -------------------------------------------------------------------------------- /query_templates_sqlserver/agg_queries/query102.tpl: -------------------------------------------------------------------------------- 1 | -- Query 102 2 | -- Find the customer demographics where the customer buys an item from the store and buys it again from web, 3 | -- where the initial purchase could have been made from the web as well. 4 | -- Query type: non PKFK joins 5 | 6 | define YEAR = random(1998,2002,uniform); 7 | define STATE= sulist(dist(fips_county, 3, 1), 5); 8 | define MANAGER = sulist(random(1, 100, uniform), 10); 9 | define CATEGORY = sulist(dist(categories,1,1), 3); 10 | define WHOLESALE_COST = range(random (0, 100, uniform), 20); 11 | define _LIMIT=100; 12 | 13 | 14 | [_LIMITA] select [_LIMITB] 15 | cd_gender, 16 | cd_marital_status, 17 | cd_education_status, 18 | hd_vehicle_count, 19 | count(*) as cnt 20 | from 21 | store_sales, 22 | web_sales, 23 | date_dim d1, 24 | date_dim d2, 25 | customer, 26 | inventory, 27 | store, 28 | warehouse, 29 | item, 30 | customer_demographics, 31 | household_demographics, 32 | customer_address 33 | where 34 | ss_item_sk = i_item_sk 35 | and ws_item_sk = ss_item_sk 36 | and ss_sold_date_sk = d1.d_date_sk 37 | and ws_sold_date_sk = d2.d_date_sk 38 | and d2.d_date between d1.d_date and dateadd(day, 30, d1.d_date) 39 | and ss_customer_sk = c_customer_sk 40 | and ws_bill_customer_sk = c_customer_sk 41 | and ws_warehouse_sk = inv_warehouse_sk 42 | and ws_warehouse_sk = w_warehouse_sk 43 | and inv_item_sk = ss_item_sk 44 | and inv_date_sk = ss_sold_date_sk 45 | and inv_quantity_on_hand >= ss_quantity 46 | and s_state = w_state 47 | AND i_category IN ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]') 48 | and i_manager_id IN ([MANAGER.1], [MANAGER.2], [MANAGER.3], [MANAGER.4], [MANAGER.5], [MANAGER.6], [MANAGER.7], [MANAGER.8], [MANAGER.9], [MANAGER.10]) 49 | and c_current_cdemo_sk = cd_demo_sk 50 | and c_current_hdemo_sk = hd_demo_sk 51 | and c_current_addr_sk = ca_address_sk 52 | and ca_state in ('[STATE.1]', '[STATE.2]', '[STATE.3]', '[STATE.4]', '[STATE.5]') 53 | and d1.d_year = [YEAR] 54 | and ws_wholesale_cost BETWEEN [WHOLESALE_COST.begin] AND [WHOLESALE_COST.end] 55 | group by cd_gender, cd_marital_status, cd_education_status, hd_vehicle_count 56 | order by cnt 57 | ; 58 | -------------------------------------------------------------------------------- /query_templates_sqlserver/agg_queries/sqlserver.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = "top %d"; 37 | define __LIMITC = ""; 38 | define _END = ""; 39 | -------------------------------------------------------------------------------- /query_templates_sqlserver/multi_block_queries/sqlserver.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = "top %d"; 37 | define __LIMITC = ""; 38 | define _END = ""; 39 | -------------------------------------------------------------------------------- /query_templates_sqlserver/spj_queries/query100_spj.tpl: -------------------------------------------------------------------------------- 1 | -- Query 100 2 | -- Find 2 products that are sold together frequently, ordered by how frequently they are sold together. 3 | -- Query type: self-joins, PKFK joins 4 | 5 | define YEAR = random(1998,2000,uniform); 6 | define CATEGORY = sulist(dist(categories,1,1), 2); 7 | define MANAGER = range(random(1, 100, uniform), 20); 8 | define MS= dist(marital_status, 1, 1); 9 | define ES= dist(education, 1, 1); 10 | define PRICE = range(random(1, 300, uniform), 5); 11 | 12 | select min(item1.i_item_sk), 13 | min(item2.i_item_sk), 14 | min(s1.ss_ticket_number), 15 | min(s1.ss_item_sk) 16 | FROM item AS item1, 17 | item AS item2, 18 | store_sales AS s1, 19 | store_sales AS s2, 20 | date_dim, 21 | customer, 22 | customer_address, 23 | customer_demographics 24 | WHERE 25 | item1.i_item_sk < item2.i_item_sk 26 | AND s1.ss_ticket_number = s2.ss_ticket_number 27 | AND s1.ss_item_sk = item1.i_item_sk and s2.ss_item_sk = item2.i_item_sk 28 | AND s1.ss_customer_sk = c_customer_sk 29 | and c_current_addr_sk = ca_address_sk 30 | and c_current_cdemo_sk = cd_demo_sk 31 | AND d_year between [YEAR] and [YEAR] + 1 32 | and d_date_sk = s1.ss_sold_date_sk 33 | and item1.i_category in ('[CATEGORY.1]', '[CATEGORY.2]') 34 | and item2.i_manager_id between [MANAGER.begin] and [MANAGER.end] 35 | and cd_marital_status = '[MS]' 36 | and cd_education_status = '[ES]' 37 | and s1.ss_list_price between [PRICE.begin] and [PRICE.end] 38 | and s2.ss_list_price between [PRICE.begin] and [PRICE.end] 39 | ; 40 | -------------------------------------------------------------------------------- /query_templates_sqlserver/spj_queries/query101_spj.tpl: -------------------------------------------------------------------------------- 1 | -- Query 101 2 | -- Find the cities and item brands where a customer first buys and returns on web, and then buys again from store. 3 | -- Query type: non PKFK joins 4 | 5 | define YEAR = random(1998,2000,uniform); 6 | define CATEGORY = sulist(dist(categories,1,1), 3); 7 | define STATE= sulist(dist(fips_county, 3, 1), 5); 8 | define INCOME = range(random(0, 20, uniform), 30); 9 | define BUY_POTENTIAL = dist(buy_potential, 1, 2); 10 | define DISCOUNT = RANGE(RANDOM (0, 100, UNIFORM), 20); 11 | 12 | select min(c_customer_sk), min(ss_item_sk), min(sr_ticket_number), min(ws_order_number) 13 | FROM 14 | store_sales, 15 | store_returns, 16 | web_sales, 17 | date_dim d1, 18 | date_dim d2, 19 | item, 20 | customer, 21 | customer_address, 22 | household_demographics 23 | WHERE 24 | ss_ticket_number = sr_ticket_number 25 | AND ss_customer_sk = ws_bill_customer_sk 26 | AND ss_customer_sk = c_customer_sk 27 | AND c_current_addr_sk = ca_address_sk 28 | AND c_current_hdemo_sk = hd_demo_sk 29 | AND ss_item_sk = sr_item_sk 30 | AND sr_item_sk = ws_item_sk 31 | AND i_item_sk = ss_item_sk 32 | AND i_category IN ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]') 33 | AND sr_returned_date_sk = d1.d_date_sk 34 | AND ws_sold_date_sk = d2.d_date_sk 35 | AND d2.d_date between d1.d_date AND dateadd(day, 90, d1.d_date) 36 | AND ca_state in ('[STATE.1]', '[STATE.2]', '[STATE.3]', '[STATE.4]', '[STATE.5]') 37 | AND d1.d_year = [YEAR] 38 | AND hd_income_band_sk BETWEEN [INCOME.begin] AND [INCOME.end] 39 | AND hd_buy_potential = '[BUY_POTENTIAL]' 40 | AND ss_sales_price / ss_list_price BETWEEN [DISCOUNT.begin] * 0.01 AND [DISCOUNT.end] * 0.01 41 | ; 42 | -------------------------------------------------------------------------------- /query_templates_sqlserver/spj_queries/query102_spj.tpl: -------------------------------------------------------------------------------- 1 | -- Query 102 2 | -- Find the customer demographics where the customer buys an item from the store and buys it again from web, 3 | -- where the initial purchase could have been made from the web as well. 4 | -- Query type: non PKFK joins 5 | 6 | define YEAR = random(1998,2002,uniform); 7 | define STATE= sulist(dist(fips_county, 3, 1), 5); 8 | define MANAGER = sulist(random(1, 100, uniform), 10); 9 | define CATEGORY = sulist(dist(categories,1,1), 3); 10 | define WHOLESALE_COST = range(random (0, 100, uniform), 20); 11 | 12 | select min(ss_item_sk), 13 | min(ss_ticket_number), 14 | min(ws_order_number), 15 | min(c_customer_sk), 16 | min(cd_demo_sk), 17 | min(hd_demo_sk) 18 | from 19 | store_sales, 20 | web_sales, 21 | date_dim d1, 22 | date_dim d2, 23 | customer, 24 | inventory, 25 | store, 26 | warehouse, 27 | item, 28 | customer_demographics, 29 | household_demographics, 30 | customer_address 31 | where 32 | ss_item_sk = i_item_sk 33 | and ws_item_sk = ss_item_sk 34 | and ss_sold_date_sk = d1.d_date_sk 35 | and ws_sold_date_sk = d2.d_date_sk 36 | and d2.d_date between d1.d_date and dateadd(day, 30, d1.d_date) 37 | and ss_customer_sk = c_customer_sk 38 | and ws_bill_customer_sk = c_customer_sk 39 | and ws_warehouse_sk = inv_warehouse_sk 40 | and ws_warehouse_sk = w_warehouse_sk 41 | and inv_item_sk = ss_item_sk 42 | and inv_date_sk = ss_sold_date_sk 43 | and inv_quantity_on_hand >= ss_quantity 44 | and s_state = w_state 45 | AND i_category IN ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]') 46 | and i_manager_id IN ([MANAGER.1], [MANAGER.2], [MANAGER.3], [MANAGER.4], [MANAGER.5], [MANAGER.6], [MANAGER.7], [MANAGER.8], [MANAGER.9], [MANAGER.10]) 47 | and c_current_cdemo_sk = cd_demo_sk 48 | and c_current_hdemo_sk = hd_demo_sk 49 | and c_current_addr_sk = ca_address_sk 50 | and ca_state in ('[STATE.1]', '[STATE.2]', '[STATE.3]', '[STATE.4]', '[STATE.5]') 51 | and d1.d_year = [YEAR] 52 | and ws_wholesale_cost BETWEEN [WHOLESALE_COST.begin] AND [WHOLESALE_COST.end] 53 | ; 54 | -------------------------------------------------------------------------------- /query_templates_sqlserver/spj_queries/sqlserver.tpl: -------------------------------------------------------------------------------- 1 | -- 2 | -- Legal Notice 3 | -- 4 | -- This document and associated source code (the "Work") is a part of a 5 | -- benchmark specification maintained by the TPC. 6 | -- 7 | -- The TPC reserves all right, title, and interest to the Work as provided 8 | -- under U.S. and international laws, including without limitation all patent 9 | -- and trademark rights therein. 10 | -- 11 | -- No Warranty 12 | -- 13 | -- 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | -- CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | -- AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | -- WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | -- INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | -- DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | -- PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | -- WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | -- ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | -- QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | -- WITH REGARD TO THE WORK. 24 | -- 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | -- ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | -- COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | -- OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | -- INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | -- OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | -- RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | -- ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -- 33 | -- Contributors: 34 | -- 35 | define __LIMITA = ""; 36 | define __LIMITB = "top %d"; 37 | define __LIMITC = ""; 38 | define _END = ""; 39 | -------------------------------------------------------------------------------- /scripts/SQL_utils.py: -------------------------------------------------------------------------------- 1 | import os 2 | from os import path 3 | import pyodbc 4 | import time 5 | 6 | def TrustedConnection(_server, _DBname="master", _driver="SQL Server", _Timeout=0, _verbose=False): 7 | connString = "Driver={%s};Server=%s;Database=%s;Trusted_Connection=yes;" % (_driver, _server, _DBname) 8 | 9 | conn = pyodbc.connect(connString, timeout=_Timeout, autocommit=True) 10 | if _verbose == True: 11 | print("Connecting to %s, %s" % (_server, _DBname)) 12 | 13 | return conn 14 | 15 | def check_local_server_status(): 16 | 17 | status_check_cmd = "sqlcmd -S 127.0.0.1 -Q \"SELECT SERVERPROPERTY('EDITION')\" " 18 | status = os.popen(status_check_cmd).read() 19 | 20 | if len(status) > 0: 21 | print("Connected to " + status.strip().replace(" ","").replace('\n','').replace('-','') + "\n") 22 | return True 23 | else: 24 | print("No server running") 25 | return False 26 | 27 | 28 | def start_server(_path, _server, timeout=0): 29 | 30 | server_status = check_local_server_status() 31 | 32 | if server_status == False: 33 | os.system("start %s" % (path.join(_path, "sqlservr.cmd") ) ) 34 | time.sleep(10) #wait for server to start 35 | 36 | conn = TrustedConnection(_server, _verbose=True, _Timeout=timeout) 37 | master_cursor = conn.cursor() 38 | 39 | return conn, master_cursor 40 | 41 | def execute_from_file(_cursor, file): 42 | print('execute SQL from file:', file) 43 | with open(file) as f: 44 | lines = f.read() 45 | _cursor.execute(lines) 46 | -------------------------------------------------------------------------------- /scripts/create_index_pg.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pg_util 3 | 4 | db_name = # database name 5 | bin_path = # binary of Postgres 6 | sql_path = r'D:\scripts\create_index_pg.sql' 7 | 8 | # start database service 9 | pg_util.start_server() 10 | 11 | # postgres credential 12 | user = 'postgres' 13 | password = 'admin' 14 | 15 | # connect to the database 16 | conn = pg_util.connect(user = user, password = password, db_name = db_name) 17 | cursor = conn.cursor() 18 | 19 | # create indexes 20 | pg_util.execute(cursor, open(sql_path, 'r').read(), verbose = True) 21 | 22 | cursor.close() 23 | conn.close() 24 | -------------------------------------------------------------------------------- /scripts/generate_dsb_db_files.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import shutil 4 | 5 | bin_dir = r'D:\code\v2.11.0rc2\tools' 6 | bin_path = os.path.join(bin_dir, 'dsdgen.exe') 7 | 8 | scale = 10 9 | file_dir = # directory of database files 10 | 11 | if os.path.exists(file_dir): 12 | shutil.rmtree(file_dir) 13 | 14 | if not os.path.exists(file_dir): 15 | os.makedirs(file_dir) 16 | 17 | # WARNING: This code hasn't been valiated. Somewhat the dir parameter is not 18 | # taken in to account by the code. The output db files are generated in bin_dir 19 | cmd = [bin_path, '/scale', str(scale), '/terminate', 'N', '/force', '/dir', file_dir] 20 | print(cmd) 21 | subprocess.call(cmd, cwd = bin_dir) 22 | -------------------------------------------------------------------------------- /scripts/load_data_pg.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pg_util 3 | 4 | tables = ['call_center', 5 | 'catalog_page', 'catalog_returns', 6 | 'catalog_sales', 7 | 'customer', 'customer_address', 'customer_demographics', 8 | 'date_dim', 'household_demographics', 'income_band', 'inventory', 'item', 'promotion', 'reason', 'ship_mode', 9 | 'store', 'store_returns', 'store_sales', 10 | 'time_dim', 'warehouse', 11 | 'web_page', 'web_returns', 'web_sales', 'web_site' 12 | ] 13 | 14 | data_path = # directory of data files 15 | db_name = # database name 16 | bin_path = # path of the binary of Postgres 17 | tmp_csv_path = # path of tmp csv file for bulk loading 18 | 19 | create_db = False # If create the database 20 | create_table = False # If create the tables 21 | 22 | # start database service 23 | pg_util.start_server() 24 | 25 | # postgres credential 26 | user = 'postgres' 27 | password = 'admin' 28 | 29 | # create database 30 | if create_db: 31 | master_conn = pg_util.connect(user = user, password = password) 32 | pg_util.execute(master_conn.cursor(), 'create database ' + db_name, verbose = True) 33 | master_conn.close() 34 | 35 | # connect to the database 36 | conn = pg_util.connect(user = user, password = password, db_name = db_name) 37 | cursor = conn.cursor() 38 | 39 | # create tables 40 | if create_table: 41 | sql_path = r'D:\scripts\create_tables.sql' 42 | pg_util.execute(cursor, open(sql_path, 'r').read(), verbose = True) 43 | 44 | # insert tuples into tables 45 | for table in tables: 46 | file_path = os.path.join(data_path, table + '.dat') 47 | pg_util.execute(cursor, 'delete from ' + table + ';', verbose = True) 48 | pg_util.bulk_load_from_csv_file(cursor, file_path, tmp_csv_path, table, delimiter = '|') 49 | 50 | cursor.close() 51 | conn.close() 52 | -------------------------------------------------------------------------------- /scripts/load_data_sqlserver.py: -------------------------------------------------------------------------------- 1 | import SQL_utils 2 | 3 | SQL_engine_path = # directory of Microsoft SQL Server sqlserver.cmd 4 | 5 | conn, master_cursor = SQL_utils.start_server(SQL_engine_path, 'localhost') 6 | 7 | db_name = # database name 8 | create_db = False # If create the database 9 | create_table = False # If create the tables 10 | load_data = False # If load the data 11 | create_index = True # If create the indexes 12 | 13 | create_table_sql = r'D:\scripts\create_tables.sql' 14 | load_data_sql = r'D:\scripts\load_db_files_sqlserver.sql' 15 | create_index_sql = r'D:\scripts\dsb_index_sqlserver.sql' 16 | 17 | # create database 18 | if create_db: 19 | master_cursor.execute('create database ' + db_name) 20 | 21 | conn = SQL_utils.TrustedConnection('localhost', db_name) 22 | cursor = conn.cursor() 23 | 24 | # create tables 25 | if create_table: 26 | SQL_utils.execute_from_file(cursor, create_table_sql) 27 | 28 | # load data 29 | if load_data: 30 | SQL_utils.execute_from_file(cursor, load_data_sql) 31 | 32 | if create_index: 33 | SQL_utils.execute_from_file(cursor, create_index_sql) 34 | -------------------------------------------------------------------------------- /scripts/load_db_files_sqlserver.sql: -------------------------------------------------------------------------------- 1 | DECLARE @path VARCHAR(max) 2 | 3 | SET @path = -- path to the database files 4 | 5 | DECLARE @tables TABLE (table_name VARCHAR(max)) 6 | INSERT @tables(table_name) values 7 | ('call_center'), 8 | ('catalog_page'), ('catalog_returns'), ('catalog_sales'), 9 | ('customer'), ('customer_address'), ('customer_demographics'), 10 | ('date_dim'), ('household_demographics'), ('income_band'), ('inventory'), ('item'), ('promotion'), ('reason'), ('ship_mode'), 11 | ('store'), ('store_returns'), ('store_sales'), 12 | ('time_dim'), ('warehouse'), 13 | ('web_page'), ('web_returns'), ('web_sales'), ('web_site') 14 | 15 | 16 | DECLARE @sql varchar(max) 17 | 18 | WHILE EXISTS (SELECT * from @tables) 19 | BEGIN 20 | DECLARE @table VARCHAR(max) 21 | SELECT @table = MIN(table_name) from @tables 22 | SET @sql = 'DELETE FROM ' + @table 23 | EXEC(@sql) 24 | 25 | SET @sql = 'BULK INSERT ' + @table + ' FROM ''' + @path + @table + '.dat'' WITH 26 | ( 27 | FORMAT = ''CSV'', 28 | FIRSTROW = 1, 29 | FIELDTERMINATOR = ''|'', 30 | ROWTERMINATOR = ''\n'', 31 | KEEPNULLS 32 | )' 33 | EXEC(@sql) 34 | 35 | DELETE from @tables where table_name = @table 36 | END 37 | -------------------------------------------------------------------------------- /scripts/pg_util.py: -------------------------------------------------------------------------------- 1 | import os 2 | import psycopg2 3 | from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT 4 | 5 | import util 6 | 7 | def bulk_load_from_csv_file(cursor, csv_file, tmp_file, table_name, delimiter): 8 | # Split the csv file into batches to load incrementally. 9 | batch_size = 100000 10 | prev_pos = 0 11 | count = 0 12 | with open(csv_file) as fin: 13 | flag = True 14 | while flag: 15 | with open(tmp_file, 'w') as fout: 16 | cur = 0 17 | for i in range(batch_size): 18 | line = fin.readline() 19 | # Check if we reach EOF 20 | pos = fin.tell() 21 | if pos == prev_pos: 22 | flag = False 23 | break 24 | else: 25 | prev_pos = pos 26 | fout.write(line) 27 | count += 1 28 | cur += 1 29 | load_from_csv_file(cursor, tmp_file, table_name, delimiter) 30 | print('.', end = '', flush = True) 31 | print('loaded', count, 'rows from', csv_file, 'to table', table_name) 32 | 33 | 34 | def load_from_csv_file(cursor, csv_file, table_name, delimiter): 35 | sql_cmd = 'copy ' + table_name + " from '" + csv_file + "' with (delimiter '" + delimiter + "', format csv);" 36 | execute(cursor, sql_cmd) 37 | 38 | def execute(cursor, cmd, verbose = False): 39 | try: 40 | if verbose: 41 | print(cmd) 42 | cursor.execute(cmd) 43 | except Exception as e: 44 | print(e) 45 | 46 | def connect(user, password, db_name = None): 47 | try: 48 | if db_name is not None: 49 | conn = psycopg2.connect(user=user, password=password, database=db_name) 50 | else: 51 | conn = psycopg2.connect(user=user, password=password) 52 | conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) 53 | 54 | except Exception as e: 55 | print(e) 56 | 57 | return conn 58 | 59 | def restart_server(pg_service_name = 'postgresql-x64-13'): 60 | stop_server(pg_service_name) 61 | start_server(pg_service_name) 62 | 63 | def stop_server(pg_service_name = 'postgresql-x64-13'): 64 | 65 | cmd = 'net stop ' + pg_service_name 66 | util.run_cmd(cmd) 67 | 68 | def start_server(pg_service_name = 'postgresql-x64-13'): 69 | 70 | cmd = 'net start ' + pg_service_name 71 | util.run_cmd(cmd) 72 | 73 | if __name__ == '__main__': 74 | pg_service_name = 'postgresql-x64-13' 75 | start_server(pg_service_name) 76 | -------------------------------------------------------------------------------- /scripts/start_sqlserver.py: -------------------------------------------------------------------------------- 1 | import SQL_utils 2 | 3 | SQL_engine_path = # directory of Microsoft SQL Server sqlservr.cmd 4 | 5 | SQL_utils.start_server(SQL_engine_path, 'localhost') 6 | -------------------------------------------------------------------------------- /scripts/util.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def run_cmd(cmd, verbose = False): 4 | if verbose: 5 | print(cmd) 6 | status = os.popen(cmd).read() 7 | print(status) 8 | -------------------------------------------------------------------------------- /scripts/workload_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "output_dir": "D:\\exp\\workload", 3 | "binary_dir": "D:\\code\\v2.11.0rc2\\tools", 4 | "query_template_root_dir": "D:\\query_templates_sqlserver", 5 | "dialect" : "sqlserver", 6 | "workload": 7 | [ 8 | { 9 | "id" : "1", 10 | "query_template_names" : [], 11 | "instance_count" : 20, 12 | "param_dist" : "normal", 13 | "param_sigma" : 2, 14 | "param_center" : 0, 15 | "rngseed" : 997 16 | }, 17 | { 18 | "id" : "2", 19 | "query_template_names" : [], 20 | "instance_count" : 20, 21 | "param_dist" : "normal", 22 | "param_sigma" : 1, 23 | "param_center" : 0, 24 | "rngseed" : 997 25 | } 26 | ] 27 | } 28 | --------------------------------------------------------------------------------