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

tpch prepare support skip and only ddl #14

Merged
merged 2 commits into from
Feb 29, 2024
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
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
Loading