Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-5936][VL] Add more types in function type validation and document Cast function #6963

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/velox-backend-support-progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,34 @@ Gluten supports 28 operators (Drag to right to see all data types)

Gluten supports 199 functions. (Drag to right to see all data types)

#### Cast function's support status

* S: supported.
* NS: not supported.
* -: not accepted by Spark.
* N/A: not applicable case, e.g., from type is as same as to type, where cast will not actually happen.

| From \ To | BOOLEAN | BYTE | SHORT | INT | LONG | FLOAT | DOUBLE | DECIMAL | DATE | TIMESTAMP | STRING | BINARY | ARRAY | MAP | STRUCT | NULL |
|-----------|---------|------|-------|-----|------|-------|--------|---------|------|-----------|--------|--------|-------|-----|--------|------|
| BOOLEAN | N/A | S | S | S | S | S | S | S | - | NS | S | - | - | - | - | - |
| BYTE | S | N/A | S | S | S | S | S | S | - | NS | S | S | - | - | - | - |
| SHORT | S | S | N/A | S | S | S | S | S | - | NS | S | S | - | - | - | - |
| INT | S | S | S | N/A | S | S | S | S | - | NS | S | S | - | - | - | - |
| LONG | S | S | S | S | N/A | S | S | S | - | NS | S | S | - | - | - | - |
| FLOAT | S | S | S | S | S | N/A | S | S | - | NS | S | - | - | - | - | - |
| DOUBLE | S | S | S | S | S | S | N/A | S | - | NS | S | - | - | - | - | - |
| DECIMAL | S | S | S | S | S | S | S | N/A | - | NS | S | - | - | - | - | - |
| DATE | NS | NS | NS | NS | NS | NS | NS | NS | N/A | NS | NS | - | - | - | - | - |
| TIMESTAMP | NS | NS | NS | NS | NS | NS | NS | NS | NS | N/A | NS | - | - | - | - | - |
| STRING | S | S | S | S | S | S | S | S | NS | NS | N/A | - | - | - | - | - |
| BINARY | S | S | S | S | S | S | S | S | NS | NS | S | N/A | - | - | - | - |
| ARRAY | - | - | - | - | - | - | - | - | - | - | NS | - | N/A | - | - | - |
| Map | - | - | - | - | - | - | - | - | - | - | NS | - | - | N/A | - | - |
| STRUCT | - | - | - | - | - | - | - | - | - | - | NS | - | - | - | N/A | - |
| NULL | S | S | S | S | S | S | S | S | S | NS | S | S | S | S | S | N/A |

#### Other functions' support status

| Spark Functions | Velox/Presto Functions | Velox/Spark functions | Gluten | Restrictions | BOOLEAN | BYTE | SHORT | INT | LONG | FLOAT | DOUBLE | DATE | TIMESTAMP | STRING | DECIMAL | NULL | BINARY | CALENDAR | ARRAY | MAP | STRUCT | UDT |
|------------------------------|------------------------|-----------------------|--------|--------------------------|---------|------|-------|-----|------|-------|--------|------|-----------|--------|---------|------|--------|----------|-------|-----|--------|-----|
| ! | | not | S | | S | S | S | S | S | S | S | | | S | | | | | | | | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class GlutenExpressionDataTypesValidation extends WholeStageTransformerSuite {

private val allPrimitiveDataTypes: Seq[DataType] =
Seq(
BooleanType,
ByteType,
ShortType,
IntegerType,
Expand All @@ -73,7 +74,8 @@ class GlutenExpressionDataTypesValidation extends WholeStageTransformerSuite {
StringType,
BinaryType,
DateType,
TimestampType)
TimestampType,
NullType)

private val allComplexDataTypes: Seq[DataType] = Seq(
// Currently, only check certain inner types, assuming they are representative
Expand All @@ -85,6 +87,7 @@ class GlutenExpressionDataTypesValidation extends WholeStageTransformerSuite {

def generateChildExpression(t: DataType): Expression = {
t match {
case _: BooleanType => Literal(true, t)
case _: IntegralType => Literal(null, t)
case _: FractionalType => Literal(null, t)
case StringType | BinaryType => Literal("123")
Expand All @@ -93,6 +96,7 @@ class GlutenExpressionDataTypesValidation extends WholeStageTransformerSuite {
case ArrayType(_, _) => Literal(null, t)
case MapType(_, _, _) => Literal(null, t)
case StructType(_) => Literal(null, t)
case NullType => Literal(null, t)
case _ => throw new UnsupportedOperationException("Not supported type: " + t)
}
}
Expand Down
Loading