Skip to content

Commit dbd74c2

Browse files
oleg-zinovevcgivre
authored andcommitted
DRILL-7773: Incorrect conversion result to TIME_EPOCH_BE
1 parent 792d0c2 commit dbd74c2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void setup() {
4848
@Override
4949
public void eval() {
5050
buffer.clear();
51-
buffer.writeLong(Integer.reverseBytes(in.value));
51+
buffer.writeLong(Long.reverseBytes(in.value));
5252
out.buffer = buffer;
5353
out.start = 0;
5454
out.end = 8;

exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,11 @@ public void testBinaryString() throws Exception {
617617
}
618618
}
619619

620+
@Test // DRILL-7773
621+
public void testTimeEpochBE() throws Throwable {
622+
verifyPhysicalPlan("cast(convert_from(convert_to('23:30:21', 'TIME_EPOCH_BE'), 'TIME_EPOCH_BE') as time)", LocalTime.of(23, 30, 21));
623+
}
624+
620625
protected <T> void verifySQL(String sql, T expectedResults) throws Throwable {
621626
verifyResults(sql, expectedResults, getRunResult(QueryType.SQL, sql));
622627
}

0 commit comments

Comments
 (0)