spark-bigquery-connector icon indicating copy to clipboard operation
spark-bigquery-connector copied to clipboard

SchemaConverters is breaking after 0.30.0, default config should be provided for the converter

Open kaiseu opened this issue 1 year ago • 7 comments

SchemaConverters.toSpark and SchemaConverters.toBigQuerySchema is static before 0.30.0, while PR923 made it not static, which breaks the application from upgrading to the latest connector, can we have a default config for the converter so that it's compatible for the existing application?

kaiseu avatar May 09 '23 14:05 kaiseu

@davidrabinowitz any suggestions?

kaiseu avatar May 09 '23 14:05 kaiseu

Can you please share a full stack trace?

davidrabinowitz avatar May 09 '23 16:05 davidrabinowitz

no stack trace, the compile would fail since the function(SchemaConverters.toSpark, SchemaConverters.toBigQuerySchema ) is static before, while after 0.30.0 it's none static.

kaiseu avatar May 10 '23 10:05 kaiseu

Can you share more about your usecase? Why do you need to compile against this class?

davidrabinowitz avatar May 10 '23 15:05 davidrabinowitz

@davidrabinowitz we regard SchemaConverters as a util to convert schema between spark and bq in our app.

kaiseu avatar May 16 '23 03:05 kaiseu

Looks like configuration is never used within the class. You could pass null as a workaround. I think we could change everything to static since there's no configuration? @davidrabinowitz wdyt?

vishalkarve15 avatar Jul 11 '23 04:07 vishalkarve15

It is there for an upcoming feature. There may be another way to implement it, so we can restore SchemaConverters.

davidrabinowitz avatar Jul 12 '23 01:07 davidrabinowitz

@kaiseu we can't make the above mentioned functions static as we are using the configuration. You can use SchemaConverters.from(SchemaConvertersConfiguration.createDefault()) to make a call to those functions. Please check the allowMapTypeConversion property if you would want to set it in the SchemaConvertersConfiguration.

isha97 avatar Apr 02 '24 22:04 isha97