-
Notifications
You must be signed in to change notification settings - Fork 25
Add Enhanced Ingestion Mode to genddl Tool #92
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
base: main
Are you sure you want to change the base?
Changes from 8 commits
9fd2ef6
ae4012a
9a9d02b
45b4cfa
71d7afd
0ea9281
3ea971e
35d4d71
c61f262
8ebfd42
6a21284
1086215
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "mode": "enhanced_ingestion", | ||
| "scale_factor": "1", | ||
| "file_format": "parquet", | ||
| "compression_method": "uncompressed", | ||
| "workload": "tpcds", | ||
| "workload_definition": "tpc-ds", | ||
| "iceberg": true, | ||
| "partitioned": false, | ||
| "source_file_format": "CSV", | ||
| "source_catalog": "hive", | ||
| "target_catalog": "iceberg", | ||
| "source_schema": "tpcds_source", | ||
| "target_schema": "tpcds_target", | ||
| "s3_source_location": "s3a://test-bucket/source", | ||
| "s3_target_location": "s3a://test-bucket/target", | ||
| "engine": "presto", | ||
| "session_variables": {} | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| {{- /*gotype:pbench/cmd/genddl.Schema*/ -}} | ||
| {{- /* This template is used for ENHANCED_INGESTION mode - creates source tables */ -}} | ||
| {{- if .SourceSchema }} | ||
| {{- if .SourceCatalog }} | ||
| CREATE SCHEMA IF NOT EXISTS {{ .SourceCatalog }}.{{ .SourceSchema }} | ||
| WITH ( | ||
| location = '{{ .S3SourceLocation }}/' | ||
| ); | ||
|
|
||
| USE {{ .SourceCatalog }}.{{ .SourceSchema }}; | ||
| {{- else }} | ||
| CREATE SCHEMA IF NOT EXISTS hive.{{ .SourceSchema }} | ||
| WITH ( | ||
| location = '{{ .S3SourceLocation }}/' | ||
| ); | ||
|
|
||
| USE hive.{{ .SourceSchema }}; | ||
| {{- end }} | ||
|
|
||
| {{ range .Tables }} | ||
| CREATE TABLE IF NOT EXISTS {{ .Name }} ( | ||
| {{- $first := true }} | ||
| {{- range .Columns }} | ||
| {{- if $first }} | ||
| {{- $first = false }} | ||
| {{- else }}, | ||
| {{- end }} | ||
| {{- if eq $.SourceFileFormat "CSV" }} | ||
| {{ .Name }} varchar | ||
| {{- else }} | ||
| {{ .Name }} {{ .Type }} | ||
| {{- end }} | ||
| {{- end }}) | ||
| WITH ( | ||
| external_location = '{{ $.S3SourceLocation }}/{{ .Name }}/', | ||
| {{- if eq $.SourceFileFormat "CSV" }} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| format = 'CSV', | ||
| csv_separator = '|' | ||
| {{- else }} | ||
| format = 'TEXTFILE', | ||
| textfile_field_delim = '|' | ||
| {{- end }} | ||
| ); | ||
| {{ end }} | ||
| {{- end }} | ||
|
yabinma marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| {{- /*gotype:pbench/cmd/genddl.Schema*/ -}} | ||
| {{- /* This template is used for ENHANCED_INGESTION mode - creates target tables */ -}} | ||
| {{- if .TargetSchema }} | ||
| {{- if .TargetCatalog }} | ||
| CREATE SCHEMA IF NOT EXISTS {{ .TargetCatalog }}.{{ .TargetSchema }} | ||
| WITH ( | ||
| location = '{{ .S3TargetLocation }}/' | ||
| ); | ||
|
|
||
| USE {{ .TargetCatalog }}.{{ .TargetSchema }}; | ||
| {{- else }} | ||
| {{- if .Iceberg }} | ||
| CREATE SCHEMA IF NOT EXISTS iceberg.{{ .TargetSchema }} | ||
| WITH ( | ||
| location = '{{ .S3TargetLocation }}/' | ||
| ); | ||
|
|
||
| USE iceberg.{{ .TargetSchema }}; | ||
| {{- else }} | ||
| CREATE SCHEMA IF NOT EXISTS hive.{{ .TargetSchema }} | ||
| WITH ( | ||
| location = '{{ .S3TargetLocation }}/' | ||
| ); | ||
|
|
||
| USE hive.{{ .TargetSchema }}; | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{ range .Tables }} | ||
| CREATE TABLE IF NOT EXISTS {{ .Name }} ( | ||
| {{- $first := true }} | ||
| {{- range .Columns }} | ||
| {{- if $first }} | ||
| {{- $first = false }} | ||
| {{- else -}} | ||
| , | ||
| {{- end }} | ||
| {{ .Name }} {{ .Type }} | ||
| {{- end }} | ||
| ) | ||
| WITH ( | ||
| format = 'PARQUET' | ||
| {{- if and $.Partitioned .Partitioned }} | ||
| {{- if $.Iceberg}} | ||
| , partitioning = array['{{ .LastColumn.Name }}'] | ||
| {{- else }} | ||
| , partitioned_by = array['{{ .LastColumn.Name }}'] | ||
| {{- end }} | ||
| {{- end }} | ||
| ); | ||
| {{ end }} | ||
| {{- end }} | ||
|
yabinma marked this conversation as resolved.
Outdated
|
||
Uh oh!
There was an error while loading. Please reload this page.