我是 gcloud 和 BigQuery 的新手,想使用 spark 从 BigQuery 读取数据。我使用了适用于 Java 的 Google API 客户端库。并能够与 BigQuery 连接。我得到了com.google.api.services.bigquery.Bigquery对象并能够打印读取的数据集、tableId 和 tableData
我的问题是
如何将此 BigQuery 身份验证对象(凭据对象)连接到 spark 或者无论如何将此对象与 hadoopApi 一起使用
如果不可能将凭证对象传递给 newHadoopAPi
GoogleAuthorizationCodeFlow flow = getFlow();
GoogleTokenResponse response = flow.newTokenRequest(authorizationCode)
.setRedirectUri(REDIRECT_URI).execute();
Credential credential=flow.createAndStoreCredential(response, null);
return credential;
我的 Hadoop api 代码是我想使用我的凭证对象的地方
val tableData = sc.newAPIHadoopRDD(
conf,
classOf[GsonBigQueryInputFormat],
classOf[LongWritable],
classOf[JsonObject]).