本文整理匯總了Java中org.apache.spark.sql.types.BooleanType類的典型用法代碼示例。如果您正苦於以下問題:Java BooleanType類的具體用法?Java BooleanType怎麽用?Java BooleanType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BooleanType類屬於org.apache.spark.sql.types包,在下文中一共展示了BooleanType類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDataField
import org.apache.spark.sql.types.BooleanType; //導入依賴的package包/類
public DataField createDataField(FieldName name){
StructField field = this.schema.apply(name.getValue());
org.apache.spark.sql.types.DataType sparkDataType = field.dataType();
if(sparkDataType instanceof StringType){
return createDataField(name, OpType.CATEGORICAL, DataType.STRING);
} else
if(sparkDataType instanceof IntegralType){
return createDataField(name, OpType.CONTINUOUS, DataType.INTEGER);
} else
if(sparkDataType instanceof DoubleType){
return createDataField(name, OpType.CONTINUOUS, DataType.DOUBLE);
} else
if(sparkDataType instanceof BooleanType){
return createDataField(name, OpType.CATEGORICAL, DataType.BOOLEAN);
} else
{
throw new IllegalArgumentException("Expected string, integral, double or boolean type, got " + sparkDataType.typeName() + " type");
}
}
示例2: codingToStruct
import org.apache.spark.sql.types.BooleanType; //導入依賴的package包/類
@Test
public void codingToStruct() {
DataType codingType = getField(conditionSchema, true, "severity", "coding");
Assert.assertTrue(getField(codingType, true, "system") instanceof StringType);
Assert.assertTrue(getField(codingType, true, "version") instanceof StringType);
Assert.assertTrue(getField(codingType, true, "code") instanceof StringType);
Assert.assertTrue(getField(codingType, true, "display") instanceof StringType);
Assert.assertTrue(getField(codingType, true, "userSelected") instanceof BooleanType);
}