Skip to content

Commit

Permalink
[Bug] extract programArgs bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
benjobs committed Nov 11, 2023
1 parent 8f3fc72 commit a73f351
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,18 @@ object PropertiesUtils extends Logger {
}
}
programArgs += value.substring(1, value.length - 1)
case _ => programArgs += v
case _ =>
val regexp = "(.*)='(.*)'$"
if (v.matches(regexp)) {
programArgs += v.replaceAll(regexp, "$1=$2")
} else {
val regexp = "(.*)=\"(.*)\"$"
if (v.matches(regexp)) {
programArgs += v.replaceAll(regexp, "$1=$2")
} else {
programArgs += v
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,20 @@ import scala.language.postfixOps
class PropertiesUtilsTestCase {

@Test def testExtractProgramArgs(): Unit = {
val args =
"mysql-sync-database \n--database employees \n--mysql-conf hostname=127.0.0.1 \n--mysql-conf port=3306 \n--mysql-conf username=root \n--mysql-conf password=123456 \n--mysql-conf database-name=employees \n--including-tables 'test|test.*' \n--sink-conf fenodes=127.0.0.1:8030 \n--sink-conf username=root \n--sink-conf password= \n--sink-conf jdbc-url=jdbc:mysql://127.0.0.1:9030 \n--sink-conf sink.label-prefix=label\n--table-conf replication_num=1 "
val args = "mysql-sync-table \n" +
"--warehouse hdfs:///paimon \n" +
"--database test_db \n" +
"--table test_table \n" +
"--mysql-conf hostname=localhost \n" +
"--mysql-conf username=root \n" +
"--mysql-conf password=123456 \n" +
"--mysql-conf database-name='employees' \n" +
"--mysql-conf table-name='employees' \n" +
"--catalog-conf metastore=hive \n" +
"--catalog-conf uri=thrift://localhost:9083 \n" +
"--table-conf bucket=1 \n" +
"--table-conf changelog-producer=input \n" +
"--table-conf sink.parallelism=1"
val programArgs = new ArrayBuffer[String]()
programArgs ++= PropertiesUtils.extractArguments(args)
println(programArgs)
Expand Down

0 comments on commit a73f351

Please sign in to comment.