huaxingao commented on a change in pull request #35768:
URL: https://github.com/apache/spark/pull/35768#discussion_r825594415
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala
##########
@@ -94,6 +96,74 @@ object JDBCRDD extends Logging {
new StructType(columns.map(name => fieldMap(name)))
}
+ def translateFilterV1ToV2(f: Filter): Option[Predicate] = {
Review comment:
Sorry, I didn't make myself clear. What I meant is to move the
`translateFilterV1ToV2` out of JDBC so I can reuse this in file source. In
`sources.filters`, have something like this:
```
sealed abstract class Filter {
......
private[sql] def toV2: Predicate
}
```
Then implement this in each of the V1 Filters, for example:
```
case class EqualTo(attribute: String, value: Any) extends Filter {
......
def toV2: Predicate = {
checkColumnName(attribute)
new Predicate("=",
Array(FieldReference(attribute), LiteralValue(value,
Literal(value).dataType)))
}
}
```
--
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]