IGNITE-4158: Added java.sql.Time support for BinaryMarshaller. This closes 
#1515.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/00dd3d81
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/00dd3d81
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/00dd3d81

Branch: refs/heads/ignite-3477-merge2.0
Commit: 00dd3d815e0bf61784151891304ed01babed1e05
Parents: 2f57470
Author: Vyacheslav Daradur <daradu...@gmail.com>
Authored: Mon Feb 13 14:42:13 2017 +0300
Committer: devozerov <voze...@gridgain.com>
Committed: Mon Feb 13 14:42:13 2017 +0300

----------------------------------------------------------------------
 .../apache/ignite/binary/BinaryRawReader.java   | 13 ++++
 .../apache/ignite/binary/BinaryRawWriter.java   | 13 ++++
 .../org/apache/ignite/binary/BinaryReader.java  | 15 ++++
 .../org/apache/ignite/binary/BinaryWriter.java  | 15 ++++
 .../internal/binary/BinaryClassDescriptor.java  | 13 ++++
 .../ignite/internal/binary/BinaryContext.java   |  3 +
 .../internal/binary/BinaryFieldAccessor.java    | 23 ++++++
 .../binary/BinaryMetadataCollector.java         | 11 +++
 .../internal/binary/BinaryObjectImpl.java       |  9 +++
 .../binary/BinaryObjectOffheapImpl.java         |  9 +++
 .../internal/binary/BinaryReaderExImpl.java     | 58 ++++++++++++++
 .../binary/BinarySerializedFieldComparator.java |  3 +
 .../ignite/internal/binary/BinaryUtils.java     | 79 ++++++++++++++++++--
 .../ignite/internal/binary/BinaryWriteMode.java |  6 ++
 .../internal/binary/BinaryWriterExImpl.java     | 66 ++++++++++++++++
 .../internal/binary/GridBinaryMarshaller.java   |  6 ++
 .../binary/builder/BinaryBuilderReader.java     | 37 +++++++++
 .../processors/odbc/OdbcRequestHandler.java     |  2 +
 .../binary/BinaryMarshallerSelfTest.java        | 59 +++++++++++++++
 19 files changed, 432 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawReader.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawReader.java 
b/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawReader.java
index ce059d1..c51a9c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawReader.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.binary;
 
 import java.math.BigDecimal;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -110,6 +111,12 @@ public interface BinaryRawReader {
     @Nullable public Timestamp readTimestamp() throws BinaryObjectException;
 
     /**
+     * @return Time.
+     * @throws BinaryObjectException In case of error.
+     */
+    @Nullable public Time readTime() throws BinaryObjectException;
+
+    /**
      * @return Object.
      * @throws BinaryObjectException In case of error.
      */
@@ -194,6 +201,12 @@ public interface BinaryRawReader {
     @Nullable public Timestamp[] readTimestampArray() throws 
BinaryObjectException;
 
     /**
+     * @return Time array.
+     * @throws BinaryObjectException In case of error.
+     */
+    @Nullable public Time[] readTimeArray() throws BinaryObjectException;
+
+    /**
      * @return Object array.
      * @throws BinaryObjectException In case of error.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawWriter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawWriter.java 
b/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawWriter.java
index f283c06..84ce3de 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryRawWriter.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.binary;
 
 import java.math.BigDecimal;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -110,6 +111,12 @@ public interface BinaryRawWriter {
     public void writeTimestamp(@Nullable Timestamp val) throws 
BinaryObjectException;
 
     /**
+     * @param val Time to write.
+     * @throws BinaryObjectException In case of error.
+     */
+    public void writeTime(@Nullable Time val) throws BinaryObjectException;
+
+    /**
      * @param obj Value to write.
      * @throws BinaryObjectException In case of error.
      */
@@ -197,6 +204,12 @@ public interface BinaryRawWriter {
      * @param val Value to write.
      * @throws BinaryObjectException In case of error.
      */
+    public void writeTimeArray(@Nullable Time[] val) throws 
BinaryObjectException;
+
+    /**
+     * @param val Value to write.
+     * @throws BinaryObjectException In case of error.
+     */
     public void writeObjectArray(@Nullable Object[] val) throws 
BinaryObjectException;
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/binary/BinaryReader.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/binary/BinaryReader.java 
b/modules/core/src/main/java/org/apache/ignite/binary/BinaryReader.java
index 93a9469..b04e746 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryReader.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.binary;
 
 import java.math.BigDecimal;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -130,6 +131,13 @@ public interface BinaryReader {
 
     /**
      * @param fieldName Field name.
+     * @return Time.
+     * @throws BinaryObjectException In case of error.
+     */
+    public Time readTime(String fieldName) throws BinaryObjectException;
+
+    /**
+     * @param fieldName Field name.
      * @return Object.
      * @throws BinaryObjectException In case of error.
      */
@@ -228,6 +236,13 @@ public interface BinaryReader {
 
     /**
      * @param fieldName Field name.
+     * @return Time array.
+     * @throws BinaryObjectException In case of error.
+     */
+    public Time[] readTimeArray(String fieldName) throws BinaryObjectException;
+
+    /**
+     * @param fieldName Field name.
      * @return Object array.
      * @throws BinaryObjectException In case of error.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/binary/BinaryWriter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/binary/BinaryWriter.java 
b/modules/core/src/main/java/org/apache/ignite/binary/BinaryWriter.java
index b24b206..541d3d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryWriter.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.binary;
 
 import java.math.BigDecimal;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -131,6 +132,13 @@ public interface BinaryWriter {
 
     /**
      * @param fieldName Field name.
+     * @param val Time to write.
+     * @throws BinaryObjectException In case of error.
+     */
+    public void writeTime(String fieldName, @Nullable Time val) throws 
BinaryObjectException;
+
+    /**
+     * @param fieldName Field name.
      * @param obj Value to write.
      * @throws BinaryObjectException In case of error.
      */
@@ -232,6 +240,13 @@ public interface BinaryWriter {
      * @param val Value to write.
      * @throws BinaryObjectException In case of error.
      */
+    public void writeTimeArray(String fieldName, @Nullable Time[] val) throws 
BinaryObjectException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws BinaryObjectException In case of error.
+     */
     public void writeObjectArray(String fieldName, @Nullable Object[] val) 
throws BinaryObjectException;
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index 3a72a31..b63e674 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -24,6 +24,7 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Proxy;
 import java.math.BigDecimal;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Collections;
@@ -222,6 +223,7 @@ public class BinaryClassDescriptor {
             case UUID:
             case DATE:
             case TIMESTAMP:
+            case TIME:
             case BYTE_ARR:
             case SHORT_ARR:
             case INT_ARR:
@@ -235,6 +237,7 @@ public class BinaryClassDescriptor {
             case UUID_ARR:
             case DATE_ARR:
             case TIMESTAMP_ARR:
+            case TIME_ARR:
             case OBJECT_ARR:
             case COL:
             case MAP:
@@ -611,6 +614,11 @@ public class BinaryClassDescriptor {
 
                 break;
 
+            case TIME:
+                writer.doWriteTime((Time)obj);
+
+                break;
+
             case BYTE_ARR:
                 writer.doWriteByteArray((byte[])obj);
 
@@ -676,6 +684,11 @@ public class BinaryClassDescriptor {
 
                 break;
 
+            case TIME_ARR:
+                writer.doWriteTimeArray((Time[]) obj);
+
+                break;
+
             case OBJECT_ARR:
                 writer.doWriteObjectArray((Object[])obj);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index b291872..6d4cedd 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -98,6 +98,7 @@ import java.math.BigDecimal;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -289,6 +290,7 @@ public class BinaryContext {
         registerPredefinedType(BigDecimal.class, GridBinaryMarshaller.DECIMAL);
         registerPredefinedType(Date.class, GridBinaryMarshaller.DATE);
         registerPredefinedType(Timestamp.class, 
GridBinaryMarshaller.TIMESTAMP);
+        registerPredefinedType(Time.class, GridBinaryMarshaller.TIME);
         registerPredefinedType(UUID.class, GridBinaryMarshaller.UUID);
 
         registerPredefinedType(byte[].class, GridBinaryMarshaller.BYTE_ARR);
@@ -304,6 +306,7 @@ public class BinaryContext {
         registerPredefinedType(UUID[].class, GridBinaryMarshaller.UUID_ARR);
         registerPredefinedType(Date[].class, GridBinaryMarshaller.DATE_ARR);
         registerPredefinedType(Timestamp[].class, 
GridBinaryMarshaller.TIMESTAMP_ARR);
+        registerPredefinedType(Time[].class, GridBinaryMarshaller.TIME_ARR);
         registerPredefinedType(Object[].class, GridBinaryMarshaller.OBJ_ARR);
 
         // Special collections.

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldAccessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldAccessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldAccessor.java
index af33b63..aabb772 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldAccessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldAccessor.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.binary;
 
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -86,6 +87,7 @@ public abstract class BinaryFieldAccessor {
             case UUID:
             case DATE:
             case TIMESTAMP:
+            case TIME:
             case BYTE_ARR:
             case SHORT_ARR:
             case INT_ARR:
@@ -99,6 +101,7 @@ public abstract class BinaryFieldAccessor {
             case UUID_ARR:
             case DATE_ARR:
             case TIMESTAMP_ARR:
+            case TIME_ARR:
             case ENUM_ARR:
             case OBJECT_ARR:
             case BINARY_OBJ:
@@ -522,6 +525,11 @@ public abstract class BinaryFieldAccessor {
 
                     break;
 
+                case TIME:
+                    writer.writeTimeField((Time)val);
+
+                    break;
+
                 case BYTE_ARR:
                     writer.writeByteArrayField((byte[])val);
 
@@ -587,6 +595,11 @@ public abstract class BinaryFieldAccessor {
 
                     break;
 
+                case TIME_ARR:
+                    writer.writeTimeArrayField((Time[])val);
+
+                    break;
+
                 case OBJECT_ARR:
                     writer.writeObjectArrayField((Object[])val);
 
@@ -723,6 +736,11 @@ public abstract class BinaryFieldAccessor {
 
                     break;
 
+                case TIME:
+                    val = reader.readTime(id);
+
+                    break;
+
                 case BYTE_ARR:
                     val = reader.readByteArray(id);
 
@@ -788,6 +806,11 @@ public abstract class BinaryFieldAccessor {
 
                     break;
 
+                case TIME_ARR:
+                    val = reader.readTimeArray(id);
+
+                    break;
+
                 case OBJECT_ARR:
                     val = reader.readObjectArray(id);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
index e8574ef..2585b3b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataCollector.java
@@ -21,6 +21,7 @@ import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.math.BigDecimal;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -144,6 +145,11 @@ class BinaryMetadataCollector implements BinaryWriter {
     }
 
     /** {@inheritDoc} */
+    @Override public void writeTime(String fieldName, @Nullable Time val) 
throws BinaryObjectException {
+        add(fieldName, BinaryWriteMode.TIME);
+    }
+
+    /** {@inheritDoc} */
     @Override public <T extends Enum<?>> void writeEnum(String fieldName, T 
val) throws BinaryObjectException {
         add(fieldName, BinaryWriteMode.ENUM);
     }
@@ -224,6 +230,11 @@ class BinaryMetadataCollector implements BinaryWriter {
     }
 
     /** {@inheritDoc} */
+    @Override public void writeTimeArray(String fieldName, @Nullable Time[] 
val) throws BinaryObjectException {
+        add(fieldName, BinaryWriteMode.TIME_ARR);
+    }
+
+    /** {@inheritDoc} */
     @Override public void writeObjectArray(String fieldName, @Nullable 
Object[] val) throws BinaryObjectException {
         add(fieldName, BinaryWriteMode.OBJECT_ARR);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index 360c71a..7a81659 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -40,6 +40,7 @@ import java.io.ObjectOutput;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Date;
 import java.util.UUID;
@@ -430,6 +431,14 @@ public final class BinaryObjectImpl extends 
BinaryObjectExImpl implements Extern
                 break;
             }
 
+            case GridBinaryMarshaller.TIME: {
+                long time = BinaryPrimitives.readLong(arr, fieldPos + 1);
+
+                val = new Time(time);
+
+                break;
+            }
+
             case GridBinaryMarshaller.UUID: {
                 long most = BinaryPrimitives.readLong(arr, fieldPos + 1);
                 long least = BinaryPrimitives.readLong(arr, fieldPos + 1 + 8);

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
index f9a31db..3f095f7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
@@ -24,6 +24,7 @@ import java.io.ObjectOutput;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Date;
 import java.util.UUID;
@@ -323,6 +324,14 @@ public class BinaryObjectOffheapImpl extends 
BinaryObjectExImpl implements Exter
                 break;
             }
 
+            case GridBinaryMarshaller.TIME: {
+                long time = BinaryPrimitives.readLong(ptr, fieldPos + 1);
+
+                val = new Time(time);
+
+                break;
+            }
+
             case GridBinaryMarshaller.UUID: {
                 long most = BinaryPrimitives.readLong(ptr, fieldPos + 1);
                 long least = BinaryPrimitives.readLong(ptr, fieldPos + 1 + 8);

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
index 775f237..246cf57 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
@@ -21,6 +21,7 @@ import java.io.EOFException;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.math.BigDecimal;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -74,8 +75,10 @@ import static 
org.apache.ignite.internal.binary.GridBinaryMarshaller.SHORT;
 import static org.apache.ignite.internal.binary.GridBinaryMarshaller.SHORT_ARR;
 import static org.apache.ignite.internal.binary.GridBinaryMarshaller.STRING;
 import static 
org.apache.ignite.internal.binary.GridBinaryMarshaller.STRING_ARR;
+import static org.apache.ignite.internal.binary.GridBinaryMarshaller.TIME;
 import static org.apache.ignite.internal.binary.GridBinaryMarshaller.TIMESTAMP;
 import static 
org.apache.ignite.internal.binary.GridBinaryMarshaller.TIMESTAMP_ARR;
+import static org.apache.ignite.internal.binary.GridBinaryMarshaller.TIME_ARR;
 import static 
org.apache.ignite.internal.binary.GridBinaryMarshaller.UNREGISTERED_TYPE_ID;
 import static org.apache.ignite.internal.binary.GridBinaryMarshaller.UUID;
 import static org.apache.ignite.internal.binary.GridBinaryMarshaller.UUID_ARR;
@@ -1105,6 +1108,51 @@ public class BinaryReaderExImpl implements BinaryReader, 
BinaryRawReaderEx, Bina
     }
 
     /** {@inheritDoc} */
+    @Override @Nullable public Time readTime(String fieldName) throws 
BinaryObjectException {
+        return findFieldByName(fieldName) ? this.readTime() : null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public Time readTime() throws BinaryObjectException {
+        return checkFlagNoHandles(TIME) == Flag.NORMAL ? 
BinaryUtils.doReadTime(in) : null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public Time[] readTimeArray(String fieldName) throws 
BinaryObjectException {
+        return findFieldByName(fieldName) ? this.readTimeArray() : null;
+    }
+
+    /**
+     * @param fieldId Field ID.
+     * @return Value.
+     * @throws BinaryObjectException In case of error.
+     */
+    @Nullable Time readTime(int fieldId) throws BinaryObjectException {
+        return findFieldById(fieldId) ? this.readTime() : null;
+    }
+
+    /**
+     * @param fieldId Field ID.
+     * @return Value.
+     * @throws BinaryObjectException In case of error.
+     */
+    @Nullable Time[] readTimeArray(int fieldId) throws BinaryObjectException {
+        return findFieldById(fieldId) ? this.readTimeArray() : null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public Time[] readTimeArray() throws 
BinaryObjectException {
+        switch (checkFlag(TIME_ARR)) {
+            case NORMAL:
+                return BinaryUtils.doReadTimeArray(in);
+            case HANDLE:
+                return readHandleField();
+            default:
+                return null;
+        }
+    }
+
+    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Nullable @Override public <T> T readObject(String fieldName) throws 
BinaryObjectException {
         return findFieldByName(fieldName) ? (T)BinaryUtils.doReadObject(in, 
ctx, ldr, this) : null;
@@ -1566,6 +1614,11 @@ public class BinaryReaderExImpl implements BinaryReader, 
BinaryRawReaderEx, Bina
 
                 break;
 
+            case TIME:
+                obj = BinaryUtils.doReadTime(in);
+
+                break;
+
             case BYTE_ARR:
                 obj = BinaryUtils.doReadByteArray(in);
 
@@ -1631,6 +1684,11 @@ public class BinaryReaderExImpl implements BinaryReader, 
BinaryRawReaderEx, Bina
 
                 break;
 
+            case TIME_ARR:
+                obj = BinaryUtils.doReadTimeArray(in);
+
+                break;
+
             case OBJ_ARR:
                 obj = BinaryUtils.doReadObjectArray(in, ctx, ldr, this, true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinarySerializedFieldComparator.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinarySerializedFieldComparator.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinarySerializedFieldComparator.java
index 130bb0c..4375073 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinarySerializedFieldComparator.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinarySerializedFieldComparator.java
@@ -229,6 +229,9 @@ public class BinarySerializedFieldComparator {
             case GridBinaryMarshaller.TIMESTAMP:
                 return c1.readLong(1) == c2.readLong(1) && c1.readInt(1 + 8) 
== c2.readInt(1 + 8);
 
+            case GridBinaryMarshaller.TIME:
+                return c1.readLong(1) == c2.readLong(1);
+
             case GridBinaryMarshaller.UUID:
                 return c1.readLong(1) == c2.readLong(1) && c1.readLong(1 + 8) 
== c2.readLong(1 + 8);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index 6831ef9..2b55b6c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -28,6 +28,7 @@ import java.lang.reflect.Modifier;
 import java.lang.reflect.Proxy;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -158,6 +159,7 @@ public class BinaryUtils {
         PLAIN_CLASS_TO_FLAG.put(UUID.class, GridBinaryMarshaller.UUID);
         PLAIN_CLASS_TO_FLAG.put(Date.class, GridBinaryMarshaller.DATE);
         PLAIN_CLASS_TO_FLAG.put(Timestamp.class, 
GridBinaryMarshaller.TIMESTAMP);
+        PLAIN_CLASS_TO_FLAG.put(Time.class, GridBinaryMarshaller.TIME);
 
         PLAIN_CLASS_TO_FLAG.put(byte[].class, GridBinaryMarshaller.BYTE_ARR);
         PLAIN_CLASS_TO_FLAG.put(short[].class, GridBinaryMarshaller.SHORT_ARR);
@@ -172,6 +174,7 @@ public class BinaryUtils {
         PLAIN_CLASS_TO_FLAG.put(UUID[].class, GridBinaryMarshaller.UUID_ARR);
         PLAIN_CLASS_TO_FLAG.put(Date[].class, GridBinaryMarshaller.DATE_ARR);
         PLAIN_CLASS_TO_FLAG.put(Timestamp[].class, 
GridBinaryMarshaller.TIMESTAMP_ARR);
+        PLAIN_CLASS_TO_FLAG.put(Time[].class, GridBinaryMarshaller.TIME_ARR);
 
         for (Map.Entry<Class<?>, Byte> entry : PLAIN_CLASS_TO_FLAG.entrySet())
             FLAG_TO_CLASS.put(entry.getValue(), entry.getKey());
@@ -187,8 +190,8 @@ public class BinaryUtils {
 
         for (byte b : new byte[] {
             GridBinaryMarshaller.BYTE, GridBinaryMarshaller.SHORT, 
GridBinaryMarshaller.INT, GridBinaryMarshaller.LONG, 
GridBinaryMarshaller.FLOAT, GridBinaryMarshaller.DOUBLE,
-            GridBinaryMarshaller.CHAR, GridBinaryMarshaller.BOOLEAN, 
GridBinaryMarshaller.DECIMAL, GridBinaryMarshaller.STRING, 
GridBinaryMarshaller.UUID, GridBinaryMarshaller.DATE, 
GridBinaryMarshaller.TIMESTAMP,
-            GridBinaryMarshaller.BYTE_ARR, GridBinaryMarshaller.SHORT_ARR, 
GridBinaryMarshaller.INT_ARR, GridBinaryMarshaller.LONG_ARR, 
GridBinaryMarshaller.FLOAT_ARR, GridBinaryMarshaller.DOUBLE_ARR,
+            GridBinaryMarshaller.CHAR, GridBinaryMarshaller.BOOLEAN, 
GridBinaryMarshaller.DECIMAL, GridBinaryMarshaller.STRING, 
GridBinaryMarshaller.UUID, GridBinaryMarshaller.DATE, 
GridBinaryMarshaller.TIMESTAMP, GridBinaryMarshaller.TIME,
+            GridBinaryMarshaller.BYTE_ARR, GridBinaryMarshaller.SHORT_ARR, 
GridBinaryMarshaller.INT_ARR, GridBinaryMarshaller.LONG_ARR, 
GridBinaryMarshaller.FLOAT_ARR, GridBinaryMarshaller.DOUBLE_ARR, 
GridBinaryMarshaller.TIME_ARR,
             GridBinaryMarshaller.CHAR_ARR, GridBinaryMarshaller.BOOLEAN_ARR, 
GridBinaryMarshaller.DECIMAL_ARR, GridBinaryMarshaller.STRING_ARR, 
GridBinaryMarshaller.UUID_ARR, GridBinaryMarshaller.DATE_ARR, 
GridBinaryMarshaller.TIMESTAMP_ARR,
             GridBinaryMarshaller.ENUM, GridBinaryMarshaller.ENUM_ARR, 
GridBinaryMarshaller.NULL}) {
 
@@ -207,6 +210,7 @@ public class BinaryUtils {
         BINARY_CLS.add(UUID.class);
         BINARY_CLS.add(Date.class);
         BINARY_CLS.add(Timestamp.class);
+        BINARY_CLS.add(Time.class);
         BINARY_CLS.add(BigDecimal.class);
         BINARY_CLS.add(byte[].class);
         BINARY_CLS.add(short[].class);
@@ -220,6 +224,7 @@ public class BinaryUtils {
         BINARY_CLS.add(UUID[].class);
         BINARY_CLS.add(Date[].class);
         BINARY_CLS.add(Timestamp[].class);
+        BINARY_CLS.add(Time[].class);
         BINARY_CLS.add(BigDecimal[].class);
 
         FIELD_TYPE_NAMES = new String[104];
@@ -237,6 +242,7 @@ public class BinaryUtils {
         FIELD_TYPE_NAMES[GridBinaryMarshaller.STRING] = "String";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.DATE] = "Date";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.TIMESTAMP] = "Timestamp";
+        FIELD_TYPE_NAMES[GridBinaryMarshaller.TIME] = "Time";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.ENUM] = "Enum";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.OBJ] = "Object";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.BINARY_OBJ] = "Object";
@@ -256,6 +262,7 @@ public class BinaryUtils {
         FIELD_TYPE_NAMES[GridBinaryMarshaller.STRING_ARR] = "String[]";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.DATE_ARR] = "Date[]";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.TIMESTAMP_ARR] = "Timestamp[]";
+        FIELD_TYPE_NAMES[GridBinaryMarshaller.TIME_ARR] = "Time[]";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.OBJ_ARR] = "Object[]";
         FIELD_TYPE_NAMES[GridBinaryMarshaller.ENUM_ARR] = "Enum[]";
 
@@ -445,6 +452,11 @@ public class BinaryUtils {
 
                 break;
 
+            case GridBinaryMarshaller.TIME:
+                writer.doWriteTime((Time)val);
+
+                break;
+
             case GridBinaryMarshaller.BYTE_ARR:
                 writer.doWriteByteArray((byte[])val);
 
@@ -510,6 +522,11 @@ public class BinaryUtils {
 
                 break;
 
+            case GridBinaryMarshaller.TIME_ARR:
+                writer.doWriteTimeArray((Time[])val);
+
+                break;
+
             default:
                 throw new IllegalArgumentException("Can't write object with 
type: " + val.getClass());
         }
@@ -560,7 +577,8 @@ public class BinaryUtils {
      * @return {@code true} if content of serialized array value cannot 
contain references to other object.
      */
     public static boolean isPlainArrayType(int type) {
-        return (type >= GridBinaryMarshaller.BYTE_ARR && type <= 
GridBinaryMarshaller.DATE_ARR) || type == GridBinaryMarshaller.TIMESTAMP_ARR;
+        return (type >= GridBinaryMarshaller.BYTE_ARR && type <= 
GridBinaryMarshaller.DATE_ARR)
+            || type == GridBinaryMarshaller.TIMESTAMP_ARR || type == 
GridBinaryMarshaller.TIME_ARR;
     }
 
     /**
@@ -577,7 +595,8 @@ public class BinaryUtils {
             return GridBinaryMarshaller.ENUM;
 
         if (cls.isArray())
-            return cls.getComponentType().isEnum() || cls.getComponentType() 
== Enum.class ? GridBinaryMarshaller.ENUM_ARR : GridBinaryMarshaller.OBJ_ARR;
+            return cls.getComponentType().isEnum() || cls.getComponentType() 
== Enum.class ?
+                GridBinaryMarshaller.ENUM_ARR : GridBinaryMarshaller.OBJ_ARR;
 
         if (isSpecialCollection(cls))
             return GridBinaryMarshaller.COL;
@@ -695,7 +714,7 @@ public class BinaryUtils {
         return cls == byte[].class || cls == short[].class || cls == 
int[].class || cls == long[].class ||
             cls == float[].class || cls == double[].class || cls == 
char[].class || cls == boolean[].class ||
             cls == String[].class || cls == UUID[].class || cls == 
Date[].class || cls == Timestamp[].class ||
-            cls == BigDecimal[].class;
+            cls == BigDecimal[].class || cls == Time[].class;
     }
 
     /**
@@ -1000,7 +1019,7 @@ public class BinaryUtils {
     public static BinaryWriteMode mode(Class<?> cls) {
         assert cls != null;
 
-        /** Primitives. */
+        // Primitives.
         if (cls == byte.class)
             return BinaryWriteMode.P_BYTE;
         else if (cls == boolean.class)
@@ -1018,7 +1037,7 @@ public class BinaryUtils {
         else if (cls == double.class)
             return BinaryWriteMode.P_DOUBLE;
 
-        /** Boxed primitives. */
+        // Boxed primitives.
         else if (cls == Byte.class)
             return BinaryWriteMode.BYTE;
         else if (cls == Boolean.class)
@@ -1036,7 +1055,7 @@ public class BinaryUtils {
         else if (cls == Double.class)
             return BinaryWriteMode.DOUBLE;
 
-        /** The rest types. */
+        // The rest types.
         else if (cls == BigDecimal.class)
             return BinaryWriteMode.DECIMAL;
         else if (cls == String.class)
@@ -1047,6 +1066,8 @@ public class BinaryUtils {
             return BinaryWriteMode.DATE;
         else if (cls == Timestamp.class)
             return BinaryWriteMode.TIMESTAMP;
+        else if (cls == Time.class)
+            return BinaryWriteMode.TIME;
         else if (cls == byte[].class)
             return BinaryWriteMode.BYTE_ARR;
         else if (cls == short[].class)
@@ -1073,6 +1094,8 @@ public class BinaryUtils {
             return BinaryWriteMode.DATE_ARR;
         else if (cls == Timestamp[].class)
             return BinaryWriteMode.TIMESTAMP_ARR;
+        else if (cls == Time[].class)
+            return BinaryWriteMode.TIME_ARR;
         else if (cls.isArray())
             return cls.getComponentType().isEnum() ? BinaryWriteMode.ENUM_ARR 
: BinaryWriteMode.OBJECT_ARR;
         else if (cls == BinaryObjectImpl.class)
@@ -1270,6 +1293,15 @@ public class BinaryUtils {
 
     /**
      * @return Value.
+     */
+    public static Time doReadTime(BinaryInputStream in) {
+        long time = in.readLong();
+
+        return new Time(time);
+    }
+
+    /**
+     * @return Value.
      * @throws BinaryObjectException In case of error.
      */
     public static BigDecimal[] doReadDecimalArray(BinaryInputStream in) throws 
BinaryObjectException {
@@ -1395,6 +1427,31 @@ public class BinaryUtils {
 
     /**
      * @return Value.
+     * @throws BinaryObjectException In case of error.
+     */
+    public static Time[] doReadTimeArray(BinaryInputStream in) throws 
BinaryObjectException {
+        int len = in.readInt();
+
+        Time[] arr = new Time[len];
+
+        for (int i = 0; i < len; i++) {
+            byte flag = in.readByte();
+
+            if (flag == GridBinaryMarshaller.NULL)
+                arr[i] = null;
+            else {
+                if (flag != GridBinaryMarshaller.TIME)
+                    throw new BinaryObjectException("Invalid flag value: " + 
flag);
+
+                arr[i] = doReadTime(in);
+            }
+        }
+
+        return arr;
+    }
+
+    /**
+     * @return Value.
      */
     public static BinaryObject doReadBinaryObject(BinaryInputStream in, 
BinaryContext ctx) {
         if (in.offheapPointer() > 0) {
@@ -1759,6 +1816,9 @@ public class BinaryUtils {
             case GridBinaryMarshaller.TIMESTAMP:
                 return doReadTimestamp(in);
 
+            case GridBinaryMarshaller.TIME:
+                return doReadTime(in);
+
             case GridBinaryMarshaller.BYTE_ARR:
                 return doReadByteArray(in);
 
@@ -1798,6 +1858,9 @@ public class BinaryUtils {
             case GridBinaryMarshaller.TIMESTAMP_ARR:
                 return doReadTimestampArray(in);
 
+            case GridBinaryMarshaller.TIME_ARR:
+                return doReadTimeArray(in);
+
             case GridBinaryMarshaller.OBJ_ARR:
                 return doReadObjectArray(in, ctx, ldr, handles, false);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
index 7e8c9bd..fb000a0 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
@@ -85,6 +85,9 @@ public enum BinaryWriteMode {
     TIMESTAMP(GridBinaryMarshaller.TIMESTAMP),
 
     /** */
+    TIME(GridBinaryMarshaller.TIME),
+
+    /** */
     BYTE_ARR(GridBinaryMarshaller.BYTE_ARR),
 
     /** */
@@ -124,6 +127,9 @@ public enum BinaryWriteMode {
     TIMESTAMP_ARR(GridBinaryMarshaller.TIMESTAMP_ARR),
 
     /** */
+    TIME_ARR(GridBinaryMarshaller.TIME_ARR),
+
+    /** */
     OBJECT_ARR(GridBinaryMarshaller.OBJ_ARR),
 
     /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
index 3289780..ba4822f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
@@ -23,6 +23,7 @@ import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.Date;
@@ -486,6 +487,19 @@ public class BinaryWriterExImpl implements BinaryWriter, 
BinaryRawWriterEx, Obje
     }
 
     /**
+     * @param time Time.
+     */
+    public void doWriteTime(@Nullable Time time) {
+        if (time== null)
+            out.writeByte(GridBinaryMarshaller.NULL);
+        else {
+            out.unsafeEnsure(1 + 8);
+            out.unsafeWriteByte(GridBinaryMarshaller.TIME);
+            out.unsafeWriteLong(time.getTime());
+        }
+    }
+
+    /**
      * Write object.
      *
      * @param obj Object.
@@ -702,6 +716,22 @@ public class BinaryWriterExImpl implements BinaryWriter, 
BinaryRawWriterEx, Obje
      }
 
     /**
+     * @param val Array of time.
+     */
+    void doWriteTimeArray(@Nullable Time[] val) {
+        if (val == null)
+            out.writeByte(GridBinaryMarshaller.NULL);
+        else {
+            out.unsafeEnsure(1 + 4);
+            out.unsafeWriteByte(GridBinaryMarshaller.TIME_ARR);
+            out.unsafeWriteInt(val.length);
+
+            for (Time time : val)
+                doWriteTime(time);
+        }
+    }
+
+    /**
      * @param val Array of objects.
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
@@ -1126,6 +1156,13 @@ public class BinaryWriterExImpl implements BinaryWriter, 
BinaryRawWriterEx, Obje
     }
 
     /**
+     * @param val Value.
+     */
+    void writeTimeField(@Nullable Time val) {
+        doWriteTime(val);
+    }
+
+    /**
      * @param obj Object.
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
@@ -1226,6 +1263,13 @@ public class BinaryWriterExImpl implements BinaryWriter, 
BinaryRawWriterEx, Obje
 
     /**
      * @param val Value.
+     */
+    void writeTimeArrayField(@Nullable Time[] val) {
+        doWriteTimeArray(val);
+    }
+
+    /**
+     * @param val Value.
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
     void writeObjectArrayField(@Nullable Object[] val) throws 
BinaryObjectException {
@@ -1414,6 +1458,17 @@ public class BinaryWriterExImpl implements BinaryWriter, 
BinaryRawWriterEx, Obje
     }
 
     /** {@inheritDoc} */
+    @Override public void writeTime(String fieldName, @Nullable Time val) 
throws BinaryObjectException {
+        writeFieldId(fieldName);
+        writeTimeField(val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeTime(@Nullable Time val) throws 
BinaryObjectException {
+        doWriteTime(val);
+    }
+
+    /** {@inheritDoc} */
     @Override public void writeObject(String fieldName, @Nullable Object obj) 
throws BinaryObjectException {
         writeFieldId(fieldName);
         writeObjectField(obj);
@@ -1582,6 +1637,17 @@ public class BinaryWriterExImpl implements BinaryWriter, 
BinaryRawWriterEx, Obje
         doWriteTimestampArray(val);
     }
 
+    /** {@inheritDoc} */
+    @Override public void writeTimeArray(String fieldName, @Nullable Time[] 
val) throws BinaryObjectException {
+        writeFieldId(fieldName);
+        writeTimeArrayField(val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeTimeArray(@Nullable Time[] val) throws 
BinaryObjectException {
+        doWriteTimeArray(val);
+    }
+
      /** {@inheritDoc} */
     @Override public void writeObjectArray(String fieldName, @Nullable 
Object[] val) throws BinaryObjectException {
         writeFieldId(fieldName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
index 624fa33..8616155 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
@@ -147,6 +147,12 @@ public class GridBinaryMarshaller {
     /** Proxy. */
     public static final byte PROXY = 35;
 
+    /** Time. */
+    public static final byte TIME = 36;
+
+    /** Time array. */
+    public static final byte TIME_ARR = 37;
+
     /** */
     public static final byte NULL = (byte)101;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderReader.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderReader.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderReader.java
index baaabd6..9cd032d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderReader.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderReader.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.binary.BinarySchema;
 import org.apache.ignite.internal.binary.streams.BinaryHeapInputStream;
 import org.apache.ignite.internal.binary.BinaryUtils;
 
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Date;
 import java.util.HashMap;
@@ -292,6 +293,11 @@ public class BinaryBuilderReader implements 
BinaryPositionReadable {
 
                 break;
 
+            case GridBinaryMarshaller.TIME:
+                len = 8;
+
+                break;
+
             case GridBinaryMarshaller.CHAR_ARR:
             case GridBinaryMarshaller.SHORT_ARR:
                 len = 4 + readLength() * 2;
@@ -313,6 +319,7 @@ public class BinaryBuilderReader implements 
BinaryPositionReadable {
             case GridBinaryMarshaller.DECIMAL_ARR:
             case GridBinaryMarshaller.DATE_ARR:
             case GridBinaryMarshaller.TIMESTAMP_ARR:
+            case GridBinaryMarshaller.TIME_ARR:
             case GridBinaryMarshaller.OBJ_ARR:
             case GridBinaryMarshaller.ENUM_ARR:
             case GridBinaryMarshaller.UUID_ARR:
@@ -428,6 +435,7 @@ public class BinaryBuilderReader implements 
BinaryPositionReadable {
             case GridBinaryMarshaller.UUID:
             case GridBinaryMarshaller.DATE:
             case GridBinaryMarshaller.TIMESTAMP:
+            case GridBinaryMarshaller.TIME:
                 return new BinaryPlainLazyValue(this, pos, len);
 
             case GridBinaryMarshaller.BYTE_ARR:
@@ -441,6 +449,7 @@ public class BinaryBuilderReader implements 
BinaryPositionReadable {
             case GridBinaryMarshaller.DECIMAL_ARR:
             case GridBinaryMarshaller.DATE_ARR:
             case GridBinaryMarshaller.TIMESTAMP_ARR:
+            case GridBinaryMarshaller.TIME_ARR:
             case GridBinaryMarshaller.UUID_ARR:
             case GridBinaryMarshaller.STRING_ARR:
             case GridBinaryMarshaller.ENUM_ARR:
@@ -587,6 +596,11 @@ public class BinaryBuilderReader implements 
BinaryPositionReadable {
 
                 break;
 
+            case GridBinaryMarshaller.TIME:
+                plainLazyValLen = 8;
+
+                break;
+
             case GridBinaryMarshaller.BYTE_ARR:
                 plainLazyValLen = 4 + readLength();
                 modifiableLazyVal = true;
@@ -693,6 +707,29 @@ public class BinaryBuilderReader implements 
BinaryPositionReadable {
                 return res;
             }
 
+            case GridBinaryMarshaller.TIME_ARR: {
+                int size = readInt();
+
+                Time[] res = new Time[size];
+
+                for (int i = 0; i < res.length; i++) {
+                    byte flag = arr[pos++];
+
+                    if (flag == GridBinaryMarshaller.NULL) continue;
+
+                    if (flag != GridBinaryMarshaller.TIME)
+                        throw new BinaryObjectException("Invalid flag value: " 
+ flag);
+
+                    long time = BinaryPrimitives.readLong(arr, pos);
+
+                    pos += 8;
+
+                    res[i] = new Time(time);
+                }
+
+                return res;
+            }
+
             case GridBinaryMarshaller.UUID_ARR:
             case GridBinaryMarshaller.STRING_ARR:
             case GridBinaryMarshaller.DECIMAL_ARR: {

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
index f922d9a..311d2eb 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
@@ -473,6 +473,8 @@ public class OdbcRequestHandler {
                 return GridBinaryMarshaller.SHORT;
 
             case Types.TIME:
+                return GridBinaryMarshaller.TIME;
+
             case Types.TIMESTAMP:
                 return GridBinaryMarshaller.TIMESTAMP;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/00dd3d81/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
index 2d43559..5bfc95c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
@@ -31,6 +31,7 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.RoundingMode;
 import java.net.InetSocketAddress;
+import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.AbstractQueue;
 import java.util.ArrayList;
@@ -316,6 +317,22 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
+    public void testTime() throws Exception {
+        Time time = new Time(System.currentTimeMillis());
+        assertEquals(time, marshalUnmarshal(time));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTimeArray() throws Exception {
+        Time[] times = new Time[]{new Time(System.currentTimeMillis()), new 
Time(123456789)};
+        assertArrayEquals(times, marshalUnmarshal(times));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testByteArray() throws Exception {
         byte[] arr = new byte[] {10, 20, 30};
 
@@ -629,10 +646,14 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
 
         Date date = new Date();
         Timestamp ts = new Timestamp(System.currentTimeMillis());
+        Time time = new Time(System.currentTimeMillis());
+        Time[] timeArr = new Time[]{time, new Time(date.getTime()), new 
Time(System.currentTimeMillis())};
 
         DateClass1 obj1 = new DateClass1();
         obj1.date = date;
         obj1.ts = ts;
+        obj1.time = time;
+        obj1.timeArr = timeArr;
 
         BinaryObject po1 = marshal(obj1, marsh);
 
@@ -640,10 +661,16 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
         assertEquals(Date.class, po1.field("date").getClass());
         assertEquals(ts, po1.field("ts"));
         assertEquals(Timestamp.class, po1.field("ts").getClass());
+        assertEquals(time, po1.field("time"));
+        assertEquals(Time.class, po1.field("time").getClass());
+        assertArrayEquals(timeArr, (Object[])po1.field("timeArr"));
+        assertEquals(Time[].class, po1.field("timeArr").getClass());
 
         obj1 = po1.deserialize();
         assertEquals(date, obj1.date);
         assertEquals(ts, obj1.ts);
+        assertEquals(time, obj1.time);
+        assertArrayEquals(timeArr, obj1.timeArr);
     }
 
     /**
@@ -3976,6 +4003,9 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
         private Timestamp ts;
 
         /** */
+        private Time time;
+
+        /** */
         private byte[] bArr;
 
         /** */
@@ -4009,6 +4039,9 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
         private Date[] dateArr;
 
         /** */
+        private Time[] timeArr;
+
+        /** */
         private Object[] objArr;
 
         /** */
@@ -4124,6 +4157,12 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
         private Timestamp tsRaw;
 
         /** */
+        private Time time;
+
+        /** */
+        private Time timeRaw;
+
+        /** */
         private byte[] bArr;
 
         /** */
@@ -4190,6 +4229,12 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
         private Date[] dateArrRaw;
 
         /** */
+        private Time[] timeArr;
+
+        /** */
+        private Time[] timeArrRaw;
+
+        /** */
         private Object[] objArr;
 
         /** */
@@ -4245,6 +4290,7 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
             writer.writeUuid("_uuid", uuid);
             writer.writeDate("_date", date);
             writer.writeTimestamp("_ts", ts);
+            writer.writeTime("_time", time);
             writer.writeByteArray("_bArr", bArr);
             writer.writeShortArray("_sArr", sArr);
             writer.writeIntArray("_iArr", iArr);
@@ -4256,6 +4302,7 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
             writer.writeStringArray("_strArr", strArr);
             writer.writeUuidArray("_uuidArr", uuidArr);
             writer.writeDateArray("_dateArr", dateArr);
+            writer.writeTimeArray("_timeArr", timeArr);
             writer.writeObjectArray("_objArr", objArr);
             writer.writeCollection("_col", col);
             writer.writeMap("_map", map);
@@ -4278,6 +4325,7 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
             raw.writeUuid(uuidRaw);
             raw.writeDate(dateRaw);
             raw.writeTimestamp(tsRaw);
+            raw.writeTime(timeRaw);
             raw.writeByteArray(bArrRaw);
             raw.writeShortArray(sArrRaw);
             raw.writeIntArray(iArrRaw);
@@ -4289,6 +4337,7 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
             raw.writeStringArray(strArrRaw);
             raw.writeUuidArray(uuidArrRaw);
             raw.writeDateArray(dateArrRaw);
+            raw.writeTimeArray(timeArrRaw);
             raw.writeObjectArray(objArrRaw);
             raw.writeCollection(colRaw);
             raw.writeMap(mapRaw);
@@ -4312,6 +4361,7 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
             uuid = reader.readUuid("_uuid");
             date = reader.readDate("_date");
             ts = reader.readTimestamp("_ts");
+            time = reader.readTime("_time");
             bArr = reader.readByteArray("_bArr");
             sArr = reader.readShortArray("_sArr");
             iArr = reader.readIntArray("_iArr");
@@ -4323,6 +4373,7 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
             strArr = reader.readStringArray("_strArr");
             uuidArr = reader.readUuidArray("_uuidArr");
             dateArr = reader.readDateArray("_dateArr");
+            timeArr = reader.readTimeArray("_timeArr");
             objArr = reader.readObjectArray("_objArr");
             col = reader.readCollection("_col");
             map = reader.readMap("_map");
@@ -4345,6 +4396,7 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
             uuidRaw = raw.readUuid();
             dateRaw = raw.readDate();
             tsRaw = raw.readTimestamp();
+            timeRaw = raw.readTime();
             bArrRaw = raw.readByteArray();
             sArrRaw = raw.readShortArray();
             iArrRaw = raw.readIntArray();
@@ -4356,6 +4408,7 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
             strArrRaw = raw.readStringArray();
             uuidArrRaw = raw.readUuidArray();
             dateArrRaw = raw.readDateArray();
+            timeArrRaw = raw.readTimeArray();
             objArrRaw = raw.readObjectArray();
             colRaw = raw.readCollection();
             mapRaw = raw.readMap();
@@ -4873,6 +4926,12 @@ public class BinaryMarshallerSelfTest extends 
GridCommonAbstractTest {
 
         /** */
         private Timestamp ts;
+
+        /** */
+        private Time time;
+
+        /** */
+        private Time[] timeArr;
     }
 
     /**

Reply via email to