Skip to content

Commit

Permalink
Implement BCP Option for MSSQLS TPCH Load (#611)
Browse files Browse the repository at this point in the history
* Implement BCP Option for MSSQLS TPCH Load

Allow users to use the BCP option to load data for TPCH data. The
option is enabled by default, becuase BCP will work for both SQL and
Windows Authentication.

* Add mk_time_bcp to export list

Added mk_time_bcp in export list for tpchcommon to be used in mssqls' TPCH load process when BCP is enabled

* Update total price for BCP Load of TPCH

Update the total price logic for BCP to be in line with the PR
#610.

* Add XML variable and updates to TPCH BCP

* Fix XML spacing

---------

Co-authored-by: Josh Innis (Warner Marketing Incorporated) <v-joshinnis@microsoft.com>
Co-authored-by: Steve Shaw <smshaw@users.sourceforge.net>
Co-authored-by: Steve Shaw <38044085+sm-shaw@users.noreply.github.com>
  • Loading branch information
4 people committed Oct 3, 2023
1 parent 91ab1d9 commit dea12f4
Show file tree
Hide file tree
Showing 4 changed files with 643 additions and 87 deletions.
1 change: 1 addition & 0 deletions config/mssqlserver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<mssqls_tpch_dbase>tpch</mssqls_tpch_dbase>
<mssqls_num_tpch_threads>1</mssqls_num_tpch_threads>
<mssqls_colstore>false</mssqls_colstore>
<mssqls_tpch_use_bcp>true</mssqls_tpch_use_bcp>
</schema>
<driver>
<mssqls_total_querysets>1</mssqls_total_querysets>
Expand Down
24 changes: 23 additions & 1 deletion modules/tpchcommon-1.0.tm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package provide tpchcommon 1.0
namespace eval tpchcommon {
namespace export chk_thread start_end findvuhposition RandomNumber set_dists get_dists set_dist_list LEAP LEAP_ADJ julian mk_time mk_sparse PART_SUPP_BRIDGE rpb_routine gen_phone MakeAlphaString calc_weight pick_str_1 pick_str_2 txt_vp_1 txt_vp_2 txt_np_1 txt_np_2 txt_sentence_1 txt_sentence_2 dbg_text_1 dbg_text_2 V_STR TEXT_1 TEXT_2 ordered_set gmean printlist
namespace export chk_thread start_end findvuhposition RandomNumber set_dists get_dists set_dist_list LEAP LEAP_ADJ julian mk_time mk_time_bcp mk_sparse PART_SUPP_BRIDGE rpb_routine gen_phone MakeAlphaString calc_weight pick_str_1 pick_str_2 txt_vp_1 txt_vp_2 txt_np_1 txt_np_2 txt_sentence_1 txt_sentence_2 dbg_text_1 dbg_text_2 V_STR TEXT_1 TEXT_2 ordered_set gmean printlist
#TPCH BUILD PROCEDURES
proc chk_thread {} {
set chk [package provide Thread]
Expand Down Expand Up @@ -158,6 +158,28 @@ namespace eval tpchcommon {
set day [ format %02d $day ]
return [ concat $year-$month-$day ]
}
#MK_TIME_BCP
#Used for the TPCH loads that use BCP to import data. BCP Requires the month to be in integer format,
#and can't use the abbreviation of the Month name.
proc mk_time_bcp { index } {
set list {01 31 31 02 28 59 03 31 90 04 30 120 05 31 151 06 30 181 07 31 212 08 31 243 09 30 273 10 31 304 11 30 334 12 31 365}
set timekey [ expr {$index + 8035} ]
set jyd [ julian [ expr {($index + 92001 - 1)} ] ]
set y [ expr {$jyd / 1000} ]
set d [ expr {$jyd % 1000} ]
set year [ expr {1900 + $y} ]
set m 2
set n [ llength $list ]
set month [ lindex $list [ expr {$m - 2} ] ]
set day $d
while { ($d > [ expr {[ lindex $list $m ] + [ LEAP_ADJ $y [ expr {($m + 1) / 3} ]]}]) } {
set month [ lindex $list [ expr $m + 1 ] ]
set day [ expr {$d - [ lindex $list $m ] - [ LEAP_ADJ $y [ expr ($m + 1) / 3 ] ]} ]
incr m +3
}
set day [ format %02d $day ]
return [ concat $year-$month-$day ]
}
#MK_SPARSE
proc mk_sparse { i seq } {
set ok $i
Expand Down
Loading

0 comments on commit dea12f4

Please sign in to comment.