org.apache.calcite.linq4j.DefaultQueryable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of calcite-linq4j Show documentation
Show all versions of calcite-linq4j Show documentation
Calcite APIs for LINQ (Language-Integrated Query) in Java
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.calcite.linq4j;
import org.apache.calcite.linq4j.function.BigDecimalFunction1;
import org.apache.calcite.linq4j.function.DoubleFunction1;
import org.apache.calcite.linq4j.function.EqualityComparer;
import org.apache.calcite.linq4j.function.FloatFunction1;
import org.apache.calcite.linq4j.function.Function1;
import org.apache.calcite.linq4j.function.Function2;
import org.apache.calcite.linq4j.function.IntegerFunction1;
import org.apache.calcite.linq4j.function.LongFunction1;
import org.apache.calcite.linq4j.function.NullableBigDecimalFunction1;
import org.apache.calcite.linq4j.function.NullableDoubleFunction1;
import org.apache.calcite.linq4j.function.NullableFloatFunction1;
import org.apache.calcite.linq4j.function.NullableIntegerFunction1;
import org.apache.calcite.linq4j.function.NullableLongFunction1;
import org.apache.calcite.linq4j.function.Predicate1;
import org.apache.calcite.linq4j.function.Predicate2;
import org.apache.calcite.linq4j.tree.FunctionExpression;
import java.math.BigDecimal;
import java.util.Comparator;
/**
* Implementation of the {@link Queryable} interface that
* implements the extension methods by calling into the {@link Extensions}
* class.
*
* @param Element type
*/
abstract class DefaultQueryable extends DefaultEnumerable
implements Queryable, OrderedQueryable {
private final QueryableFactory factory;
/**
* Creates a DefaultQueryable using a factory that records events.
*/
protected DefaultQueryable() {
this(QueryableRecorder.instance());
}
/**
* Creates a DefaultQueryable using a particular factory.
*/
protected DefaultQueryable(QueryableFactory factory) {
this.factory = factory;
}
// override return type
@Override protected Queryable getThis() {
return this;
}
protected OrderedQueryable getThisOrderedQueryable() {
return this;
}
@Override public Enumerable asEnumerable() {
return new AbstractEnumerable() {
public Enumerator enumerator() {
return DefaultQueryable.this.enumerator();
}
};
}
// Disambiguate
@Override public Queryable union(Enumerable source1) {
return factory.union(getThis(), source1);
}
@Override public Queryable union(Enumerable source1,
EqualityComparer comparer) {
return factory.union(getThis(), source1, comparer);
}
@Override public Queryable intersect(Enumerable source1) {
return factory.intersect(getThis(), source1);
}
@Override public Queryable intersect(Enumerable source1,
EqualityComparer comparer) {
return factory.intersect(getThis(), source1, comparer);
}
@Override public Queryable except(Enumerable enumerable1,
EqualityComparer comparer) {
return factory.except(getThis(), enumerable1, comparer);
}
@Override public Queryable except(Enumerable enumerable1) {
return factory.except(getThis(), enumerable1);
}
@Override public Queryable take(int count) {
return factory.take(getThis(), count);
}
@Override public Queryable skip(int count) {
return factory.skip(getThis(), count);
}
@Override public Queryable reverse() {
return factory.reverse(getThis());
}
@Override public Queryable distinct() {
return factory.distinct(getThis());
}
@Override public Queryable distinct(EqualityComparer comparer) {
return factory.distinct(getThis(), comparer);
}
@Override public Queryable ofType(Class clazz) {
return factory.ofType(getThis(), clazz);
}
@Override public Queryable defaultIfEmpty() {
return factory.defaultIfEmpty(getThis());
}
@Override public Queryable asQueryable() {
return this;
}
@Override public Queryable cast(Class clazz) {
return factory.cast(getThis(), clazz);
}
// End disambiguate
public T aggregate(FunctionExpression> selector) {
return factory.aggregate(getThis(), selector);
}
public TAccumulate aggregate(TAccumulate seed,
FunctionExpression> selector) {
return factory.aggregate(getThis(), seed, selector);
}
public TResult aggregate(TAccumulate seed,
FunctionExpression> func,
FunctionExpression> selector) {
return factory.aggregate(getThis(), seed, func, selector);
}
public boolean all(FunctionExpression> predicate) {
return factory.all(getThis(), predicate);
}
public boolean any(FunctionExpression> predicate) {
return factory.any(getThis(), predicate);
}
public BigDecimal averageBigDecimal(
FunctionExpression> selector) {
return factory.averageBigDecimal(getThis(), selector);
}
public BigDecimal averageNullableBigDecimal(
FunctionExpression> selector) {
return factory.averageNullableBigDecimal(getThis(), selector);
}
public double averageDouble(FunctionExpression> selector) {
return factory.averageDouble(getThis(), selector);
}
public Double averageNullableDouble(
FunctionExpression> selector) {
return factory.averageNullableDouble(getThis(), selector);
}
public int averageInteger(FunctionExpression> selector) {
return factory.averageInteger(getThis(), selector);
}
public Integer averageNullableInteger(
FunctionExpression> selector) {
return factory.averageNullableInteger(getThis(), selector);
}
public float averageFloat(FunctionExpression> selector) {
return factory.averageFloat(getThis(), selector);
}
public Float averageNullableFloat(
FunctionExpression> selector) {
return factory.averageNullableFloat(getThis(), selector);
}
public long averageLong(FunctionExpression> selector) {
return factory.averageLong(getThis(), selector);
}
public Long averageNullableLong(
FunctionExpression> selector) {
return factory.averageNullableLong(getThis(), selector);
}
public Queryable concat(Enumerable source2) {
return factory.concat(getThis(), source2);
}
public int count(FunctionExpression> func) {
return factory.count(getThis(), func);
}
public T first(FunctionExpression> predicate) {
return factory.first(getThis(), predicate);
}
public T firstOrDefault(FunctionExpression> predicate) {
return factory.firstOrDefault(getThis(), predicate);
}
public Queryable> groupBy(
FunctionExpression> keySelector) {
return factory.groupBy(getThis(), keySelector);
}
public Queryable> groupBy(
FunctionExpression> keySelector,
EqualityComparer comparer) {
return factory.groupBy(getThis(), keySelector, comparer);
}
public Queryable> groupBy(
FunctionExpression> keySelector,
FunctionExpression> elementSelector) {
return factory.groupBy(getThis(), keySelector, elementSelector);
}
public Queryable> groupBy(
FunctionExpression> keySelector,
FunctionExpression> elementSelector,
EqualityComparer comparer) {
return factory.groupBy(getThis(), keySelector, elementSelector, comparer);
}
public Queryable groupByK(
FunctionExpression> keySelector,
FunctionExpression, TResult>> resultSelector) {
return factory.groupByK(getThis(), keySelector, resultSelector);
}
public Queryable groupByK(
FunctionExpression> keySelector,
FunctionExpression, TResult>> resultSelector,
EqualityComparer comparer) {
return factory.groupByK(getThis(), keySelector, resultSelector, comparer);
}
public Queryable groupBy(
FunctionExpression> keySelector,
FunctionExpression> elementSelector,
FunctionExpression, TResult>> resultSelector) {
return factory.groupBy(getThis(), keySelector, elementSelector,
resultSelector);
}
public Queryable groupBy(
FunctionExpression> keySelector,
FunctionExpression> elementSelector,
FunctionExpression, TResult>> resultSelector,
EqualityComparer comparer) {
return factory.groupBy(getThis(), keySelector, elementSelector,
resultSelector, comparer);
}
public Queryable groupJoin(
Enumerable inner,
FunctionExpression> outerKeySelector,
FunctionExpression> innerKeySelector,
FunctionExpression, TResult>> resultSelector) {
return factory.groupJoin(getThis(), inner, outerKeySelector,
innerKeySelector, resultSelector);
}
public Queryable groupJoin(
Enumerable inner,
FunctionExpression> outerKeySelector,
FunctionExpression> innerKeySelector,
FunctionExpression, TResult>> resultSelector,
EqualityComparer comparer) {
return factory.groupJoin(getThis(), inner, outerKeySelector,
innerKeySelector, resultSelector, comparer);
}
public Queryable join(
Enumerable inner,
FunctionExpression> outerKeySelector,
FunctionExpression> innerKeySelector,
FunctionExpression> resultSelector) {
return factory.join(getThis(), inner, outerKeySelector, innerKeySelector,
resultSelector);
}
public Queryable join(
Enumerable inner,
FunctionExpression> outerKeySelector,
FunctionExpression> innerKeySelector,
FunctionExpression> resultSelector,
EqualityComparer comparer) {
return factory.join(getThis(), inner, outerKeySelector, innerKeySelector,
resultSelector, comparer);
}
public T last(FunctionExpression> predicate) {
return factory.last(getThis(), predicate);
}
public T lastOrDefault(FunctionExpression> predicate) {
return factory.lastOrDefault(getThis(), predicate);
}
public long longCount(FunctionExpression> predicate) {
return factory.longCount(getThis(), predicate);
}
public > TResult max(
FunctionExpression> selector) {
return factory.max(getThis(), selector);
}
public > TResult min(
FunctionExpression> selector) {
return factory.min(getThis(), selector);
}
public OrderedQueryable orderBy(
FunctionExpression> keySelector) {
return factory.orderBy(getThis(), keySelector);
}
public OrderedQueryable orderBy(
FunctionExpression> keySelector,
Comparator comparator) {
return factory.orderBy(getThis(), keySelector, comparator);
}
public OrderedQueryable orderByDescending(
FunctionExpression> keySelector) {
return factory.orderByDescending(getThis(), keySelector);
}
public OrderedQueryable orderByDescending(
FunctionExpression> keySelector,
Comparator comparator) {
return factory.orderByDescending(getThis(), keySelector, comparator);
}
public Queryable select(
FunctionExpression> selector) {
return factory.select(getThis(), selector);
}
public Queryable selectN(
FunctionExpression> selector) {
return factory.selectN(getThis(), selector);
}
public Queryable selectMany(
FunctionExpression>> selector) {
return factory.selectMany(getThis(), selector);
}
public Queryable selectManyN(
FunctionExpression>> selector) {
return factory.selectManyN(getThis(), selector);
}
public Queryable selectMany(
FunctionExpression>>
collectionSelector,
FunctionExpression> resultSelector) {
return factory.selectMany(getThis(), collectionSelector, resultSelector);
}
public Queryable selectManyN(
FunctionExpression>>
collectionSelector,
FunctionExpression> resultSelector) {
return factory.selectManyN(getThis(), collectionSelector, resultSelector);
}
public T single(FunctionExpression> predicate) {
return factory.single(getThis(), predicate);
}
public T singleOrDefault(FunctionExpression> predicate) {
return factory.singleOrDefault(getThis(), predicate);
}
public Queryable skipWhile(FunctionExpression> predicate) {
return factory.skipWhile(getThis(), predicate);
}
public Queryable skipWhileN(
FunctionExpression> predicate) {
return factory.skipWhileN(getThis(), predicate);
}
public BigDecimal sumBigDecimal(
FunctionExpression> selector) {
return factory.sumBigDecimal(getThis(), selector);
}
public BigDecimal sumNullableBigDecimal(
FunctionExpression> selector) {
return factory.sumNullableBigDecimal(getThis(), selector);
}
public double sumDouble(FunctionExpression> selector) {
return factory.sumDouble(getThis(), selector);
}
public Double sumNullableDouble(
FunctionExpression> selector) {
return factory.sumNullableDouble(getThis(), selector);
}
public int sumInteger(FunctionExpression> selector) {
return factory.sumInteger(getThis(), selector);
}
public Integer sumNullableInteger(
FunctionExpression> selector) {
return factory.sumNullableInteger(getThis(), selector);
}
public long sumLong(FunctionExpression> selector) {
return factory.sumLong(getThis(), selector);
}
public Long sumNullableLong(
FunctionExpression> selector) {
return factory.sumNullableLong(getThis(), selector);
}
public float sumFloat(FunctionExpression> selector) {
return factory.sumFloat(getThis(), selector);
}
public Float sumNullableFloat(
FunctionExpression> selector) {
return factory.sumNullableFloat(getThis(), selector);
}
public Queryable takeWhile(FunctionExpression> predicate) {
return factory.takeWhile(getThis(), predicate);
}
public Queryable takeWhileN(
FunctionExpression> predicate) {
return factory.takeWhileN(getThis(), predicate);
}
public > OrderedQueryable thenBy(
FunctionExpression> keySelector) {
return factory.thenBy(getThisOrderedQueryable(), keySelector);
}
public OrderedQueryable thenBy(
FunctionExpression> keySelector,
Comparator comparator) {
return factory.thenByDescending(getThisOrderedQueryable(), keySelector,
comparator);
}
public > OrderedQueryable thenByDescending(
FunctionExpression> keySelector) {
return factory.thenByDescending(getThisOrderedQueryable(), keySelector);
}
public OrderedQueryable thenByDescending(
FunctionExpression> keySelector,
Comparator comparator) {
return factory.thenBy(getThisOrderedQueryable(), keySelector, comparator);
}
public Queryable where(
FunctionExpression extends Predicate1> predicate) {
return factory.where(getThis(), predicate);
}
public Queryable whereN(
FunctionExpression extends Predicate2> predicate) {
return factory.whereN(getThis(), predicate);
}
public Queryable zip(Enumerable source1,
FunctionExpression> resultSelector) {
return factory.zip(getThis(), source1, resultSelector);
}
}
// End DefaultQueryable.java