rubenada commented on code in PR #5213:
URL: https://github.com/apache/calcite/pull/5213#discussion_r4259836532
##########
linq4j/src/main/java/org/apache/calcite/linq4j/BaseQueryable.java:
##########
@@ -34,19 +36,21 @@
*/
public abstract class BaseQueryable<TSource>
extends AbstractQueryable<TSource> {
- protected final QueryProvider provider;
+ /** Provider, or null for a queryable that overrides {@link #enumerator()}
+ * and so never asks the provider to execute it. */
+ protected final @Nullable QueryProvider provider;
protected final Type elementType;
protected final @Nullable Expression expression;
- protected BaseQueryable(QueryProvider provider, Type elementType,
+ protected BaseQueryable(@Nullable QueryProvider provider, Type elementType,
@Nullable Expression expression) {
this.provider = provider;
this.elementType = elementType;
this.expression = expression;
}
@Override public QueryProvider getProvider() {
- return provider;
+ return requireNonNull(provider, "provider");
Review Comment:
Why the `requireNonNull` in this getter if the field is `nullable`?
Shouldn't we put the check inside `enumerator()` code?
--
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]