Vamsi-klu commented on code in PR #68144:
URL: https://github.com/apache/airflow/pull/68144#discussion_r3406331095
##########
providers/apache/hive/src/airflow/providers/apache/hive/hooks/hive.py:
##########
@@ -212,6 +220,23 @@ def _prepare_cli_cmd(self) -> list[Any]:
return [hive_bin, *cmd_extra, *hive_params_list]
+ def _append_jdbc_params(self, jdbc_url: str) -> str:
+ if not self.jdbc_params:
+ return jdbc_url
+ segments = []
+ for name, value in self.jdbc_params.items():
+ if not isinstance(name, str) or not
JDBC_PARAMETER_NAME_PATTERN.fullmatch(name):
+ raise ValueError(
+ f"Invalid JDBC parameter name {name!r}: must match
{JDBC_PARAMETER_NAME_PATTERN.pattern}"
+ )
+ if value is None or ";" in str(value):
Review Comment:
Good point. I pushed a small follow-up so empty-string JDBC values are
treated as unset and skipped, while non-string values are rejected instead of
being stringified. That keeps us from emitting `name=` and from accidentally
appending Python reprs like dicts/lists.
Valid non-empty strings still append in insertion order, and semicolons are
still rejected. I added tests covering all-empty/partially-empty values and
non-string values (`None`, `int`, `bool`, and `dict`).
--
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]