You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by cg...@apache.org on 2020/08/03 02:57:54 UTC

[drill] branch master updated: DRILL-7773: Incorrect conversion result to TIME_EPOCH_BE

This is an automated email from the ASF dual-hosted git repository.

cgivre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git


The following commit(s) were added to refs/heads/master by this push:
     new dbd74c2  DRILL-7773: Incorrect conversion result to TIME_EPOCH_BE
dbd74c2 is described below

commit dbd74c27304db50cdb808ba33679031b247aaccf
Author: Oleg Zinoviev <oz...@solit-clouds.ru>
AuthorDate: Wed Jul 29 15:29:30 2020 +0300

    DRILL-7773: Incorrect conversion result to TIME_EPOCH_BE
---
 .../apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java    | 2 +-
 .../org/apache/drill/exec/physical/impl/TestConvertFunctions.java    | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java
index a7a08f2..e28dfc4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java
@@ -48,7 +48,7 @@ public class TimeEpochBEConvertTo implements DrillSimpleFunc {
   @Override
   public void eval() {
     buffer.clear();
-    buffer.writeLong(Integer.reverseBytes(in.value));
+    buffer.writeLong(Long.reverseBytes(in.value));
     out.buffer = buffer;
     out.start = 0;
     out.end = 8;
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
index 5776d43..40595df 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
@@ -617,6 +617,11 @@ public class TestConvertFunctions extends BaseTestQuery {
     }
   }
 
+  @Test // DRILL-7773
+  public void testTimeEpochBE() throws Throwable {
+    verifyPhysicalPlan("cast(convert_from(convert_to('23:30:21', 'TIME_EPOCH_BE'), 'TIME_EPOCH_BE') as time)", LocalTime.of(23, 30, 21));
+  }
+
   protected <T> void verifySQL(String sql, T expectedResults) throws Throwable {
     verifyResults(sql, expectedResults, getRunResult(QueryType.SQL, sql));
   }