Copilot commented on code in PR #383:
URL:
https://github.com/apache/doris-spark-connector/pull/383#discussion_r4466340080
##########
spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/config/DorisConfig.java:
##########
@@ -40,6 +40,20 @@ private DorisConfig(Map<String, String> options, Boolean
ignoreTableCheck) throw
checkOptions(this.configOptions);
}
+ public String[] getTableIdentifierParts() throws OptionRequiredException {
+ String[] parts =
getValue(DorisOptions.DORIS_TABLE_IDENTIFIER).split("\\.", -1);
+ if (parts.length != 2 && parts.length != 3) {
Review Comment:
Splitting on every dot rejects a valid quoted identifier such as ``
`pg_ext`.`public`.`sales.2026` `` as four parts, preventing the external table
from being read. Removing all backticks also deletes literal backticks escaped
within a name, causing schema discovery to use the wrong name. Split only on
dots outside quoted components and unescape doubled backticks, with tests for
both cases.
##########
spark-doris-connector/spark-doris-connector-base/src/main/scala/org/apache/doris/spark/util/URLs.scala:
##########
@@ -35,6 +35,9 @@ object URLs {
def tableSchema(host: String, port: Int, database: String, table: String,
enableHttps: Boolean): String =
tableSchema(s"${assemblePath(host, port)}", database, table, enableHttps)
+ def tableSchema(host: String, port: Int, tableIdentifier: Array[String],
enableHttps: Boolean): String =
+ s"${schema(enableHttps)}://${assemblePath(host,
port)}/api/${tableIdentifier.mkString("/")}/_schema"
Review Comment:
SQL identifier quoting does not escape URI path components: a table named
`order#archive` produces a schema URL whose suffix is treated as a fragment, so
the frontend receives the wrong path. Spaces and question marks also prevent
schema discovery from reaching the intended endpoint. Percent-encode each
identifier component before joining them with `/`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]