本文整理汇总了Java中org.apache.spark.sql.types.StructType.add方法的典型用法代码示例。如果您正苦于以下问题:Java StructType.add方法的具体用法?Java StructType.add怎么用?Java StructType.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.spark.sql.types.StructType
的用法示例。
在下文中一共展示了StructType.add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: datasetSchema
import org.apache.spark.sql.types.StructType; //导入方法依赖的package包/类
static public StructType datasetSchema(Map<String, String> mappa) {
StructType struct = new StructType();
for (Map.Entry<String, String> entry : mappa.entrySet()) {
switch (entry.getValue().toLowerCase()) {
case "string":
case "dictionary":
struct = struct.add(entry.getKey(), DataTypes.StringType);
break;
case "int":
struct = struct.add(entry.getKey(), DataTypes.IntegerType);
break;
case "double":
struct = struct.add(entry.getKey(), DataTypes.DoubleType);
break;
}
}
return struct;
}
示例2: PMMLTransformer
import org.apache.spark.sql.types.StructType; //导入方法依赖的package包/类
public PMMLTransformer(Evaluator evaluator, List<ColumnProducer<?>> columnProducers) {
StructType outputSchema = new StructType();
for (ColumnProducer<?> columnProducer : columnProducers) {
StructField structField = columnProducer.init(evaluator);
outputSchema = outputSchema.add(structField);
}
setEvaluator(evaluator);
setColumnProducers(columnProducers);
setOutputSchema(outputSchema);
}
示例3: transformSchema
import org.apache.spark.sql.types.StructType; //导入方法依赖的package包/类
@Override
public StructType transformSchema(StructType schema){
StructType structSchema = getStructSchema(schema);
StructType result = schema;
StructField[] fields = structSchema.fields();
for(StructField field : fields){
result = result.add(field);
}
return result;
}
示例4: appendFields
import org.apache.spark.sql.types.StructType; //导入方法依赖的package包/类
public static StructType appendFields(StructType from, List<StructField> fields) {
StructType to = DataTypes.createStructType(from.fields());
for (StructField field : fields) {
to = to.add(field);
}
return to;
}
示例5: transformSchema
import org.apache.spark.sql.types.StructType; //导入方法依赖的package包/类
@Override
public StructType transformSchema(StructType schema) {
StructField outputField = DataTypes.createStructField(getOutputCol(), getOutputSchema(), false);
return schema.add(outputField);
}