本文整理汇总了Java中org.apache.calcite.util.ImmutableNullableList类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableNullableList类的具体用法?Java ImmutableNullableList怎么用?Java ImmutableNullableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableNullableList类属于org.apache.calcite.util包,在下文中一共展示了ImmutableNullableList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: averageJoinColumnSizes
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
private List<Double> averageJoinColumnSizes(Join rel, RelMetadataQuery mq,
boolean semijoin) {
final RelNode left = rel.getLeft();
final RelNode right = rel.getRight();
final List<Double> lefts = mq.getAverageColumnSizes(left);
final List<Double> rights =
semijoin ? null : mq.getAverageColumnSizes(right);
if (lefts == null && rights == null) {
return null;
}
final int fieldCount = rel.getRowType().getFieldCount();
Double[] sizes = new Double[fieldCount];
if (lefts != null) {
lefts.toArray(sizes);
}
if (rights != null) {
final int leftCount = left.getRowType().getFieldCount();
for (int i = 0; i < rights.size(); i++) {
sizes[leftCount + i] = rights.get(i);
}
}
return ImmutableNullableList.copyOf(sizes);
}
示例2: flatListNotComparable
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
/**
* Creates a memory-, CPU- and cache-efficient immutable list,
* always copying the list.
*
* @param t Array of members of list
* @return List containing the given members
*/
private static <T> List<T> flatListNotComparable(T[] t) {
switch (t.length) {
case 0:
//noinspection unchecked
return COMPARABLE_EMPTY_LIST;
case 1:
return new Flat1List<>(t[0]);
case 2:
return new Flat2List<>(t[0], t[1]);
case 3:
return new Flat3List<>(t[0], t[1], t[2]);
case 4:
return new Flat4List<>(t[0], t[1], t[2], t[3]);
case 5:
return new Flat5List<>(t[0], t[1], t[2], t[3], t[4]);
case 6:
return new Flat6List<>(t[0], t[1], t[2], t[3], t[4], t[5]);
default:
return ImmutableNullableList.copyOf(t);
}
}
示例3: register
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
public static void register(final Kryo kryo) {
// register list
ImmutableListSerializer.register(kryo);
// register set
ImmutableSetSerializer.register(kryo);
// register set
ImmutableMapSerializer.register(kryo);
// others
kryo.addDefaultSerializer(FlatLists.AbstractFlatList.class, FieldSerializer.class);
kryo.addDefaultSerializer(ImmutableNullableList.class, ImmutableNullableListSerializer.class);
}
示例4: write
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
@Override
public void write(Kryo kryo, Output output, List object) {
Preconditions.checkArgument(object instanceof ImmutableNullableList);
output.writeInt(object.size());
final Iterator iterator = object.iterator();
while (iterator.hasNext()) {
kryo.writeClassAndObject(output, iterator.next());
}
}
示例5: read
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
@Override
public List read(Kryo kryo, Input input, Class<List> type) {
final int size = input.readInt();
Object[] elements = new Object[size];
for (int i = 0; i < size; ++i) {
elements[i] = kryo.readClassAndObject(input);
}
return ImmutableNullableList.copyOf(elements);
}
示例6: get
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
public DataSource get(String url, String driverClassName) {
// Get data source objects from a cache, so that we don't have to sniff
// out what kind of database they are quite as often.
final List<String> key =
ImmutableNullableList.of(url, driverClassName);
DataSource dataSource = cache.apply(key);
LOG.info("get DataSource:" + dataSource + ", " + url + " " + driverClassName);
return dataSource;
}
示例7: averageColumnSizes
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
public List<Double> averageColumnSizes(Project rel, RelMetadataQuery mq) {
final List<Double> inputColumnSizes =
mq.getAverageColumnSizesNotNull(rel.getInput());
final ImmutableNullableList.Builder<Double> sizes =
ImmutableNullableList.builder();
for (RexNode project : rel.getProjects()) {
sizes.add(averageRexSize(project, inputColumnSizes));
}
return sizes.build();
}
示例8: get
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
public DataSource get(String url, String driverClassName,
String username, String password) {
// Get data source objects from a cache, so that we don't have to sniff
// out what kind of database they are quite as often.
final List<String> key =
ImmutableNullableList.of(url, username, password, driverClassName);
return cache.getUnchecked(key);
}
示例9: getOperandList
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
@Override public List<SqlNode> getOperandList() {
final List<SqlNode> operandList = Lists.newArrayList();
if (scope == null) {
operandList.add(null);
} else {
operandList.add(new SqlIdentifier(scope, SqlParserPos.ZERO));
}
operandList.add(name);
operandList.add(value);
return ImmutableNullableList.copyOf(operandList);
}
示例10: getFieldOrigins
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
public List<List<String>> getFieldOrigins(SqlNode sqlQuery) {
if (sqlQuery instanceof SqlExplain) {
return Collections.emptyList();
}
final RelDataType rowType = getValidatedNodeType(sqlQuery);
final int fieldCount = rowType.getFieldCount();
if (!sqlQuery.isA(SqlKind.QUERY)) {
return Collections.nCopies(fieldCount, null);
}
final List<List<String>> list = new ArrayList<>();
for (int i = 0; i < fieldCount; i++) {
list.add(getFieldOrigin(sqlQuery, i));
}
return ImmutableNullableList.copyOf(list);
}
示例11: getValue
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
private static Object getValue(SqlNode right) throws NonLiteralException {
switch (right.getKind()) {
case ARRAY_VALUE_CONSTRUCTOR:
final List<Object> list = Lists.newArrayList();
for (SqlNode o : ((SqlCall) right).getOperandList()) {
list.add(getValue(o));
}
return ImmutableNullableList.copyOf(list);
case MAP_VALUE_CONSTRUCTOR:
final ImmutableMap.Builder<Object, Object> builder2 =
ImmutableMap.builder();
final List<SqlNode> operands = ((SqlCall) right).getOperandList();
for (int i = 0; i < operands.size(); i += 2) {
final SqlNode key = operands.get(i);
final SqlNode value = operands.get(i + 1);
builder2.put(getValue(key), getValue(value));
}
return builder2.build();
default:
if (SqlUtil.isNullLiteral(right, true)) {
return null;
}
if (SqlUtil.isLiteral(right)) {
return ((SqlLiteral) right).getValue();
}
if (right.getKind() == SqlKind.DEFAULT) {
return null; // currently NULL is the only default value
}
throw new NonLiteralException();
}
}
示例12: collectOperandTypes
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
private List<RelDataType> collectOperandTypes(
SqlValidator validator,
SqlValidatorScope scope,
SqlCall call) {
List<RelDataType> argTypes =
SqlTypeUtil.deriveAndCollectTypes(
validator, scope, call.getOperandList());
return ImmutableNullableList.of(
argTypes.get(VALUE_OPERAND),
argTypes.get(LOWER_OPERAND),
argTypes.get(UPPER_OPERAND));
}
示例13: getOperandList
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
@Override public List<SqlNode> getOperandList() {
return ImmutableNullableList.<SqlNode>of(table);
}
示例14: getOperandList
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
@Override
public List<SqlNode> getOperandList() {
return ImmutableNullableList.of(tblName, fieldList, location, properties,
query);
}
示例15: getOperandList
import org.apache.calcite.util.ImmutableNullableList; //导入依赖的package包/类
@Override
public List<SqlNode> getOperandList() {
return ImmutableNullableList.of(functionName, className);
}