vinlee19 commented on code in PR #383:
URL:
https://github.com/apache/doris-flink-connector/pull/383#discussion_r1596325845
##########
flink-doris-connector/src/main/java/org/apache/doris/flink/table/DorisDynamicTableSource.java:
##########
@@ -212,5 +200,17 @@ public boolean supportsNestedProjection() {
@Override
public void applyProjection(int[][] projectedFields, DataType
producedDataType) {
this.physicalRowDataType =
Projection.of(projectedFields).project(physicalRowDataType);
+ if (StringUtils.isNullOrWhitespaceOnly(readOptions.getFilterQuery())) {
+ String filterQuery =
resolvedFilterQuery.stream().collect(Collectors.joining(" AND "));
+ this.readOptions.setFilterQuery(filterQuery);
+ }
+ if (StringUtils.isNullOrWhitespaceOnly(readOptions.getReadFields())) {
+ String[] selectFields =
+ DataType.getFieldNames(physicalRowDataType).toArray(new
String[0]);
+ this.readOptions.setReadFields(
+ Arrays.stream(selectFields)
+ .map(item -> String.format("`%s`",
item.trim().replace("`", "")))
+ .collect(Collectors.joining(", ")));
+ }
Review Comment:
The method `getScanRuntimeProvider` is executed before `applyProjection`.
Therefore, initializing `readFields` in `getScanRuntimeProvider` will result in
querying all fields in Doris, leading to type conversion errors.
--
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]