github-actions[bot] commented on code in PR #70216:
URL: https://github.com/apache/doris/pull/70216#discussion_r4489423948
##########
fe/fe-core/src/main/java/org/apache/doris/connector/ConnectorSessionBuilder.java:
##########
@@ -252,6 +252,16 @@ private static ConnectorDelegatedCredential
toConnectorCredential(DelegatedCrede
* Server-level globals (e.g., lower_case_table_names) are also included.
*/
private static Map<String, String> extractSessionProperties(ConnectContext
ctx) {
+ // Once per statement: the session variables, SET_VAR hints included,
are settled before the
+ // first session is built during plan translation. Shared as is: a
session only reads them.
+ StatementContext statementContext = ctx.getStatementContext();
+ if (statementContext == null) {
+ return readSessionProperties(ctx);
+ }
+ return statementContext.getOrComputeConnectorSessionProperties(() ->
readSessionProperties(ctx));
Review Comment:
[P2] Refresh connector properties after nested view hints
For an external Hive view whose stored SQL is `SELECT /*+
SET_VAR(read_hive_json_in_one_column=true) */ payload FROM base`, the reduced
plan is:
```
Project(payload)
ExternalView(v, stored SET_VAR(...=true))
HiveScan(base, OpenX JsonSerDe, first column payload STRING)
```
`PluginDrivenExternalTable.getViewText()` builds a connector session before
`BindRelation.parseAndAnalyzeView()` parses that definition, so this memo
already contains the default `false`. The nested parser applies the hint to the
live session, but `StatementContext.invalidCache()` never clears
`connectorSessionProperties`, and subsequent scan sessions still receive
`false`. `HiveScanPlanProvider` therefore selects JSON field extraction instead
of whole-line CSV mode: a source line `{"payload":"hello"}` returns `hello`
instead of the complete JSON-line string. The external-view path restores only
the namespace, so the internal Doris-view variable-restoration guard does not
prevent this. Invalidate/version the exported map when in-statement variables
change, preserving already-built immutable sessions, and cover a hint parsed
after the view metadata session is created.
--
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]