Skip to content
Closed
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
2 changes: 0 additions & 2 deletions docs/source/user-guide/latest/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ the [Comet Supported Expressions Guide](expressions.md) for more information on

### Math Expressions

- **Ceil, Floor**: Incorrect results for Decimal type inputs.
[#1729](https://github.com/apache/datafusion-comet/issues/1729)
- **Tan**: `tan(-0.0)` produces `0.0` instead of `-0.0`.
[#1897](https://github.com/apache/datafusion-comet/issues/1897)

Expand Down
4 changes: 2 additions & 2 deletions docs/source/user-guide/latest/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ Expressions that are not Spark-compatible will fall back to Spark by default and
| Atan | `atan` | Yes | |
| Atan2 | `atan2` | Yes | |
| BRound | `bround` | Yes | |
| Ceil | `ceil` | No | Incorrect results for Decimal type inputs ([#1729](https://github.com/apache/datafusion-comet/issues/1729)) |
| Ceil | `ceil` | No | |
| Cos | `cos` | Yes | |
| Cosh | `cosh` | Yes | |
| Cot | `cot` | Yes | |
| Divide | `/` | Yes | |
| Exp | `exp` | Yes | |
| Expm1 | `expm1` | Yes | |
| Floor | `floor` | No | Incorrect results for Decimal type inputs ([#1729](https://github.com/apache/datafusion-comet/issues/1729)) |
| Floor | `floor` | No | |
| Hex | `hex` | Yes | |
| IntegralDivide | `div` | Yes | |
| IsNaN | `isnan` | Yes | |
Expand Down
7 changes: 3 additions & 4 deletions native/spark-expr/src/math_funcs/ceil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ mod test {

// https://github.com/apache/datafusion-comet/issues/1729
#[test]
#[ignore]
fn test_ceil_decimal128_array() -> Result<()> {
let array = Decimal128Array::from(vec![
Some(12345), // 123.45
Expand All @@ -178,9 +177,9 @@ mod test {
unreachable!()
};
let expected = Decimal128Array::from(vec![
Some(12400), // 124.00
Some(12500), // 125.00
Some(-12900), // -129.00
Some(124), // 124.00
Some(125), // 125.00
Some(-129), // -129.00
None,
])
.with_precision_and_scale(5, 2)?;
Expand Down
7 changes: 3 additions & 4 deletions native/spark-expr/src/math_funcs/floor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ mod test {

// https://github.com/apache/datafusion-comet/issues/1729
#[test]
#[ignore]
fn test_floor_decimal128_array() -> Result<()> {
let array = Decimal128Array::from(vec![
Some(12345), // 123.45
Expand All @@ -178,9 +177,9 @@ mod test {
unreachable!()
};
let expected = Decimal128Array::from(vec![
Some(12300), // 123.00
Some(12500), // 125.00
Some(-13000), // -130.00
Some(123), // 123.00
Some(125), // 125.00
Some(-130), // -130.00
None,
])
.with_precision_and_scale(5, 2)?;
Expand Down
24 changes: 0 additions & 24 deletions spark/src/main/scala/org/apache/comet/serde/math.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ object CometAtan2 extends CometExpressionSerde[Atan2] {
}

object CometCeil extends CometExpressionSerde[Ceil] {

override def getSupportLevel(expr: Ceil): SupportLevel = {
expr.child.dataType match {
case _: DecimalType =>
Incompatible(
Some(
"Incorrect results for Decimal type inputs" +
" (https://github.com/apache/datafusion-comet/issues/1729)"))
case _ => Compatible()
}
}

override def convert(
expr: Ceil,
inputs: Seq[Attribute],
Expand All @@ -70,18 +58,6 @@ object CometCeil extends CometExpressionSerde[Ceil] {
}

object CometFloor extends CometExpressionSerde[Floor] {

override def getSupportLevel(expr: Floor): SupportLevel = {
expr.child.dataType match {
case _: DecimalType =>
Incompatible(
Some(
"Incorrect results for Decimal type inputs" +
" (https://github.com/apache/datafusion-comet/issues/1729)"))
case _ => Compatible()
}
}

override def convert(
expr: Floor,
inputs: Seq[Attribute],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
-- specific language governing permissions and limitations
-- under the License.

-- Config: spark.comet.expression.Ceil.allowIncompatible=true
-- ConfigMatrix: parquet.enable.dictionary=false,true

statement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
-- specific language governing permissions and limitations
-- under the License.

-- Config: spark.comet.expression.Floor.allowIncompatible=true
-- ConfigMatrix: parquet.enable.dictionary=false,true

statement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,9 +1445,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
test("ceil and floor") {
Seq("true", "false").foreach { dictionary =>
withSQLConf(
"parquet.enable.dictionary" -> dictionary,
CometConf.getExprAllowIncompatConfigKey(classOf[Ceil]) -> "true",
CometConf.getExprAllowIncompatConfigKey(classOf[Floor]) -> "true") {
"parquet.enable.dictionary" -> dictionary) {
withParquetTable(
(-5 until 5).map(i => (i.toDouble + 0.3, i.toDouble + 0.8)),
"tbl",
Expand Down Expand Up @@ -1487,6 +1485,10 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
checkSparkAnswerAndOperator(s"SELECT floor(cast(${n} as decimal(38, 18))) FROM tbl")
checkSparkAnswerAndOperator(s"SELECT floor(cast(${n} as decimal(20, 0))) FROM tbl")
}
for (n <- Seq("123.45", "125.00", "-129.99")) {
checkSparkAnswerAndOperator(s"SELECT ceil(cast(${n} as decimal(5, 2))) FROM tbl")
checkSparkAnswerAndOperator(s"SELECT floor(cast(${n} as decimal(5, 2))) FROM tbl")
}
}
}
}
Expand Down
Loading