• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JohnSnowLabs / spark-nlp / 4947838414

pending completion
4947838414

Pull #13796

github

GitHub
Merge 30bdeef19 into ef7906c5e
Pull Request #13796: Add unzip param to downloadModelDirectly in ResourceDownloader

39 of 39 new or added lines in 2 files covered. (100.0%)

8632 of 13111 relevant lines covered (65.84%)

0.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/main/scala/com/johnsnowlabs/storage/HasStorageModel.scala
1
/*
2
 * Copyright 2017-2022 John Snow Labs
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *    http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.johnsnowlabs.storage
18

19
import org.apache.spark.sql.SparkSession
20

21
trait HasStorageModel extends HasStorageReader with HasStorageOptions {
22

23
  protected val databases: Array[Database.Name]
24

25
  def serializeStorage(path: String, spark: SparkSession): Unit = {
26
    if ($(includeStorage))
×
27
      saveStorage(path, spark, withinStorage = true)
1✔
28
  }
29

30
  def saveStorage(path: String, spark: SparkSession, withinStorage: Boolean = false): Unit = {
31
    databases.foreach(database => {
1✔
32
      StorageHelper.save(path, getReader(database).getConnection, spark, withinStorage)
1✔
33
    })
34
  }
35

36
  override protected def onWrite(path: String, spark: SparkSession): Unit = {
37
    serializeStorage(path, spark)
1✔
38
  }
39

40
  def deserializeStorage(path: String, spark: SparkSession): Unit = {
41
    if ($(includeStorage))
1✔
42
      databases.foreach(database => {
1✔
43
        StorageHelper.load(path, spark, database.toString, $(storageRef), withinStorage = true)
1✔
44
      })
45
  }
46

47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc