zhztheplayer commented on code in PR #6517:
URL: https://github.com/apache/incubator-gluten/pull/6517#discussion_r1743266173
##########
gluten-core/src/main/scala/org/apache/gluten/extension/columnar/OffloadSingleNode.scala:
##########
@@ -265,13 +265,35 @@ case class OffloadProject() extends OffloadSingleNode
with LogLevelUtil {
newProjectList
}
+ def replaceInputFileAttr(namedExpr: NamedExpression): NamedExpression =
namedExpr.name match {
+ case "input_file_name" =>
+ Alias(InputFileName(), namedExpr.name)(namedExpr.exprId)
+ case "input_file_block_start" =>
+ Alias(InputFileBlockStart(), namedExpr.name)(namedExpr.exprId)
+ case "input_file_block_length" =>
+ Alias(InputFileBlockLength(), namedExpr.name)(namedExpr.exprId)
+ case _ => namedExpr
+ }
+
plan match {
case f: FileSourceScanExec =>
- f.copy(output = genNewOutput(f.output))
+ if (FallbackTags.nonEmpty(f)) {
+ val p =
ProjectExec(genNewOutput(f.output).map(replaceInputFileAttr), f)
+ FallbackTags.add(p, "fallback input file expression")
+ p
+ } else {
+ f.copy(output = genNewOutput(f.output))
+ }
case f: FileSourceScanExecTransformer =>
f.copy(output = genNewOutput(f.output))
case b: BatchScanExec =>
- b.copy(output =
genNewOutput(b.output).asInstanceOf[Seq[AttributeReference]])
+ if (FallbackTags.nonEmpty(b)) {
+ val p =
ProjectExec(genNewOutput(b.output).map(replaceInputFileAttr), b)
+ FallbackTags.add(p, "fallback input file expression")
+ p
+ } else {
+ b.copy(output =
genNewOutput(b.output).asInstanceOf[Seq[AttributeReference]])
+ }
case b: BatchScanExecTransformer =>
Review Comment:
Is there real case that we see a `BatchScanExecTransformer` in
`OffloadProject`? Since `OffloadOthers` is executed after `OffloadProject`.
--
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]