Skip to content

Commit

Permalink
ignore more
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Jun 11, 2024
1 parent 4d91bfe commit 5fe19c2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
26 changes: 13 additions & 13 deletions spark/src/main/scala/org/apache/comet/expressions/CometCast.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ object CometCast {
case (DataTypes.ByteType, _) =>
canCastFromByte(toType)
case (DataTypes.ShortType, _) =>
canCastFromShort(toType)
Incompatible(Some("Relies on UB in unsafe code"))
// canCastFromShort(toType)
case (DataTypes.IntegerType, _) =>
canCastFromInt(toType)
case (DataTypes.LongType, _) =>
Expand Down Expand Up @@ -135,8 +136,7 @@ object CometCast {
private def canCastToString(fromType: DataType): SupportLevel = {
fromType match {
case DataTypes.BooleanType => Compatible()
case DataTypes.ByteType | DataTypes.ShortType | DataTypes.IntegerType |
DataTypes.LongType =>
case DataTypes.ByteType | DataTypes.IntegerType | DataTypes.LongType =>
Compatible()
case DataTypes.DateType => Compatible()
case DataTypes.TimestampType => Compatible()
Expand Down Expand Up @@ -188,16 +188,16 @@ object CometCast {
Unsupported
}

private def canCastFromShort(toType: DataType): SupportLevel = toType match {
case DataTypes.BooleanType =>
Compatible()
case DataTypes.ByteType | DataTypes.IntegerType | DataTypes.LongType =>
Compatible()
case DataTypes.FloatType | DataTypes.DoubleType | _: DecimalType =>
Compatible()
case _ =>
Unsupported
}
// private def canCastFromShort(toType: DataType): SupportLevel = toType match {
// case DataTypes.BooleanType =>
// Compatible()
// case DataTypes.ByteType | DataTypes.IntegerType | DataTypes.LongType =>
// Compatible()
// case DataTypes.FloatType | DataTypes.DoubleType | _: DecimalType =>
// Compatible()
// case _ =>
// Unsupported
// }

private def canCastFromInt(toType: DataType): SupportLevel = toType match {
case DataTypes.BooleanType =>
Expand Down
24 changes: 16 additions & 8 deletions spark/src/test/scala/org/apache/comet/CometCastSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -179,43 +179,51 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
castTest(generateBytes(), DataTypes.BinaryType)
}

// TODO thread caused non-unwinding panic
ignore("cast ByteType to TimestampType") {
// input: -1, expected: 1969-12-31 15:59:59.0, actual: 1969-12-31 15:59:59.999999
castTest(generateBytes(), DataTypes.TimestampType)
}

// CAST from ShortType

test("cast ShortType to BooleanType") {
ignore("cast ShortType to BooleanType") {
castTest(generateShorts(), DataTypes.BooleanType)
}

test("cast ShortType to ByteType") {
// TODO thread caused non-unwinding panic
ignore("cast ShortType to ByteType") {
// https://github.com/apache/datafusion-comet/issues/311
castTest(generateShorts(), DataTypes.ByteType)
}

test("cast ShortType to IntegerType") {
// TODO thread caused non-unwinding panic
ignore("cast ShortType to IntegerType") {
castTest(generateShorts(), DataTypes.IntegerType)
}

test("cast ShortType to LongType") {
// TODO thread caused non-unwinding panic
ignore("cast ShortType to LongType") {
castTest(generateShorts(), DataTypes.LongType)
}

test("cast ShortType to FloatType") {
// TODO thread caused non-unwinding panic
ignore("cast ShortType to FloatType") {
castTest(generateShorts(), DataTypes.FloatType)
}

test("cast ShortType to DoubleType") {
// TODO thread caused non-unwinding panic
ignore("cast ShortType to DoubleType") {
castTest(generateShorts(), DataTypes.DoubleType)
}

test("cast ShortType to DecimalType(10,2)") {
// TODO thread caused non-unwinding panic
ignore("cast ShortType to DecimalType(10,2)") {
castTest(generateShorts(), DataTypes.createDecimalType(10, 2))
}

test("cast ShortType to StringType") {
// TODO thread caused non-unwinding panic
ignore("cast ShortType to StringType") {
castTest(generateShorts(), DataTypes.StringType)
}

Expand Down

0 comments on commit 5fe19c2

Please sign in to comment.