924060929 commented on code in PR #68853:
URL: https://github.com/apache/doris/pull/68853#discussion_r4665310402
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NestedColumnPruning.java:
##########
@@ -749,6 +751,10 @@ public static DataTypeAccessTree of(DataType type,
ColumnAccessPathType pathType
} else if (type instanceof MapType) {
root.children.put(AccessPathInfo.ACCESS_MAP_KEYS,
of(((MapType) type).getKeyType(), pathType));
root.children.put(AccessPathInfo.ACCESS_MAP_VALUES,
of(((MapType) type).getValueType(), pathType));
+ } else if (type instanceof FileType) {
Review Comment:
`StructType` and `FileType` already both expose `getFields()` and
`getField(name)`. Could we put those methods on a small shared interface and
use it here and when resolving a path component below? That would give the
pruner one way to enumerate and look up named children. FILE can keep its
distinct SQL type and fixed six-field layout even when a scan requests a single
child.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -1161,7 +1162,14 @@ public PlanFragment
visitPhysicalTVFRelation(PhysicalTVFRelation tvfRelation, Pl
TableValuedFunctionIf catalogFunction =
tvfRelation.getFunction().getCatalogFunction();
SessionVariable sv = ConnectContext.get().getSessionVariable();
- ScanNode scanNode =
catalogFunction.getScanNode(context.nextPlanNodeId(), tupleDescriptor, sv);
+ ScanNode scanNode;
+ if (catalogFunction instanceof ListFilesTableValuedFunction) {
Review Comment:
Could `getScanNode` take a narrow interface for resolving a resource
snapshot for this query? `LIST_FILES` could request its named resource through
that interface, and this translator could keep one call for all table-valued
functions. The same dependency matters for scalar functions: the point-query
rule currently searches for `ToFile.class` because that executor cannot supply
query resources. Letting functions declare that requirement would let the rule
check it directly and would also cover the next function that needs a resource.
`PlanTranslatorContext` can continue to own and reuse the snapshots.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java:
##########
@@ -182,6 +182,14 @@ private static boolean isUnsafeDateArithmetic(Expression
expression) {
return false;
}
+ /** Reject FILE values in SQL keys that require comparison, ordering, or
hashing. */
+ public static void checkFileKey(Expression value, String operation) {
Review Comment:
Could we express this as a type capability for each operation? The
`operation` parameter only changes the error text, so each caller still has to
know that FILE needs special handling. For example, `MIN_BY(value, key)` needs
ordering only for `key`. The function can identify that operand, and its bound
type can decide whether it supports ordering, including through an array
element. Sorting, grouping and deduplication could then ask for the capability
they actually use, and a future type could define its behavior in one place.
--
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]