Skip to content

Commit 8f95b2b

Browse files
wip
Co-authored-by: Thomas Chow <[email protected]>
1 parent 36d2a18 commit 8f95b2b

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

.plugin-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git b5862c1
2+
gcloud https://github.com/jthegedus/asdf-gcloud.git 00cdf06
23
java https://github.com/halcyon/asdf-java.git 0ec69b2
34
python https://github.com/danhper/asdf-python.git a3a0185
45
sbt https://github.com/lerencao/asdf-sbt 53c9f4b
56
scala https://github.com/asdf-community/asdf-scala.git 0533444
7+
thrift https://github.com/alisaifee/asdf-thrift.git fecdd6c

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ sbt 1.8.2
55
python
66
3.7.17
77
3.11.0
8+
gcloud 504.0.1

api/py/test/sample/group_bys/__init__.py

Whitespace-only changes.

cloud_gcp/src/main/scala/ai/chronon/integrations/cloud_gcp/BigQueryFormat.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ case class GcpFormatProvider(sparkSession: SparkSession) extends FormatProvider
3838
// Fixed to BigQuery for now.
3939
override def writeFormat(tableName: String): Format = {
4040

41+
val tableId = BigQueryUtil.parseTableId(tableName)
42+
assert(Option(tableId.getProject).isDefined, s"project required for ${tableName}")
43+
assert(Option(tableId.getDataset).isDefined, s"dataset required for ${tableName}")
44+
4145
val tu = TableUtils(sparkSession)
4246
val partitionColumnOption =
4347
if (tu.tableReachable(tableName)) Map.empty else Map("partitionField" -> tu.partitionColumn)
@@ -49,7 +53,7 @@ case class GcpFormatProvider(sparkSession: SparkSession) extends FormatProvider
4953
), // todo(tchow): No longer needed after https://github.com/GoogleCloudDataproc/spark-bigquery-connector/pull/1320
5054
"writeMethod" -> "indirect"
5155
) ++ partitionColumnOption
52-
BQuery(bqOptions.getProjectId, sparkOptions)
56+
BQuery(tableId.getProject, sparkOptions)
5357
}
5458

5559
private def format(tableName: String): Format = {
@@ -82,7 +86,7 @@ case class GcpFormatProvider(sparkSession: SparkSession) extends FormatProvider
8286
BQuery(table.getTableId.getProject, Map.empty)
8387
} else throw new IllegalStateException(s"Cannot support table of type: ${table.getDefinition}")
8488
})
85-
.getOrElse(Hive)
89+
.getOrElse(Option(btTableIdentifier.getProject).map(BQuery(_, Map.empty)).getOrElse(Hive))
8690

8791
/**
8892
* Using federation

0 commit comments

Comments
 (0)