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

BigQuery: Improve intermediate Avro methods #1679

Closed
wants to merge 2 commits into from

Conversation

Amogh-Bharadwaj
Copy link
Contributor

  • Refactors DefineAvroSchema to now use the source schema instead of the target BigQuery table schema. This is consistent with Snowflake and Clickhouse, albeit not using the single method they both share - this is due to some type behaviour differences in BQ (Ex: timestamps).
  • Refactors qValueKindToBigQueryType's return body to contain array (repeated) information, instead of relying on the assumption that source arrays are mapped to BQ arrays

Comment on lines +286 to +288
func GetAvroType(sourceField *qvalue.QField) (interface{}, error) {
avroNumericPrecision := int16(sourceField.Precision)
avroNumericScale := int16(sourceField.Scale)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func GetAvroType(sourceField *qvalue.QField) (interface{}, error) {
avroNumericPrecision := int16(sourceField.Precision)
avroNumericScale := int16(sourceField.Scale)
func GetAvroType(sourceField *qvalue.QField) (interface{}, error) {
avroNumericPrecision := sourceField.Precision
avroNumericScale := sourceField.Scale

@serprex
Copy link
Contributor

serprex commented May 7, 2024

Does this fix any existing issues?

@Amogh-Bharadwaj
Copy link
Contributor Author

Amogh-Bharadwaj commented May 7, 2024

Does this fix any existing issues?

No, but it allows for data type mapping configuration for bigquery
This is not currently possible as avro definition is with respect to BQ schema while avro writing is with respect to postgres schema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants