Skip to content

Function name misleading: scalarTypeSupported #1751

@xumingming

Description

@xumingming

def scalarTypeSupported(dataType: DataType): Boolean = {
dataType match {
case NullType | BooleanType | ByteType | ShortType | IntegerType | LongType | FloatType |
DoubleType | StringType | DateType | TimestampType =>
true
case t: DecimalType if DecimalType.is64BitDecimalType(t) => true
case _: DecimalType =>
// auron only supports 64-bit decimal
false
case at: ArrayType => scalarTypeSupported(at.elementType)
case m: MapType =>
scalarTypeSupported(m.keyType) && scalarTypeSupported(m.valueType)
case s: StructType =>
s.fields.forall(e => scalarTypeSupported(e.dataType))
case _ => false
}
}

The function name says it checks whether the scalar type is supported, but it actually also handles complex types(Map, Array, Struct), the name is misleading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions