当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableNullableList.copyOf方法代码示例

本文整理汇总了Java中org.apache.calcite.util.ImmutableNullableList.copyOf方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableNullableList.copyOf方法的具体用法?Java ImmutableNullableList.copyOf怎么用?Java ImmutableNullableList.copyOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.util.ImmutableNullableList的用法示例。


在下文中一共展示了ImmutableNullableList.copyOf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:RelMdSize.java

示例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);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:29,代码来源:FlatLists.java

示例3: 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);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:ImmutableCollectionSerializers.java

示例4: 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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:SqlSetOption.java

示例5: 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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:16,代码来源:SqlValidatorImpl.java

示例6: 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();
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:32,代码来源:SqlUserDefinedTableMacro.java

示例7: SqlTypeExplicitPrecedenceList

import org.apache.calcite.util.ImmutableNullableList; //导入方法依赖的package包/类
public SqlTypeExplicitPrecedenceList(Iterable<SqlTypeName> typeNames) {
  this.typeNames = ImmutableNullableList.copyOf(typeNames);
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:SqlTypeExplicitPrecedenceList.java


注:本文中的org.apache.calcite.util.ImmutableNullableList.copyOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。