org.apache.spark.sql.Row.getList()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(350)

本文整理了Java中org.apache.spark.sql.Row.getList方法的一些代码示例,展示了Row.getList的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Row.getList方法的具体详情如下:
包路径:org.apache.spark.sql.Row
类名称:Row
方法名:getList

Row.getList介绍

暂无

代码示例

代码示例来源:origin: cloudera-labs/envelope

@Override
public <T> List<T> getList(int arg0) {
 return internalRow.getList(arg0);
}

代码示例来源:origin: org.apache.spark/spark-sql

private static void appendValue(WritableColumnVector dst, DataType t, Row src, int fieldIdx) {
 if (t instanceof ArrayType) {
  ArrayType at = (ArrayType)t;
  if (src.isNullAt(fieldIdx)) {
   dst.appendNull();
  } else {
   List<Object> values = src.getList(fieldIdx);
   dst.appendArray(values.size());
   for (Object o : values) {
    appendValue(dst.arrayData(), at.elementType(), o);
   }
  }
 } else if (t instanceof StructType) {
  StructType st = (StructType)t;
  if (src.isNullAt(fieldIdx)) {
   dst.appendStruct(true);
  } else {
   dst.appendStruct(false);
   Row c = src.getStruct(fieldIdx);
   for (int i = 0; i < st.fields().length; i++) {
    appendValue(dst.getChild(i), st.fields()[i].dataType(), c, i);
   }
  }
 } else {
  appendValue(dst, t, src.get(fieldIdx));
 }
}

代码示例来源:origin: org.apache.spark/spark-sql_2.10

private static void appendValue(ColumnVector dst, DataType t, Row src, int fieldIdx) {
 if (t instanceof ArrayType) {
  ArrayType at = (ArrayType)t;
  if (src.isNullAt(fieldIdx)) {
   dst.appendNull();
  } else {
   List<Object> values = src.getList(fieldIdx);
   dst.appendArray(values.size());
   for (Object o : values) {
    appendValue(dst.arrayData(), at.elementType(), o);
   }
  }
 } else if (t instanceof StructType) {
  StructType st = (StructType)t;
  if (src.isNullAt(fieldIdx)) {
   dst.appendStruct(true);
  } else {
   dst.appendStruct(false);
   Row c = src.getStruct(fieldIdx);
   for (int i = 0; i < st.fields().length; i++) {
    appendValue(dst.getChildColumn(i), st.fields()[i].dataType(), c, i);
   }
  }
 } else {
  appendValue(dst, t, src.get(fieldIdx));
 }
}

代码示例来源:origin: org.apache.spark/spark-sql_2.11

private static void appendValue(WritableColumnVector dst, DataType t, Row src, int fieldIdx) {
 if (t instanceof ArrayType) {
  ArrayType at = (ArrayType)t;
  if (src.isNullAt(fieldIdx)) {
   dst.appendNull();
  } else {
   List<Object> values = src.getList(fieldIdx);
   dst.appendArray(values.size());
   for (Object o : values) {
    appendValue(dst.arrayData(), at.elementType(), o);
   }
  }
 } else if (t instanceof StructType) {
  StructType st = (StructType)t;
  if (src.isNullAt(fieldIdx)) {
   dst.appendStruct(true);
  } else {
   dst.appendStruct(false);
   Row c = src.getStruct(fieldIdx);
   for (int i = 0; i < st.fields().length; i++) {
    appendValue(dst.getChild(i), st.fields()[i].dataType(), c, i);
   }
  }
 } else {
  appendValue(dst, t, src.get(fieldIdx));
 }
}

代码示例来源:origin: cerner/bunsen

/**
 * Returns true if the given CodeableConcept row has a Coding belonging to the ValueSet having the
 * given reference name, or false otherwise.
 */
private static Boolean inValueSet(Row codeableRow,
  String referenceName,
  BroadcastableValueSets valueSets) {
 boolean found = false;
 if (codeableRow != null) {
  List<Row> codingArray = codeableRow.getList(1);
  if (codingArray != null) {
   for (Row coding : codingArray) {
    String system = coding.getAs("system");
    String code = coding.getAs("code");
    // If there exists a matching code, return true.
    if (valueSets.hasCode(referenceName, system, code)) {
     found = true;
     break;
    }
   }
  }
 }
 return found;
}

代码示例来源:origin: com.cerner.bunsen/bunsen-core

/**
 * Returns true if the given CodeableConcept row has a Coding belonging to the ValueSet having the
 * given reference name, or false otherwise.
 */
private static Boolean inValueSet(Row codeableRow,
  String referenceName,
  BroadcastableValueSets valueSets) {
 boolean found = false;
 if (codeableRow != null) {
  List<Row> codingArray = codeableRow.getList(1);
  if (codingArray != null) {
   for (Row coding : codingArray) {
    String system = coding.getAs("system");
    String code = coding.getAs("code");
    // If there exists a matching code, return true.
    if (valueSets.hasCode(referenceName, system, code)) {
     found = true;
     break;
    }
   }
  }
 }
 return found;
}

代码示例来源:origin: Netflix/iceberg

break;
case ARRAY:
 record.put(i, convert(field.schema(), row.getList(i)));
 break;
case MAP:

代码示例来源:origin: cdapio/cdap

builder.set(field.getName(), fromRowValue(row.getList(idx), fieldSchema, fieldPath));
} else if (fieldSchema.getType() == Schema.Type.MAP) {
 builder.set(field.getName(), fromRowValue(row.getJavaMap(idx), fieldSchema, fieldPath));

代码示例来源:origin: cdapio/cdap

builder.set(field.getName(), fromRowValue(row.getList(idx), fieldSchema, fieldPath));
} else if (fieldSchema.getType() == Schema.Type.MAP) {
 builder.set(field.getName(), fromRowValue(row.getJavaMap(idx), fieldSchema, fieldPath));

代码示例来源:origin: co.cask.cdap/cdap-api-spark2

builder.set(field.getName(), fromRowValue(row.getList(idx), fieldSchema, fieldPath));
} else if (fieldSchema.getType() == Schema.Type.MAP) {
 builder.set(field.getName(), fromRowValue(row.getJavaMap(idx), fieldSchema, fieldPath));

代码示例来源:origin: io.snappydata/snappy-spark-sql

private static void appendValue(ColumnVector dst, DataType t, Row src, int fieldIdx) {
 if (t instanceof ArrayType) {
  ArrayType at = (ArrayType)t;
  if (src.isNullAt(fieldIdx)) {
   dst.appendNull();
  } else {
   List<Object> values = src.getList(fieldIdx);
   dst.appendArray(values.size());
   for (Object o : values) {
    appendValue(dst.arrayData(), at.elementType(), o);
   }
  }
 } else if (t instanceof StructType) {
  StructType st = (StructType)t;
  if (src.isNullAt(fieldIdx)) {
   dst.appendStruct(true);
  } else {
   dst.appendStruct(false);
   Row c = src.getStruct(fieldIdx);
   for (int i = 0; i < st.fields().length; i++) {
    appendValue(dst.getChildColumn(i), st.fields()[i].dataType(), c, i);
   }
  }
 } else {
  appendValue(dst, t, src.get(fieldIdx));
 }
}

相关文章