cloud-fan edited a comment on issue #25651: [SPARK-28948][SQL] Support passing 
all Table metadata in TableProvider
URL: https://github.com/apache/spark/pull/25651#issuecomment-544593636
 
 
   @rdblue , when I try to have separated methods `inferSchema` and 
`inferPartitioning`, problems keep popping up (mostly from file source v2).
   
   The major problems hit so far:
   1. `inferSchema`/`inferPartitioning` need to list files, and we should only 
do file listing once when we scan a directory without user-specified schema. 
This can be resolved by using a static cache or simply cache the listed files 
in the `FileDataSourceV2` instance.
   2. when writing to a directory, no schema/partition inference should be 
done. It looks to me that we need to have 2 separated methods `getTableToRead` 
and `getTableToWrite`, while `getTableToWrite` does not take 
schema/partitioning and we don't need to call 
`inferSchema`/`inferPartitioning`. But this makes the API ugly.
   
   I feel that, the existing API (`getTable` with several overloads) is more 
flexible and allows implementations to have its special logic. For example, it 
allows file source to do schema inference lazily, which won't be triggered at 
all during write.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to