forked from byzer-org/byzer-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
526794b
commit f29b8ef
Showing
5 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
streamingpro-mlsql/src/main/java/tech/mlsql/dsl/includes/StoreIncludeSource.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package tech.mlsql.dsl.includes | ||
|
||
import org.apache.http.client.fluent.Request | ||
import org.apache.spark.sql.SparkSession | ||
import org.apache.spark.sql.mlsql.session.MLSQLException | ||
import streaming.common.PathFun | ||
import streaming.dsl.IncludeSource | ||
import streaming.log.Logging | ||
|
||
/** | ||
* 2019-05-12 WilliamZhu([email protected]) | ||
*/ | ||
class StoreIncludeSource extends IncludeSource with Logging { | ||
override def fetchSource(sparkSession: SparkSession, path: String, options: Map[String, String]): String = { | ||
|
||
val res = Request.Get(PathFun("http://repo.store.mlsql.tech").add(path).toPath) | ||
.connectTimeout(60 * 1000) | ||
.socketTimeout(10 * 60 * 1000) | ||
.execute().returnContent().asString() | ||
|
||
if (res == null) { | ||
throw new MLSQLException( | ||
s""" | ||
|${path} is not found | ||
""".stripMargin) | ||
} | ||
res | ||
} | ||
|
||
override def skipPathPrefix: Boolean = true | ||
} |