@@ -1183,6 +1183,37 @@ public actor SparkConnectClient {
1183
1183
return try await execute ( self . sessionID!, command)
1184
1184
}
1185
1185
1186
+ @discardableResult
1187
+ func createDataflowGraph(
1188
+ _ defaultCatalog: String ? = nil ,
1189
+ _ defaultDatabase: String ? = nil ,
1190
+ _ sqlConf: [ String : String ] ? = nil
1191
+ ) async throws -> String {
1192
+ try await withGPRC { client in
1193
+ var graph = Spark_Connect_PipelineCommand . CreateDataflowGraph ( )
1194
+ if let defaultCatalog {
1195
+ graph. defaultCatalog = defaultCatalog
1196
+ }
1197
+ if let defaultDatabase {
1198
+ graph. defaultDatabase = defaultDatabase
1199
+ }
1200
+ if let sqlConf {
1201
+ graph. sqlConf = sqlConf
1202
+ }
1203
+
1204
+ var pipelineCommand = Spark_Connect_PipelineCommand ( )
1205
+ pipelineCommand. commandType = . createDataflowGraph( graph)
1206
+
1207
+ var command = Spark_Connect_Command ( )
1208
+ command. commandType = . pipelineCommand( pipelineCommand)
1209
+
1210
+ let response = try await execute ( self . sessionID!, command)
1211
+ let result = response. first!. pipelineCommandResult. createDataflowGraphResult
1212
+
1213
+ return result. dataflowGraphID
1214
+ }
1215
+ }
1216
+
1186
1217
private enum URIParams {
1187
1218
static let PARAM_GRPC_MAX_MESSAGE_SIZE = " grpc_max_message_size "
1188
1219
static let PARAM_SESSION_ID = " session_id "
0 commit comments