Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BCP Option for MSSQLS TPCH Load #611

Merged
merged 6 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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