diff --git a/streamingpro-core/src/main/java/tech/mlsql/dsl/includes/ScriptIncludeSource.scala b/streamingpro-core/src/main/java/tech/mlsql/dsl/includes/ScriptIncludeSource.scala index 19ffecef0..a321a4628 100644 --- a/streamingpro-core/src/main/java/tech/mlsql/dsl/includes/ScriptIncludeSource.scala +++ b/streamingpro-core/src/main/java/tech/mlsql/dsl/includes/ScriptIncludeSource.scala @@ -53,16 +53,28 @@ class ScriptIncludeSource extends IncludeSource with Logging { case "byzer" | "byz" | "by" | "py" => newPathChunk = newPathChunk.dropRight(1) suffix = pathChunk.last + case _ => + } - + newPathChunk.drop(1).foreach { item => rootPath.add(item) } val finalPath = rootPath.toPath + "." + suffix - Source.fromFile(finalPath).getLines().mkString("\n") + val action = options.getOrElse("__action__", "set") + val leftParams = options - "__action__" + + val generateCode = action match { + case "set" => leftParams.map { item => + s"""set ${item._1}='''${item._2}''';""" + }.mkString("\n") + case _ => "" + } + + generateCode + Source.fromFile(finalPath).getLines().mkString("\n") } override def skipPathPrefix: Boolean = true diff --git a/streamingpro-it/src/test/resources/sql/simple/pr_1633.mlsql b/streamingpro-it/src/test/resources/sql/simple/pr_1633.mlsql new file mode 100644 index 000000000..48f83e4f8 --- /dev/null +++ b/streamingpro-it/src/test/resources/sql/simple/pr_1633.mlsql @@ -0,0 +1,8 @@ +--%comparator=tech.mlsql.it.IgnoreResultComparator + +include lib.`gitee.com/allwefantasy/lib-core` +where alias="libCore"; + +include local.`libCore.udf.hello`; +select hello() as name as output; +!assert output ''' :name == "hello world" ''' "output should be 'hello world'"; \ No newline at end of file