Skip to content

Commit

Permalink
Merge pull request #14 from cyliu0/tpch-prepare-ddl
Browse files Browse the repository at this point in the history
tpch prepare support skip and only ddl
  • Loading branch information
cyliu0 authored Feb 29, 2024
2 parents fecebf7 + eb5d49d commit 5d515d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions cmd/go-tpc/tpch.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ func registerTpch(root *cobra.Command) {
20,
"kafka flush timeout seconds",
)
cmdPrepare.PersistentFlags().BoolVar(&tpchConfig.SkipDdl,
"skip-ddl",
false,
"tpch prepare skip ddl (default false)",
)
cmdPrepare.PersistentFlags().BoolVar(&tpchConfig.OnlyDdl,
"only-ddl",
false,
"tpch prepare only ddl (default false)",
)

var cmdRun = &cobra.Command{
Use: "run",
Expand Down
11 changes: 10 additions & 1 deletion tpch/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ type Config struct {
KafkaAddr string
KafkaFlushMsgCount int
KafkaFlushTimeoutSeconds int

// DDL
SkipDdl bool
OnlyDdl bool
}

type tpchState struct {
Expand Down Expand Up @@ -128,11 +132,16 @@ func (w *Workloader) Prepare(ctx context.Context, threadID int) error {
if threadID != 0 {
return nil
}
if w.cfg.OutputType != "kafka" {
if w.cfg.OutputType != "kafka" && !w.cfg.SkipDdl {
if err := w.createTables(ctx); err != nil {
return err
}
}

if w.cfg.OnlyDdl {
return nil
}

var sqlLoader map[dbgen.Table]dbgen.Loader
if w.cfg.OutputType == "csv" {
if _, err := os.Stat(w.cfg.OutputDir); err != nil {
Expand Down

0 comments on commit 5d515d5

Please sign in to comment.