-
Notifications
You must be signed in to change notification settings - Fork 24
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
[BigQuery] Missed one spot for aliasing #690
Conversation
lib/kafkalib/partition/settings.go
Outdated
@@ -43,7 +44,7 @@ func (b *BigQuerySettings) GenerateMergeString(values []string) (string, error) | |||
case "time": | |||
switch b.PartitionBy { | |||
case "daily": | |||
return fmt.Sprintf(`DATE(c.%s) IN (%s)`, b.PartitionField, array.StringsJoinAddSingleQuotes(values)), nil | |||
return fmt.Sprintf(`DATE(%s.%s) IN (%s)`, constants.TargetAlias, b.PartitionField, array.StringsJoinAddSingleQuotes(values)), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sneaky!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is b.PartitionField
always a column? Should we be quoting it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so could do sql.QuoteTableAliasColumns(constants.TargetAlias, columns.Column(b.PartitionField, typing.Invalid), BigQueryDialect{})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using the sql
package at all may cause an import cycle, so maybe something to look at after this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should escape it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave a TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I can just move this to the bq pkg
@@ -49,3 +53,29 @@ func (s *Store) Merge(tableData *optimization.TableData) error { | |||
RetryColBackfill: true, | |||
}) | |||
} | |||
|
|||
func generateMergeString(bqSettings *partition.BigQuerySettings, dialect sql.Dialect, values []string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
As per title