I am considering to create a custom DataSource above Google AppEngine's DataStore, and I have a couple of generic questions about implementing DataSources.
Q1: Ideally, all the requested criteria (and sort instructions) can be fully translated to the query language of the underlying data storage. However, this is not necessarily true; there can be situations when the wanted query is not supported. (For example, DataStore queries to not support more than one inequality conditions at a time.) Is it required for all DataSource implementations to support all possible combinations of criteria and advanced criteria? (Since I have never ready anything to suggest that the notion of "unsupported criteria" would exist, I guess it is required, but want to be sure.)
Possible answers:
A) No, in these cases, I can throw some kind of "CriteriaNotSupportedException". Q2: What happens in these cases?
B), Yes, it's required to implement support for all possible criteria, independently of whatever the underlying layer supports. If something is not natively supported, then I just have to do the required filtering/merging/sorting in the DataSource implementation layer. Is there some built-in support for this? (I am thinking of a method to be called when a (probably partially filtered) set of objects was already received from the underlying data storage, and translated to a list of maps. Then this method could do one more round of filtering, executing any remaining (not natively supported) criteria. Such common method could be used by all DataSource implementations.) Q3: Does such thing exists? If no, then is it planned? (If no and no, then why not?)
C) I am misunderstanding something, so the above questions are wrong, or the answers are completely different. (In this case, please elaborate.)
Thank you for your help!
Q1: Ideally, all the requested criteria (and sort instructions) can be fully translated to the query language of the underlying data storage. However, this is not necessarily true; there can be situations when the wanted query is not supported. (For example, DataStore queries to not support more than one inequality conditions at a time.) Is it required for all DataSource implementations to support all possible combinations of criteria and advanced criteria? (Since I have never ready anything to suggest that the notion of "unsupported criteria" would exist, I guess it is required, but want to be sure.)
Possible answers:
A) No, in these cases, I can throw some kind of "CriteriaNotSupportedException". Q2: What happens in these cases?
B), Yes, it's required to implement support for all possible criteria, independently of whatever the underlying layer supports. If something is not natively supported, then I just have to do the required filtering/merging/sorting in the DataSource implementation layer. Is there some built-in support for this? (I am thinking of a method to be called when a (probably partially filtered) set of objects was already received from the underlying data storage, and translated to a list of maps. Then this method could do one more round of filtering, executing any remaining (not natively supported) criteria. Such common method could be used by all DataSource implementations.) Q3: Does such thing exists? If no, then is it planned? (If no and no, then why not?)
C) I am misunderstanding something, so the above questions are wrong, or the answers are completely different. (In this case, please elaborate.)
Thank you for your help!
Comment