File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
main/java/org/apache/calcite/avatica/remote
test/java/org/apache/calcite/avatica/remote Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ public Object toLocal() {
269269 * representation. */
270270 private static Object serialToLocal (ColumnMetaData .Rep rep , Object value ) {
271271 assert value != null ;
272- if (value . getClass () == rep .clazz ) {
272+ if (rep .clazz . isInstance ( value ) ) {
273273 return value ;
274274 }
275275 switch (rep ) {
Original file line number Diff line number Diff line change 4444
4545import static org .hamcrest .CoreMatchers .instanceOf ;
4646import static org .hamcrest .CoreMatchers .is ;
47+ import static org .hamcrest .CoreMatchers .sameInstance ;
4748import static org .junit .Assert .assertArrayEquals ;
4849import static org .junit .Assert .assertEquals ;
4950import static org .junit .Assert .assertNotNull ;
@@ -266,6 +267,15 @@ private void serializeAndEqualityCheck(TypedValue value) {
266267 Object localObjCopy = tv1Copy .toLocal ();
267268 assertTrue ("The local object is an " + localObjCopy .getClass (), localObjCopy instanceof List );
268269 }
270+
271+ @ Test public void testObjects () {
272+ Object o1 = "This is a string" ;
273+ TypedValue tv1 = TypedValue .ofJdbc (Rep .OBJECT , o1 , Unsafe .localCalendar ());
274+ Object jdbcObj = tv1 .toJdbc (Unsafe .localCalendar ());
275+ assertThat (jdbcObj , is (sameInstance (o1 )));
276+ Object localObj = tv1 .toLocal ();
277+ assertThat (jdbcObj , is (sameInstance (o1 )));
278+ }
269279}
270280
271281// End TypedValueTest.java
You can’t perform that action at this time.
0 commit comments