LakshSingla commented on code in PR #17411:
URL: https://github.com/apache/druid/pull/17411#discussion_r1816044124


##########
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQTasksTest.java:
##########
@@ -244,6 +247,41 @@ public void 
test_queryWithoutEnoughSlots_shouldThrowException()
     }
   }
 
+  @Test
+  public void test_getPrimaryTimestampFromObjectForInsert_longValue()
+  {
+    Assert.assertEquals(100, 
MSQTasks.primaryTimestampFromObjectForInsert(100L));
+  }
+
+  @Test
+  public void 
test_getPrimaryTimestampFromObjectForInsert_nullValueShouldThrowError()
+  {
+    final MSQException e = Assert.assertThrows(
+        MSQException.class,
+        () -> MSQTasks.primaryTimestampFromObjectForInsert(null)
+    );
+    Assert.assertEquals(InsertTimeNullFault.INSTANCE, e.getFault());
+  }
+
+  @Test
+  public void 
test_getPrimaryTimestampFromObjectForInsert_DoubleValueShouldThrowError()
+  {
+    final Object timestamp = 1.693837200123456E15;
+    final MSQException e = Assert.assertThrows(
+        MSQException.class,
+        () -> MSQTasks.primaryTimestampFromObjectForInsert(timestamp)
+    );
+    Assert.assertEquals(
+        UnknownFault.forMessage(
+            StringUtils.format(
+                "Incorrect type for column [%s]. Expected LONG but got type 
[%s]. Please ensure that the value is cast to LONG.",
+                ColumnHolder.TIME_COLUMN_NAME,
+                timestamp.getClass().getSimpleName()
+            )
+        ), e.getFault()

Review Comment:
   nit: formatting



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to