beliefer edited a comment on issue #24647: [SPARK-27776][SQL]Avoid duplicate 
Java reflection in DataSource.
URL: https://github.com/apache/spark/pull/24647#issuecomment-494214438
 
 
   > I'm not sure about the contract here, whether providers are required to be 
stateless. If they're not then this would be a problem for another instance 
that has state, or if these acquire state at some point.
   
   First of all, I am glad to see your reply.
   I have the same question as you.I investigate all the providers and found 
every implementation is stateless indeed. I even investigated the providers 
provided by third parties, such as 
`com.mongodb.spark.sql.DefaultSource`,`org.elasticsearch.spark.sql.DefaultSource`.
   We gain to ensure it by adding a contract, such as an annotation `Stateless`.
   
   Another reason I created this PR is 
`providingClass.getConstructor().newInstance()` is only called in 
`org.apache.spark.sql.execution.datasources.DataSource`. The behavior provides 
a good encapsulation.
   I modified `providingInstance` with private, so as to advance the 
encapsulation.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to