@@ -66,13 +66,15 @@ class BigQueryPlugin(spark: SparkSession)
66
66
67
67
def bigQueryConfig = {
68
68
SparkBigQueryConfig .from(
69
- ImmutableMap .copyOf( cmd.options.asJava) ,
69
+ cmd.options.asJava,
70
70
ImmutableMap .copyOf(spark.conf.getAll.asJava),
71
71
spark.sparkContext.hadoopConfiguration,
72
+ ImmutableMap .of,
72
73
0 ,
73
74
spark.sessionState.conf,
74
75
spark.version,
75
- Optional .empty()
76
+ Optional .empty(),
77
+ true
76
78
)
77
79
}
78
80
@@ -145,9 +147,10 @@ object BigQueryPlugin {
145
147
.find(
146
148
m => m.getName == " from"
147
149
&& isStatic(m.getModifiers)
148
- && m.getParameterTypes.length == 7
150
+ && ( m.getParameterTypes.length == 7 || m.getParameterTypes.length == 8 || m.getParameterTypes.length == 9 )
149
151
&& m.getReturnType.getSimpleName == " SparkBigQueryConfig"
150
- ).getOrElse(sys.error(s " Cannot find method `public static SparkBigQueryConfig from(... {7 args} ...)` in the class ` $clazz` " ))
152
+ )
153
+ .getOrElse(sys.error(s " Cannot find method `public static SparkBigQueryConfig from(... {7|8|9 args} ...)` in the class ` $clazz` " ))
151
154
152
155
object ImmutableMap {
153
156
type ImmutableMap = AnyRef
@@ -157,12 +160,22 @@ object BigQueryPlugin {
157
160
.getMethod(" copyOf" , classOf [java.util.Map [_, _]])
158
161
.invoke(imClass, _)
159
162
.asInstanceOf [ImmutableMap ]
163
+ val of : ImmutableMap =
164
+ imClass
165
+ .getMethod(" of" )
166
+ .invoke(imClass)
167
+ .asInstanceOf [ImmutableMap ]
160
168
}
161
169
162
- val from : (ImmutableMap .ImmutableMap , ImmutableMap .ImmutableMap , Configuration , Integer , SQLConf , String , Optional [StructType ]) => SparkBigQueryConfig =
163
- methodFrom
164
- .invoke(clazz, _, _, _, _, _, _, _)
165
- .asInstanceOf [SparkBigQueryConfig ]
170
+ val from : (java.util.Map [_, _], ImmutableMap .ImmutableMap , Configuration , ImmutableMap .ImmutableMap , Integer , SQLConf , String , Optional [StructType ], java.lang.Boolean ) => SparkBigQueryConfig = {
171
+ case (a, b, c, d, e, f, g, h, i) => {
172
+ methodFrom.getParameterTypes.length match {
173
+ case 7 => methodFrom.invoke(clazz, a, b, c, e, f, g, h).asInstanceOf [SparkBigQueryConfig ]
174
+ case 8 => methodFrom.invoke(clazz, a, b, c, e, f, g, h, i).asInstanceOf [SparkBigQueryConfig ]
175
+ case 9 => methodFrom.invoke(clazz, a, b, c, d, e, f, g, h, i).asInstanceOf [SparkBigQueryConfig ]
176
+ }
177
+ }
178
+ }
166
179
}
167
180
168
181
private object `_: DirectBigQueryRelation` extends SafeTypeMatchingExtractor [AnyRef ](" com.google.cloud.spark.bigquery.direct.DirectBigQueryRelation" )
0 commit comments