You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by yz...@apache.org on 2017/01/23 10:41:54 UTC

[01/10] ignite git commit: IGNITE-4530: Add support to provide AWSCredentialsProvider to TcpDiscoveryS3IpFinder in addition to just AWSCredentials Reviewed and merged by Denis Magda (dmagda@apache.org)

Repository: ignite
Updated Branches:
  refs/heads/ignite-comm-balance-master b43247818 -> 6951b20f4


IGNITE-4530: Add support to provide AWSCredentialsProvider to TcpDiscoveryS3IpFinder in addition to just AWSCredentials
Reviewed and merged by Denis Magda (dmagda@apache.org)


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

Branch: refs/heads/ignite-comm-balance-master
Commit: 80bcf2739c3f84769805005d7c0acb5769606e7d
Parents: 177d7f4
Author: Aliaksandr Kazlou <al...@gmail.com>
Authored: Wed Jan 18 11:39:36 2017 -0800
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jan 18 11:39:36 2017 -0800

----------------------------------------------------------------------
 .../tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java | 37 ++++++++-
 .../TcpDiscoveryS3IpFinderAbstractSelfTest.java | 84 ++++++++++++++++++++
 ...3IpFinderAwsCredentialsProviderSelfTest.java | 46 +++++++++++
 ...scoveryS3IpFinderAwsCredentialsSelfTest.java | 45 +++++++++++
 .../s3/TcpDiscoveryS3IpFinderSelfTest.java      | 79 ------------------
 .../ignite/testsuites/IgniteS3TestSuite.java    | 26 +++---
 6 files changed, 225 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/80bcf273/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java b/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
index 86e4eb2..53d6532 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
@@ -20,6 +20,7 @@ package org.apache.ignite.spi.discovery.tcp.ipfinder.s3;
 import com.amazonaws.AmazonClientException;
 import com.amazonaws.ClientConfiguration;
 import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.auth.AWSCredentialsProvider;
 import com.amazonaws.services.s3.AmazonS3;
 import com.amazonaws.services.s3.AmazonS3Client;
 import com.amazonaws.services.s3.model.ObjectListing;
@@ -51,7 +52,8 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter;
  * <h1 class="header">Configuration</h1>
  * <h2 class="header">Mandatory</h2>
  * <ul>
- *      <li>AWS credentials (see {@link #setAwsCredentials(AWSCredentials)})</li>
+ *      <li>AWS credentials (see {@link #setAwsCredentials(AWSCredentials)} and
+ *      {@link #setAwsCredentials(AWSCredentialsProvider)})</li>
  *      <li>Bucket name (see {@link #setBucketName(String)})</li>
  * </ul>
  * <h2 class="header">Optional</h2>
@@ -111,6 +113,10 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
     @GridToStringExclude
     private AWSCredentials cred;
 
+    /** AWS Credentials. */
+    @GridToStringExclude
+    private AWSCredentialsProvider credProvider;
+
     /**
      * Constructor.
      */
@@ -236,7 +242,7 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
     private void initClient() throws IgniteSpiException {
         if (initGuard.compareAndSet(false, true))
             try {
-                if (cred == null)
+                if (cred == null && credProvider == null)
                     throw new IgniteSpiException("AWS credentials are not set.");
 
                 if (cfg == null)
@@ -245,7 +251,7 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
                 if (F.isEmpty(bucketName))
                     throw new IgniteSpiException("Bucket name is null or empty (provide bucket name and restart).");
 
-                s3 = cfg != null ? new AmazonS3Client(cred, cfg) : new AmazonS3Client(cred);
+                s3 = createAmazonS3Client();
 
                 if (!s3.doesBucketExist(bucketName)) {
                     try {
@@ -288,6 +294,17 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
     }
 
     /**
+     * Instantiates {@code AmazonS3Client} instance.
+     *
+     * @return Client instance to use to connect to AWS.
+     */
+    private AmazonS3Client createAmazonS3Client() {
+        return cfg != null
+            ? (cred != null ? new AmazonS3Client(cred, cfg) : new AmazonS3Client(credProvider, cfg))
+            : (cred != null ? new AmazonS3Client(cred) : new AmazonS3Client(credProvider));
+    }
+
+    /**
      * Sets bucket name for IP finder.
      *
      * @param bucketName Bucket name.
@@ -310,7 +327,7 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
     }
 
     /**
-     * Sets AWS credentials.
+     * Sets AWS credentials. Either use {@link #setAwsCredentials(AWSCredentialsProvider)} or this one.
      * <p>
      * For details refer to Amazon S3 API reference.
      *
@@ -321,6 +338,18 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
         this.cred = cred;
     }
 
+    /**
+     * Sets AWS credentials provider. Either use {@link #setAwsCredentials(AWSCredentials)} or this one.
+     * <p>
+     * For details refer to Amazon S3 API reference.
+     *
+     * @param credProvider AWS credentials provider.
+     */
+    @IgniteSpiConfiguration(optional = false)
+    public void setAwsCredentials(AWSCredentialsProvider credProvider) {
+        this.credProvider = credProvider;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(TcpDiscoveryS3IpFinder.class, this, "super", super.toString());

http://git-wip-us.apache.org/repos/asf/ignite/blob/80bcf273/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java
new file mode 100644
index 0000000..d17416f
--- /dev/null
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.discovery.tcp.ipfinder.s3;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.Collection;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAbstractSelfTest;
+import org.apache.ignite.testsuites.IgniteIgnore;
+import org.apache.ignite.testsuites.IgniteS3TestSuite;
+
+/**
+ * Abstract TcpDiscoveryS3IpFinder to test with different ways of setting AWS credentials.
+ */
+abstract class TcpDiscoveryS3IpFinderAbstractSelfTest
+    extends TcpDiscoveryIpFinderAbstractSelfTest<TcpDiscoveryS3IpFinder> {
+    /**
+     * Constructor.
+     *
+     * @throws Exception If any error occurs.
+     */
+    protected TcpDiscoveryS3IpFinderAbstractSelfTest() throws Exception {
+    }
+
+    /** {@inheritDoc} */
+    @Override protected TcpDiscoveryS3IpFinder ipFinder() throws Exception {
+        TcpDiscoveryS3IpFinder finder = new TcpDiscoveryS3IpFinder();
+
+        injectLogger(finder);
+
+        assert finder.isShared() : "Ip finder should be shared by default.";
+
+        setAwsCredentials(finder);
+
+        // Bucket name should be unique for the host to parallel test run on one bucket.
+        String bucketName = IgniteS3TestSuite.getBucketName(
+            "ip-finder-unit-test-bucket-" + InetAddress.getLocalHost().getAddress()[3]);
+        finder.setBucketName(bucketName);
+
+        for (int i = 0; i < 5; i++) {
+            Collection<InetSocketAddress> addrs = finder.getRegisteredAddresses();
+
+            if (!addrs.isEmpty())
+                finder.unregisterAddresses(addrs);
+            else
+                return finder;
+
+            U.sleep(1000);
+        }
+
+        if (!finder.getRegisteredAddresses().isEmpty())
+            throw new Exception("Failed to initialize IP finder.");
+
+        return finder;
+    }
+
+    /** {@inheritDoc} */
+    @IgniteIgnore("https://issues.apache.org/jira/browse/IGNITE-2420")
+    @Override public void testIpFinder() throws Exception {
+        super.testIpFinder();
+    }
+
+    /**
+     * Set AWS credentials into the provided {@code finder}.
+     * @param finder finder credentials to set into
+     */
+    protected abstract void setAwsCredentials(TcpDiscoveryS3IpFinder finder);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/80bcf273/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
new file mode 100644
index 0000000..6952b54
--- /dev/null
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.discovery.tcp.ipfinder.s3;
+
+import com.amazonaws.auth.AWSStaticCredentialsProvider;
+import com.amazonaws.auth.BasicAWSCredentials;
+import org.apache.ignite.testsuites.IgniteS3TestSuite;
+
+/**
+ * TcpDiscoveryS3IpFinder test using AWS credentials provider.
+ */
+public class TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest extends TcpDiscoveryS3IpFinderAbstractSelfTest {
+    /**
+     * Constructor.
+     *
+     * @throws Exception If any error occurs.
+     */
+    public TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest() throws Exception {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void setAwsCredentials(TcpDiscoveryS3IpFinder finder) {
+        finder.setAwsCredentials(new AWSStaticCredentialsProvider(
+            new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(), IgniteS3TestSuite.getSecretKey())));
+    }
+
+    @Override public void testIpFinder() throws Exception {
+        super.testIpFinder();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/80bcf273/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java
new file mode 100644
index 0000000..7447378
--- /dev/null
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.discovery.tcp.ipfinder.s3;
+
+import com.amazonaws.auth.BasicAWSCredentials;
+import org.apache.ignite.testsuites.IgniteS3TestSuite;
+
+/**
+ * TcpDiscoveryS3IpFinder test using AWS credentials.
+ */
+public class TcpDiscoveryS3IpFinderAwsCredentialsSelfTest extends TcpDiscoveryS3IpFinderAbstractSelfTest {
+    /**
+     * Constructor.
+     *
+     * @throws Exception If any error occurs.
+     */
+    public TcpDiscoveryS3IpFinderAwsCredentialsSelfTest() throws Exception {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void setAwsCredentials(TcpDiscoveryS3IpFinder finder) {
+        finder.setAwsCredentials(new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(),
+            IgniteS3TestSuite.getSecretKey()));
+    }
+
+    @Override public void testIpFinder() throws Exception {
+        super.testIpFinder();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/80bcf273/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java
deleted file mode 100644
index a1ebc8f..0000000
--- a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderSelfTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.discovery.tcp.ipfinder.s3;
-
-import com.amazonaws.auth.BasicAWSCredentials;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.util.Collection;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAbstractSelfTest;
-import org.apache.ignite.testsuites.IgniteIgnore;
-import org.apache.ignite.testsuites.IgniteS3TestSuite;
-
-/**
- * TcpDiscoveryS3IpFinder test.
- */
-public class TcpDiscoveryS3IpFinderSelfTest
-    extends TcpDiscoveryIpFinderAbstractSelfTest<TcpDiscoveryS3IpFinder> {
-    /**
-     * Constructor.
-     *
-     * @throws Exception If any error occurs.
-     */
-    public TcpDiscoveryS3IpFinderSelfTest() throws Exception {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected TcpDiscoveryS3IpFinder ipFinder() throws Exception {
-        TcpDiscoveryS3IpFinder finder = new TcpDiscoveryS3IpFinder();
-
-        injectLogger(finder);
-
-        assert finder.isShared() : "Ip finder should be shared by default.";
-
-        finder.setAwsCredentials(new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(),
-            IgniteS3TestSuite.getSecretKey()));
-
-        // Bucket name should be unique for the host to parallel test run on one bucket.
-        finder.setBucketName("ip-finder-unit-test-bucket-" + InetAddress.getLocalHost().getAddress()[3]);
-
-        for (int i = 0; i < 5; i++) {
-            Collection<InetSocketAddress> addrs = finder.getRegisteredAddresses();
-
-            if (!addrs.isEmpty())
-                finder.unregisterAddresses(addrs);
-            else
-                return finder;
-
-            U.sleep(1000);
-        }
-
-        if (!finder.getRegisteredAddresses().isEmpty())
-            throw new Exception("Failed to initialize IP finder.");
-
-        return finder;
-    }
-
-    /** {@inheritDoc} */
-    @IgniteIgnore("https://issues.apache.org/jira/browse/IGNITE-2420")
-    @Override public void testIpFinder() throws Exception {
-        super.testIpFinder();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/80bcf273/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java b/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java
index 86322e6..a703c66 100644
--- a/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java
+++ b/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java
@@ -23,7 +23,8 @@ import org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpiConfigSelfTest;
 import org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpiSelfTest;
 import org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpiStartStopSelfTest;
 import org.apache.ignite.spi.checkpoint.s3.S3SessionCheckpointSelfTest;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinderSelfTest;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinderAwsCredentialsSelfTest;
 import org.apache.ignite.testframework.IgniteTestSuite;
 
 /**
@@ -45,7 +46,8 @@ public class IgniteS3TestSuite extends TestSuite {
         suite.addTestSuite(S3SessionCheckpointSelfTest.class);
 
         // S3 IP finder.
-        suite.addTestSuite(TcpDiscoveryS3IpFinderSelfTest.class);
+        suite.addTestSuite(TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.class);
+        suite.addTestSuite(TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.class);
 
         return suite;
     }
@@ -54,20 +56,26 @@ public class IgniteS3TestSuite extends TestSuite {
      * @return Access key.
      */
     public static String getAccessKey() {
-        String key = System.getenv("test.amazon.access.key");
-
-        assert key != null : "Environment variable 'test.amazon.access.key' is not set";
-
-        return key;
+        return getRequiredEnvVar("test.amazon.access.key");
     }
 
     /**
      * @return Access key.
      */
     public static String getSecretKey() {
-        String key = System.getenv("test.amazon.secret.key");
+        return getRequiredEnvVar("test.amazon.secret.key");
+    }
+
+    public static String getBucketName(final String defaultBucketName) {
+        String value = System.getenv("test.s3.bucket.name");
+
+        return value == null ? defaultBucketName : value;
+    }
+
+    private static String getRequiredEnvVar(String name) {
+        String key = System.getenv(name);
 
-        assert key != null : "Environment variable 'test.amazon.secret.key' is not set";
+        assert key != null : String.format("Environment variable '%s' is not set", name);
 
         return key;
     }


[08/10] ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by yz...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/ignite-comm-balance-master
Commit: b7997fcaaaf038149fc03344692055097d2ac872
Parents: d596f02 f41eb8d
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jan 20 17:33:54 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jan 20 17:33:54 2017 +0300

----------------------------------------------------------------------
 .../tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java |  37 ++-
 .../TcpDiscoveryS3IpFinderAbstractSelfTest.java |  84 +++++
 ...3IpFinderAwsCredentialsProviderSelfTest.java |  46 +++
 ...scoveryS3IpFinderAwsCredentialsSelfTest.java |  45 +++
 .../s3/TcpDiscoveryS3IpFinderSelfTest.java      |  79 -----
 .../ignite/testsuites/IgniteS3TestSuite.java    |  26 +-
 .../store/jdbc/CacheAbstractJdbcStore.java      |  12 +-
 .../store/jdbc/JdbcTypesDefaultTransformer.java |  19 ++
 .../cache/store/jdbc/JdbcTypesTransformer.java  |  17 +
 .../cache/query/GridCacheQueryAdapter.java      |   8 +
 .../internal/processors/odbc/IgniteTypes.java   |  69 ++++
 .../internal/processors/odbc/OdbcTypes.java     | 131 ++++++++
 .../internal/processors/odbc/OdbcUtils.java     |  85 +++++
 .../processors/odbc/escape/OdbcEscapeUtils.java |  52 ++-
 .../platform/cache/PlatformCache.java           |  11 +-
 .../utils/PlatformConfigurationUtils.java       | 128 ++++++-
 .../CacheJdbcPojoStoreAbstractSelfTest.java     |  23 +-
 .../store/jdbc/CacheJdbcPojoStoreTest.java      |   3 +
 ...eJdbcStoreAbstractMultithreadedSelfTest.java |  17 +-
 .../ignite/cache/store/jdbc/model/Gender.java   |  41 +++
 .../ignite/cache/store/jdbc/model/Person.java   |  31 +-
 .../IgniteCacheQueryCacheDestroySelfTest.java   | 142 ++++++++
 .../odbc/OdbcEscapeSequenceSelfTest.java        | 131 ++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 .../cpp/binary/src/impl/binary/binary_utils.cpp |   6 +-
 .../cpp/common/include/ignite/common/utils.h    |   8 +
 .../cpp/common/os/linux/src/common/utils.cpp    |  22 +-
 .../cpp/common/os/win/src/common/utils.cpp      |  14 +-
 modules/platforms/cpp/odbc-test/Makefile.am     |   1 +
 .../odbc-test/include/sql_test_suite_fixture.h  |  13 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   1 +
 .../project/vs/odbc-test.vcxproj.filters        |   3 +
 .../cpp/odbc-test/src/api_robustness_test.cpp   |   2 +-
 .../src/sql_aggregate_functions_test.cpp        |   4 +-
 .../src/sql_esc_convert_function_test.cpp       | 160 +++++++++
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  52 ++-
 .../cpp/odbc-test/src/sql_types_test.cpp        | 131 +++++++-
 .../odbc/src/app/application_data_buffer.cpp    |  58 +++-
 .../platforms/cpp/odbc/src/app/parameter.cpp    |   4 +-
 .../cpp/odbc/src/config/connection_info.cpp     | 260 ++++++++++++++-
 .../Apache.Ignite.Core.Tests.csproj             |   4 +
 .../Binary/BinaryBuilderSelfTest.cs             | 159 ++++++---
 .../BinaryBuilderSelfTestArrayIdentity.cs       |  34 ++
 .../Binary/BinaryEqualityComparerTest.cs        | 279 ++++++++++++++++
 .../Binary/IO/BinaryStreamsTest.cs              |  19 ++
 .../Cache/CacheConfigurationTest.cs             |   5 +-
 .../Cache/Query/CacheDmlQueriesTest.cs          | 296 +++++++++++++++++
 .../Cache/Store/CacheParallelLoadStoreTest.cs   |   9 +-
 .../Cache/Store/CacheStoreSessionTest.cs        |  22 +-
 .../Cache/Store/CacheStoreTest.cs               | 333 ++++++++++++-------
 .../Cache/Store/CacheTestStore.cs               |  14 +
 .../Cache/Store/NamedNodeCacheStoreTest.cs      |  34 ++
 .../IgniteConfigurationSerializerTest.cs        |  46 ++-
 .../IgniteConfigurationTest.cs                  |  28 ++
 .../Apache.Ignite.Core.csproj                   |   5 +
 .../Binary/BinaryArrayEqualityComparer.cs       | 149 +++++++++
 .../Binary/BinaryConfiguration.cs               |  24 ++
 .../Binary/BinaryTypeConfiguration.cs           |  14 +
 .../Cache/Configuration/QueryEntity.cs          |  33 +-
 .../Cache/Configuration/QueryField.cs           |   6 +
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  85 ++++-
 .../IgniteConfigurationSection.xsd              |  19 ++
 .../Apache.Ignite.Core/Impl/Binary/Binary.cs    |  28 +-
 .../Binary/BinaryEqualityComparerSerializer.cs  |  99 ++++++
 .../Impl/Binary/BinaryFieldEqualityComparer.cs  | 138 ++++++++
 .../Impl/Binary/BinaryFullTypeDescriptor.cs     |  21 +-
 .../Impl/Binary/BinaryObject.cs                 |  31 +-
 .../Impl/Binary/BinaryObjectBuilder.cs          |  62 +++-
 .../Impl/Binary/BinaryObjectHeader.cs           |  21 +-
 .../Impl/Binary/BinaryObjectSchemaHolder.cs     |  22 ++
 .../Binary/BinarySurrogateTypeDescriptor.cs     |   6 +
 .../Impl/Binary/BinarySystemHandlers.cs         |   6 +-
 .../Impl/Binary/BinaryWriter.cs                 |  11 +-
 .../Impl/Binary/DateTimeHolder.cs               |  35 +-
 .../Impl/Binary/IBinaryEqualityComparer.cs      |  53 +++
 .../Impl/Binary/IBinaryTypeDescriptor.cs        |   5 +
 .../Impl/Binary/Io/BinaryHeapStream.cs          |   9 +
 .../Impl/Binary/Io/BinaryStreamBase.cs          |  13 +
 .../Impl/Binary/Io/IBinaryStream.cs             |  11 +-
 .../Impl/Binary/Io/IBinaryStreamProcessor.cs    |  36 ++
 .../Impl/Binary/Marshaller.cs                   |  22 +-
 .../Impl/Binary/SerializableObjectHolder.cs     |  16 +
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |  14 +-
 .../Common/IgniteConfigurationXmlSerializer.cs  |   5 +-
 .../Impl/Memory/PlatformMemoryStream.cs         |  16 +
 .../Apache.Ignite.Examples.csproj               |   1 +
 .../Datagrid/QueryDmlExample.cs                 | 162 +++++++++
 .../src/test/config/jdbc-pojo-store-builtin.xml |   8 +
 .../src/test/config/jdbc-pojo-store-obj.xml     |   8 +
 89 files changed, 4009 insertions(+), 445 deletions(-)
----------------------------------------------------------------------



[10/10] ignite git commit: reverted to single connection between server nodes + minor

Posted by yz...@apache.org.
reverted to single connection between server nodes
+ minor


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

Branch: refs/heads/ignite-comm-balance-master
Commit: 6951b20f423c265b28c97bddd91e609904bfde23
Parents: 744b98c
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Jan 23 13:41:43 2017 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Jan 23 13:41:43 2017 +0300

----------------------------------------------------------------------
 .../spi/communication/tcp/TcpCommunicationSpi.java       | 11 ++---------
 .../ignite/testsuites/IgniteCacheRestartTestSuite2.java  |  2 +-
 .../apache/ignite/testsuites/IgniteCacheTestSuite.java   |  4 ----
 3 files changed, 3 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6951b20f/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 675e631..9487248 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -988,7 +988,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     private IpcSharedMemoryServerEndpoint shmemSrv;
 
     /** */
-    private Boolean usePairedConnections;
+    private boolean usePairedConnections;
 
     /** */
     private int connectionsPerNode = DFLT_CONN_PER_NODE;
@@ -1122,13 +1122,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         if (ignite != null) {
             setAddressResolver(ignite.configuration().getAddressResolver());
             setLocalAddress(ignite.configuration().getLocalHost());
-
-            if (usePairedConnections == null) {
-                // If not set, by default should be true for server and false for client.
-                Boolean clientMode = ignite.configuration().isClientMode();
-
-                usePairedConnections = !clientMode;
-            }
         }
     }
 
@@ -1197,7 +1190,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
     /** {@inheritDoc} */
     @Override public boolean isUsePairedConnections() {
-        return usePairedConnections == null ? false : usePairedConnections;
+        return usePairedConnections;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/6951b20f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
index e7eb540..0513786 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
@@ -44,7 +44,7 @@ public class IgniteCacheRestartTestSuite2 extends TestSuite {
         suite.addTestSuite(IgniteCachePutAllRestartTest.class);
         suite.addTestSuite(GridCachePutAllFailoverSelfTest.class);
 
-        // suite.addTestSuite(IgniteBinaryMetadataUpdateNodeRestartTest.class);
+        suite.addTestSuite(IgniteBinaryMetadataUpdateNodeRestartTest.class);
 
         suite.addTestSuite(IgniteCacheGetRestartTest.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6951b20f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 24a362c..092d95e 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -45,10 +45,6 @@ import org.apache.ignite.internal.managers.communication.IgniteCommunicationBala
 import org.apache.ignite.internal.managers.communication.IgniteIoTestMessagesTest;
 import org.apache.ignite.internal.managers.communication.IgniteVariousConnectionNumberTest;
 import org.apache.ignite.cache.store.jdbc.JdbcTypesDefaultTransformerTest;
-import org.apache.ignite.internal.managers.communication.IgniteCommunicationBalanceMultipleConnectionsTest;
-import org.apache.ignite.internal.managers.communication.IgniteCommunicationBalanceTest;
-import org.apache.ignite.internal.managers.communication.IgniteIoTestMessagesTest;
-import org.apache.ignite.internal.managers.communication.IgniteVariousConnectionNumberTest;
 import org.apache.ignite.internal.processors.cache.CacheAffinityCallSelfTest;
 import org.apache.ignite.internal.processors.cache.CacheDeferredDeleteSanitySelfTest;
 import org.apache.ignite.internal.processors.cache.CacheEntryProcessorCopySelfTest;


[03/10] ignite git commit: IGNITE-4556 .NET: DML example

Posted by yz...@apache.org.
IGNITE-4556 .NET: DML example

This closes #1439


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

Branch: refs/heads/ignite-comm-balance-master
Commit: 19a7e969434c7de8da4e7a4f64d73d4af364ca38
Parents: 664dc88
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Jan 20 11:51:46 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Jan 20 11:51:46 2017 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Examples.csproj               |   1 +
 .../Datagrid/QueryDmlExample.cs                 | 159 +++++++++++++++++++
 2 files changed, 160 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/19a7e969/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
index 3f7e1dc..ebf9e92 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
@@ -62,6 +62,7 @@
     <Compile Include="Datagrid\PutGetExample.cs" />
     <Compile Include="Datagrid\LinqExample.cs" />
     <Compile Include="Datagrid\BinaryModeExample.cs" />
+    <Compile Include="Datagrid\QueryDmlExample.cs" />
     <Compile Include="Datagrid\QueryExample.cs" />
     <Compile Include="Datagrid\StoreExample.cs" />
     <Compile Include="Datagrid\TransactionDeadlockDetectionExample.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/19a7e969/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs
new file mode 100644
index 0000000..b264a0e
--- /dev/null
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Examples.Datagrid
+{
+    using System;
+    using Apache.Ignite.Core;
+    using Apache.Ignite.Core.Cache;
+    using Apache.Ignite.Core.Cache.Configuration;
+    using Apache.Ignite.Core.Cache.Query;
+    using Apache.Ignite.ExamplesDll.Binary;
+
+    /// <summary>
+    /// This example showcases DML capabilities of Ignite's SQL engine.
+    /// <para />
+    /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
+    ///    Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
+    /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
+    ///     Application -> Startup object);
+    /// 3) Start example (F5 or Ctrl+F5).
+    /// <para />
+    /// This example can be run with standalone Apache Ignite.NET node:
+    /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe:
+    /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
+    /// 2) Start example.
+    /// </summary>
+    public class QueryDmlExample
+    {
+        /// <summary>Organization cache name.</summary>
+        private const string OrganizationCacheName = "dotnet_cache_query_dml_organization";
+
+        /// <summary>Employee cache name.</summary>
+        private const string EmployeeCacheName = "dotnet_cache_query_dml_employee";
+
+        [STAThread]
+        public static void Main()
+        {
+            using (var ignite = Ignition.StartFromApplicationConfiguration())
+            {
+                Console.WriteLine();
+                Console.WriteLine(">>> Cache query DML example started.");
+
+                var employeeCache = ignite.GetOrCreateCache<int, Employee>(
+                    new CacheConfiguration(EmployeeCacheName, new QueryEntity(typeof(int), typeof(Employee))));
+
+                var organizationCache = ignite.GetOrCreateCache<int, Organization>(new CacheConfiguration(
+                    OrganizationCacheName, new QueryEntity(typeof(int), typeof(Organization))));
+
+                Insert(organizationCache, employeeCache);
+                Select(employeeCache, "Inserted data");
+
+                Update(employeeCache);
+                Select(employeeCache, "Update salary for ASF employees");
+
+                Delete(employeeCache);
+                Select(employeeCache, "Delete non-ASF employees");
+
+                Console.WriteLine();
+            }
+
+            Console.WriteLine();
+            Console.WriteLine(">>> Example finished, press any key to exit ...");
+            Console.ReadKey();
+        }
+
+        /// <summary>
+        /// Selects and displays Employee data.
+        /// </summary>
+        /// <param name="employeeCache">Employee cache.</param>
+        /// <param name="message">Message.</param>
+        private static void Select(ICache<int, Employee> employeeCache, string message)
+        {
+            Console.WriteLine("\n>>> {0}", message);
+
+            var qry = new SqlFieldsQuery(string.Format(
+                "select emp._key, emp.name, org.name, emp.salary " +
+                "from Employee as emp, " +
+                "\"{0}\".Organization as org " +
+                "where emp.organizationId = org._key", OrganizationCacheName));
+
+            using (var cursor = employeeCache.QueryFields(qry))
+            {
+                foreach (var row in cursor)
+                {
+                    Console.WriteLine(">>> {0}: {1}, {2}, {3}", row[0], row[1], row[2], row[3]);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Populate cache with test data.
+        /// </summary>
+        /// <param name="organizationCache">Organization cache.</param>
+        /// <param name="employeeCache">Employee cache.</param>
+        private static void Insert(ICache<int, Organization> organizationCache, ICache<int, Employee> employeeCache)
+        {
+            // Insert organizations.
+            var qry = new SqlFieldsQuery("insert into Organization (_key, name) values (?, ?)", 1, "ASF");
+            organizationCache.QueryFields(qry);
+
+            qry.Arguments = new object[] {2, "Eclipse"};
+            organizationCache.QueryFields(qry);
+
+            // Insert employees.
+            qry = new SqlFieldsQuery("insert into Employee (_key, name, organizationId, salary) values (?, ?, ?, ?)");
+
+            qry.Arguments = new object[] {1, "John Doe", 1, 4000};
+            employeeCache.QueryFields(qry);
+
+            qry.Arguments = new object[] {2, "Jane Roe", 1, 5000};
+            employeeCache.QueryFields(qry);
+
+            qry.Arguments = new object[] {3, "Mary Major", 2, 2000};
+            employeeCache.QueryFields(qry);
+
+            qry.Arguments = new object[] {4, "Richard Miles", 2, 3000};
+            employeeCache.QueryFields(qry);
+        }
+
+        /// <summary>
+        /// Conditional UPDATE query: raise salary for ASF employees.
+        /// </summary>
+        /// <param name="employeeCache">Employee cache.</param>
+        private static void Update(ICache<int, Employee> employeeCache)
+        {
+            var qry = new SqlFieldsQuery("update Employee set salary = salary * 1.1 where organizationId = ?", 1);
+
+            employeeCache.QueryFields(qry);
+        }
+
+        /// <summary>
+        /// Conditional DELETE query: remove non-ASF employees.
+        /// </summary>
+        /// <param name="employeeCache">Employee cache.</param>
+        private static void Delete(ICache<int, Employee> employeeCache)
+        {
+            var qry = new SqlFieldsQuery(string.Format(
+                "delete from Employee where _key in (" +
+                "select emp._key from Employee emp, \"{0}\".Organization org " +
+                "where org.Name != ? and org._key = emp.organizationId)", OrganizationCacheName), "ASF");
+
+            employeeCache.QueryFields(qry);
+        }
+    }
+}


[05/10] ignite git commit: IGNITE-4563 .NET: Fix ICache.LoadCache failures on non-primitive arguments

Posted by yz...@apache.org.
IGNITE-4563 .NET: Fix ICache.LoadCache failures on non-primitive arguments


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

Branch: refs/heads/ignite-comm-balance-master
Commit: 83b5bca6bf402d2368d55ae5c7d6314ad7a225b4
Parents: f1fca3a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Jan 20 12:56:26 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Jan 20 12:56:26 2017 +0300

----------------------------------------------------------------------
 .../platform/cache/PlatformCache.java           |  11 +-
 .../Apache.Ignite.Core.Tests.csproj             |   1 +
 .../Cache/Store/CacheParallelLoadStoreTest.cs   |   9 +-
 .../Cache/Store/CacheStoreSessionTest.cs        |  22 +-
 .../Cache/Store/CacheStoreTest.cs               | 333 ++++++++++++-------
 .../Cache/Store/CacheTestStore.cs               |  14 +
 .../Cache/Store/NamedNodeCacheStoreTest.cs      |  34 ++
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |  14 +-
 8 files changed, 294 insertions(+), 144 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/83b5bca6/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index aee317e..cc09f5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -816,7 +816,16 @@ public class PlatformCache extends PlatformAbstractTarget {
         if (pred != null)
             filter = platformCtx.createCacheEntryFilter(pred, 0);
 
-        Object[] args = reader.readObjectArray();
+        Object[] args = null;
+
+        int argCnt = reader.readInt();
+
+        if (argCnt > 0) {
+            args = new Object[argCnt];
+
+            for (int i = 0; i < argCnt; i++)
+                args[i] = reader.readObjectDetached();
+        }
 
         if (loc)
             cache.localLoadCache(filter, args);

http://git-wip-us.apache.org/repos/asf/ignite/blob/83b5bca6/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index e09c682..08352b3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -81,6 +81,7 @@
     <Compile Include="Cache\Query\CacheDmlQueriesTest.cs" />
     <Compile Include="Cache\CacheAbstractTransactionalTest.cs" />
     <Compile Include="Cache\Store\CacheStoreAdapterTest.cs" />
+    <Compile Include="Cache\Store\NamedNodeCacheStoreTest.cs" />
     <Compile Include="Collections\MultiValueDictionaryTest.cs" />
     <Compile Include="Collections\ReadOnlyCollectionTest.cs" />
     <Compile Include="Collections\ReadOnlyDictionaryTest.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/83b5bca6/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
index 105dea2..2e74b3f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
@@ -25,7 +25,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
     /// <summary>
     /// Tests for GridCacheParallelLoadStoreAdapter.
     /// </summary>
-    public class CacheParallelLoadStoreTest
+    public sealed class CacheParallelLoadStoreTest
     {
         // object store name
         private const string ObjectStoreCacheName = "object_store_parallel";
@@ -34,11 +34,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /// Set up test class.
         /// </summary>
         [TestFixtureSetUp]
-        public virtual void BeforeTests()
+        public void BeforeTests()
         {
-            TestUtils.KillProcesses();
-            TestUtils.JvmDebug = true;
-
             Ignition.Start(new IgniteConfiguration
             {
                 JvmClasspath = TestUtils.CreateTestClasspath(),
@@ -55,7 +52,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /// Tear down test class.
         /// </summary>
         [TestFixtureTearDown]
-        public virtual void AfterTests()
+        public void AfterTests()
         {
             Ignition.StopAll(true);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/83b5bca6/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
index 5cc0849..54e0414 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
@@ -22,14 +22,13 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
     using System.Collections.Generic;
     using System.Linq;
     using Apache.Ignite.Core.Cache.Store;
-    using Apache.Ignite.Core.Impl;
     using Apache.Ignite.Core.Resource;
     using NUnit.Framework;
 
     /// <summary>
     /// Tests for store session.
     /// </summary>
-    public class CacheStoreSessionTest
+    public sealed class CacheStoreSessionTest
     {
         /** Grid name. */
         private const string IgniteName = "grid";
@@ -47,7 +46,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /// Set up routine.
         /// </summary>
         [TestFixtureSetUp]
-        public virtual void BeforeTests()
+        public void BeforeTests()
         {
             //TestUtils.JVM_DEBUG = true;
 
@@ -71,7 +70,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /// Tear down routine.
         /// </summary>
         [TestFixtureTearDown]
-        public virtual void AfterTests()
+        public void AfterTests()
         {
             Ignition.StopAll(true);
         }
@@ -147,7 +146,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /// Dump operations.
         /// </summary>
         /// <param name="dump">Dump.</param>
-        internal static void DumpOperations(ICollection<Operation> dump)
+        private static void DumpOperations(ICollection<Operation> dump)
         {
             _dumps.Add(dump);
         }
@@ -155,6 +154,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /// <summary>
         /// Test store implementation.
         /// </summary>
+        // ReSharper disable once UnusedMember.Global
         public class Store : CacheStoreAdapter
         {
             /** Store session. */
@@ -215,7 +215,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /// <summary>
         /// Logged operation.
         /// </summary>
-        internal class Operation
+        private class Operation
         {
             /// <summary>
             /// Constructor.
@@ -244,22 +244,22 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             /// <summary>
             /// Cache name.
             /// </summary>
-            public string CacheName { get; set; }
+            public string CacheName { get; private set; }
             
             /// <summary>
             /// Operation type.
             /// </summary>
-            public OperationType Type { get; set; }
+            public OperationType Type { get; private set; }
 
             /// <summary>
             /// Key.
             /// </summary>
-            public int Key { get; set; }
+            public int Key { get; private set; }
 
             /// <summary>
             /// Value.
             /// </summary>
-            public int Value { get; set; }
+            public int Value { get; private set; }
 
             /// <summary>
             /// Commit flag.
@@ -270,7 +270,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /// <summary>
         /// Operation types.
         /// </summary>
-        internal enum OperationType
+        private enum OperationType
         {
             /** Write. */
             Write,

http://git-wip-us.apache.org/repos/asf/ignite/blob/83b5bca6/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index d39ccde..869336c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -28,92 +28,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
     using NUnit.Framework;
 
     /// <summary>
-    ///
-    /// </summary>
-    class Key
-    {
-        private readonly int _idx;
-
-        public Key(int idx)
-        {
-            _idx = idx;
-        }
-
-        public int Index()
-        {
-            return _idx;
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (obj == null || obj.GetType() != GetType())
-                return false;
-
-            Key key = (Key)obj;
-
-            return key._idx == _idx;
-        }
-
-        public override int GetHashCode()
-        {
-            return _idx;
-        }
-    }
-
-    /// <summary>
-    ///
-    /// </summary>
-    class Value
-    {
-        private int _idx;
-
-        public Value(int idx)
-        {
-            _idx = idx;
-        }
-
-        public int Index()
-        {
-            return _idx;
-        }
-    }
-
-    /// <summary>
-    /// Cache entry predicate.
-    /// </summary>
-    [Serializable]
-    public class CacheEntryFilter : ICacheEntryFilter<int, string>
-    {
-        /** <inheritdoc /> */
-        public bool Invoke(ICacheEntry<int, string> entry)
-        {
-            return entry.Key >= 105;
-        }
-    }
-
-    /// <summary>
-    /// Cache entry predicate that throws an exception.
-    /// </summary>
-    [Serializable]
-    public class ExceptionalEntryFilter : ICacheEntryFilter<int, string>
-    {
-        /** <inheritdoc /> */
-        public bool Invoke(ICacheEntry<int, string> entry)
-        {
-            throw new Exception("Expected exception in ExceptionalEntryFilter");
-        }
-    }
-
-    /// <summary>
-    /// Filter that can't be serialized.
-    /// </summary>
-    public class InvalidCacheEntryFilter : CacheEntryFilter
-    {
-        // No-op.
-    }
-
-    /// <summary>
-    ///
+    /// Tests cache store functionality.
     /// </summary>
     public class CacheStoreTest
     {
@@ -129,19 +44,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         /** */
         private const string TemplateStoreCacheName = "template_store*";
 
-        /** */
-        private volatile int _storeCount = 3;
-
         /// <summary>
-        ///
+        /// Fixture set up.
         /// </summary>
         [TestFixtureSetUp]
         public virtual void BeforeTests()
         {
-            TestUtils.KillProcesses();
-
-            TestUtils.JvmDebug = true;
-
             var cfg = new IgniteConfiguration
             {
                 GridName = GridName,
@@ -155,7 +63,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         }
 
         /// <summary>
-        ///
+        /// Fixture tear down.
         /// </summary>
         [TestFixtureTearDown]
         public void AfterTests()
@@ -164,16 +72,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         }
 
         /// <summary>
-        ///
-        /// </summary>
-        [SetUp]
-        public void BeforeTest()
-        {
-            Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
-        }
-
-        /// <summary>
-        ///
+        /// Test tear down.
         /// </summary>
         [TearDown]
         public void AfterTest()
@@ -188,11 +87,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
                 "Cache is not empty: " +
                 string.Join(", ", cache.Select(x => string.Format("[{0}:{1}]", x.Key, x.Value))));
 
-            TestUtils.AssertHandleRegistryHasItems(300, _storeCount, Ignition.GetIgnite(GridName));
-
-            Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
+            TestUtils.AssertHandleRegistryHasItems(300, 3, Ignition.GetIgnite(GridName));
         }
 
+        /// <summary>
+        /// Tests that simple cache loading works and exceptions are propagated properly.
+        /// </summary>
         [Test]
         public void TestLoadCache()
         {
@@ -219,6 +119,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
                 cache.LoadCache(new CacheEntryFilter(), 100, 10)).InnerException);
         }
 
+        /// <summary>
+        /// Tests cache loading in local mode.
+        /// </summary>
         [Test]
         public void TestLocalLoadCache()
         {
@@ -234,6 +137,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
                 Assert.AreEqual("val_" + i, cache.Get(i));
         }
 
+        /// <summary>
+        /// Tests that object metadata propagates properly during cache loading.
+        /// </summary>
         [Test]
         public void TestLoadCacheMetadata()
         {
@@ -254,6 +160,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             Assert.AreEqual("Value", meta.TypeName);
         }
 
+        /// <summary>
+        /// Tests asynchronous cache load.
+        /// </summary>
         [Test]
         public void TestLoadCacheAsync()
         {
@@ -278,6 +187,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
                     .InnerException);
         }
 
+        /// <summary>
+        /// Tests write-through and read-through behavior.
+        /// </summary>
         [Test]
         public void TestPutLoad()
         {
@@ -285,7 +197,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
 
             cache.Put(1, "val");
 
-            IDictionary map = StoreMap();
+            IDictionary map = GetStoreMap();
 
             Assert.AreEqual(1, map.Count);
 
@@ -305,6 +217,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Get(1)).InnerException);
         }
 
+        /// <summary>
+        /// Tests write-through and read-through behavior with binarizable values.
+        /// </summary>
         [Test]
         public void TestPutLoadBinarizable()
         {
@@ -312,7 +227,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
 
             cache.Put(1, new Value(1));
 
-            IDictionary map = StoreMap();
+            IDictionary map = GetStoreMap();
 
             Assert.AreEqual(1, map.Count);
 
@@ -324,11 +239,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
 
             Assert.AreEqual(0, cache.GetSize());
 
-            Assert.AreEqual(1, cache.Get(1).Index());
+            Assert.AreEqual(1, cache.Get(1).Index);
 
             Assert.AreEqual(1, cache.GetSize());
         }
 
+        /// <summary>
+        /// Tests write-through and read-through behavior with storeKeepBinary=false.
+        /// </summary>
         [Test]
         public void TestPutLoadObjects()
         {
@@ -336,23 +254,26 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
 
             cache.Put(1, new Value(1));
 
-            IDictionary map = StoreMap();
+            IDictionary map = GetStoreMap();
 
             Assert.AreEqual(1, map.Count);
 
             Value v = (Value)map[1];
 
-            Assert.AreEqual(1, v.Index());
+            Assert.AreEqual(1, v.Index);
 
             cache.LocalEvict(new[] { 1 });
 
             Assert.AreEqual(0, cache.GetSize());
 
-            Assert.AreEqual(1, cache.Get(1).Index());
+            Assert.AreEqual(1, cache.Get(1).Index);
 
             Assert.AreEqual(1, cache.GetSize());
         }
 
+        /// <summary>
+        /// Tests cache store LoadAll functionality.
+        /// </summary>
         [Test]
         public void TestPutLoadAll()
         {
@@ -365,7 +286,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
 
             cache.PutAll(putMap);
 
-            IDictionary map = StoreMap();
+            IDictionary map = GetStoreMap();
 
             Assert.AreEqual(10, map.Count);
 
@@ -391,6 +312,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             Assert.AreEqual(10, cache.GetSize());
         }
 
+        /// <summary>
+        /// Tests cache store removal.
+        /// </summary>
         [Test]
         public void TestRemove()
         {
@@ -399,7 +323,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             for (int i = 0; i < 10; i++)
                 cache.Put(i, "val_" + i);
 
-            IDictionary map = StoreMap();
+            IDictionary map = GetStoreMap();
 
             Assert.AreEqual(10, map.Count);
 
@@ -412,6 +336,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
                 Assert.AreEqual("val_" + i, map[i]);
         }
 
+        /// <summary>
+        /// Tests cache store removal.
+        /// </summary>
         [Test]
         public void TestRemoveAll()
         {
@@ -420,7 +347,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             for (int i = 0; i < 10; i++)
                 cache.Put(i, "val_" + i);
 
-            IDictionary map = StoreMap();
+            IDictionary map = GetStoreMap();
 
             Assert.AreEqual(10, map.Count);
 
@@ -432,6 +359,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
                 Assert.AreEqual("val_" + i, map[i]);
         }
 
+        /// <summary>
+        /// Tests cache store with transactions.
+        /// </summary>
         [Test]
         public void TestTx()
         {
@@ -446,13 +376,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
                 tx.Commit();
             }
 
-            IDictionary map = StoreMap();
+            IDictionary map = GetStoreMap();
 
             Assert.AreEqual(1, map.Count);
 
             Assert.AreEqual("val", map[1]);
         }
 
+        /// <summary>
+        /// Tests multithreaded cache loading.
+        /// </summary>
         [Test]
         public void TestLoadCacheMultithreaded()
         {
@@ -470,6 +403,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
                 Assert.AreEqual("val_" + i, cache.Get(i));
         }
 
+        /// <summary>
+        /// Tests that cache store property values are propagated from Spring XML.
+        /// </summary>
         [Test]
         public void TestCustomStoreProperties()
         {
@@ -480,6 +416,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             Assert.AreEqual("String value", CacheTestStore.stringProperty);
         }
 
+        /// <summary>
+        /// Tests cache store with dynamically started cache.
+        /// </summary>
         [Test]
         public void TestDynamicStoreStart()
         {
@@ -498,6 +437,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             Assert.AreEqual(handleCount, reg.Count);
         }
 
+        /// <summary>
+        /// Tests the load all.
+        /// </summary>
         [Test]
         public void TestLoadAll([Values(true, false)] bool isAsync)
         {
@@ -529,6 +471,49 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
         }
 
         /// <summary>
+        /// Tests the argument passing to LoadCache method.
+        /// </summary>
+        [Test]
+        public void TestArgumentPassing()
+        {
+            var cache = GetBinaryStoreCache<object, object>();
+
+            Action<object> checkValue = o =>
+            {
+                cache.Clear();
+                Assert.AreEqual(0, cache.GetSize());
+                cache.LoadCache(null, null, 1, o);
+                Assert.AreEqual(o, cache[1]);
+            };
+
+            // Null.
+            cache.LoadCache(null, null);
+            Assert.AreEqual(0, cache.GetSize());
+
+            // Empty args array.
+            cache.LoadCache(null);
+            Assert.AreEqual(0, cache.GetSize());
+
+            // Simple types.
+            checkValue(1);
+            checkValue(new[] {1, 2, 3});
+
+            checkValue("1");
+            checkValue(new[] {"1", "2"});
+
+            checkValue(Guid.NewGuid());
+            checkValue(new[] {Guid.NewGuid(), Guid.NewGuid()});
+
+            checkValue(DateTime.Now);
+            checkValue(new[] {DateTime.Now, DateTime.UtcNow});
+
+            // Collections.
+            checkValue(new ArrayList {1, "2", 3.3});
+            checkValue(new List<int> {1, 2});
+            checkValue(new Dictionary<int, string> {{1, "foo"}});
+        }
+
+        /// <summary>
         /// Get's grid name for this test.
         /// </summary>
         /// <value>Grid name.</value>
@@ -537,31 +522,49 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             get { return null; }
         }
 
-        private IDictionary StoreMap()
+        /// <summary>
+        /// Gets the store map.
+        /// </summary>
+        private static IDictionary GetStoreMap()
         {
             return CacheTestStore.Map;
         }
 
+        /// <summary>
+        /// Gets the cache.
+        /// </summary>
         private ICache<int, string> GetCache()
         {
             return GetBinaryStoreCache<int, string>();
         }
 
+        /// <summary>
+        /// Gets the binary store cache.
+        /// </summary>
         private ICache<TK, TV> GetBinaryStoreCache<TK, TV>()
         {
             return Ignition.GetIgnite(GridName).GetCache<TK, TV>(BinaryStoreCacheName);
         }
 
+        /// <summary>
+        /// Gets the object store cache.
+        /// </summary>
         private ICache<TK, TV> GetObjectStoreCache<TK, TV>()
         {
             return Ignition.GetIgnite(GridName).GetCache<TK, TV>(ObjectStoreCacheName);
         }
 
+        /// <summary>
+        /// Gets the custom store cache.
+        /// </summary>
         private ICache<int, string> GetCustomStoreCache()
         {
             return Ignition.GetIgnite(GridName).GetCache<int, string>(CustomStoreCacheName);
         }
 
+        /// <summary>
+        /// Gets the template store cache.
+        /// </summary>
         private ICache<int, string> GetTemplateStoreCache()
         {
             var cacheName = TemplateStoreCacheName.Replace("*", Guid.NewGuid().ToString());
@@ -569,6 +572,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             return Ignition.GetIgnite(GridName).GetOrCreateCache<int, string>(cacheName);
         }
 
+        /// <summary>
+        /// Checks the custom store error.
+        /// </summary>
         private static void CheckCustomStoreError(Exception err)
         {
             var customErr = err as CacheTestStore.CustomStoreException ??
@@ -581,14 +587,93 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
     }
 
     /// <summary>
-    /// 
+    /// Cache key.
     /// </summary>
-    public class NamedNodeCacheStoreTest : CacheStoreTest
+    internal class Key
     {
-        /** <inheritDoc /> */
-        protected override string GridName
+        /** */
+        private readonly int _idx;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="Key"/> class.
+        /// </summary>
+        public Key(int idx)
+        {
+            _idx = idx;
+        }
+
+        /** <inheritdoc /> */
+        public override bool Equals(object obj)
         {
-            get { return "name"; }
+            if (obj == null || obj.GetType() != GetType())
+                return false;
+
+            return ((Key)obj)._idx == _idx;
         }
+
+        /** <inheritdoc /> */
+        public override int GetHashCode()
+        {
+            return _idx;
+        }
+    }
+
+    /// <summary>
+    /// Cache value.
+    /// </summary>
+    internal class Value
+    {
+        /** */
+        private readonly int _idx;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="Value"/> class.
+        /// </summary>
+        public Value(int idx)
+        {
+            _idx = idx;
+        }
+
+        /// <summary>
+        /// Gets the index.
+        /// </summary>
+        public int Index
+        {
+            get { return _idx; }
+        }
+    }
+
+    /// <summary>
+    /// Cache entry predicate.
+    /// </summary>
+    [Serializable]
+    public class CacheEntryFilter : ICacheEntryFilter<int, string>
+    {
+        /** <inheritdoc /> */
+        public bool Invoke(ICacheEntry<int, string> entry)
+        {
+            return entry.Key >= 105;
+        }
+    }
+
+    /// <summary>
+    /// Cache entry predicate that throws an exception.
+    /// </summary>
+    [Serializable]
+    public class ExceptionalEntryFilter : ICacheEntryFilter<int, string>
+    {
+        /** <inheritdoc /> */
+        public bool Invoke(ICacheEntry<int, string> entry)
+        {
+            throw new Exception("Expected exception in ExceptionalEntryFilter");
+        }
+    }
+
+    /// <summary>
+    /// Filter that can't be serialized.
+    /// </summary>
+    public class InvalidCacheEntryFilter : CacheEntryFilter
+    {
+        // No-op.
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/83b5bca6/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
index 4224835..f80f5ce 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
@@ -66,6 +66,20 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
 
             Debug.Assert(_grid != null);
 
+            if (args == null || args.Length == 0)
+                return;
+
+            if (args.Length == 3 && args[0] == null)
+            {
+                // Testing arguments passing.
+                var key = args[1];
+                var val = args[2];
+
+                act(key, val);
+
+                return;
+            }
+
             if (LoadMultithreaded)
             {
                 int cnt = 0;

http://git-wip-us.apache.org/repos/asf/ignite/blob/83b5bca6/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/NamedNodeCacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/NamedNodeCacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/NamedNodeCacheStoreTest.cs
new file mode 100644
index 0000000..02e257f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/NamedNodeCacheStoreTest.cs
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Cache.Store
+{
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Cache store test with named node.
+    /// </summary>
+    [TestFixture]
+    public class NamedNodeCacheStoreTest : CacheStoreTest
+    {
+        /** <inheritDoc /> */
+        protected override string GridName
+        {
+            get { return "name"; }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/83b5bca6/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 186737c..b8dc6cb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -225,7 +225,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <summary>
         /// Writes the load cache data to the writer.
         /// </summary>
-        private void WriteLoadCacheData(IBinaryRawWriter writer, ICacheEntryFilter<TK, TV> p, object[] args)
+        private void WriteLoadCacheData(BinaryWriter writer, ICacheEntryFilter<TK, TV> p, object[] args)
         {
             if (p != null)
             {
@@ -237,7 +237,17 @@ namespace Apache.Ignite.Core.Impl.Cache
             else
                 writer.WriteObject<CacheEntryFilterHolder>(null);
 
-            writer.WriteArray(args);
+            if (args != null && args.Length > 0)
+            {
+                writer.WriteInt(args.Length);
+
+                foreach (var o in args)
+                    writer.WriteObject(o);
+            }
+            else
+            {
+                writer.WriteInt(0);
+            }
         }
 
         /** <inheritDoc /> */


[04/10] ignite git commit: IGNITE-4548 CacheJdbcStore: support mapping of enum types.

Posted by yz...@apache.org.
IGNITE-4548 CacheJdbcStore: support mapping of enum types.


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

Branch: refs/heads/ignite-comm-balance-master
Commit: f1fca3ad5bb0a870d94915caf8186e36b165b924
Parents: 19a7e96
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Fri Jan 20 16:22:24 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri Jan 20 16:22:24 2017 +0700

----------------------------------------------------------------------
 .../store/jdbc/CacheAbstractJdbcStore.java      | 12 +++++-
 .../store/jdbc/JdbcTypesDefaultTransformer.java | 19 +++++++++
 .../cache/store/jdbc/JdbcTypesTransformer.java  | 17 ++++++++
 .../CacheJdbcPojoStoreAbstractSelfTest.java     | 23 +++++++----
 .../store/jdbc/CacheJdbcPojoStoreTest.java      |  3 ++
 ...eJdbcStoreAbstractMultithreadedSelfTest.java | 17 ++++----
 .../ignite/cache/store/jdbc/model/Gender.java   | 41 ++++++++++++++++++++
 .../ignite/cache/store/jdbc/model/Person.java   | 31 ++++++++++++++-
 .../src/test/config/jdbc-pojo-store-builtin.xml |  8 ++++
 .../src/test/config/jdbc-pojo-store-obj.xml     |  8 ++++
 10 files changed, 162 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 4bfd92b..e7ce526 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -80,6 +80,8 @@ import static java.sql.Statement.SUCCESS_NO_INFO;
 import static org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.DFLT_BATCH_SIZE;
 import static org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.DFLT_PARALLEL_LOAD_CACHE_MINIMUM_THRESHOLD;
 import static org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.DFLT_WRITE_ATTEMPTS;
+import static org.apache.ignite.cache.store.jdbc.JdbcTypesTransformer.NUMERIC_TYPES;
+import static org.apache.ignite.cache.store.jdbc.JdbcTypesTransformer.NUMERIC_TYPES;
 
 /**
  * Implementation of {@link CacheStore} backed by JDBC.
@@ -1393,8 +1395,15 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
                             fieldVal = fieldVal.toString();
 
                             break;
+                        default:
+                            // No-op.
                     }
                 }
+                else if (field.getJavaFieldType().isEnum() && fieldVal instanceof Enum) {
+                    Enum val = (Enum)fieldVal;
+                    
+                    fieldVal = NUMERIC_TYPES.contains(field.getDatabaseFieldType()) ? val.ordinal() : val.name();
+                }
 
                 stmt.setObject(idx, fieldVal);
             }
@@ -2068,12 +2077,13 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
 
                 int idx = 1;
 
-                for (Object key : keys)
+                for (Object key : keys) {
                     for (JdbcTypeField field : em.keyColumns()) {
                         Object fieldVal = extractParameter(em.cacheName, em.keyType(), em.keyKind(), field.getJavaFieldName(), key);
 
                         fillParameter(stmt, idx++, field, fieldVal);
                     }
+                }
 
                 ResultSet rs = stmt.executeQuery();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesDefaultTransformer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesDefaultTransformer.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesDefaultTransformer.java
index c32eaa2..c387b77 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesDefaultTransformer.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesDefaultTransformer.java
@@ -114,6 +114,25 @@ public class JdbcTypesDefaultTransformer implements JdbcTypesTransformer {
                 return UUID.fromString((String)res);
         }
 
+        if (type.isEnum()) {
+            if (NUMERIC_TYPES.contains(rs.getMetaData().getColumnType(colIdx))) {
+                int ordinal = rs.getInt(colIdx);
+
+                Object[] values = type.getEnumConstants();
+
+                return rs.wasNull() || ordinal >= values.length ? null : values[ordinal];
+            }
+
+            String str = rs.getString(colIdx);
+
+            try {
+                return rs.wasNull() ? null : Enum.valueOf((Class<? extends Enum>) type, str.trim());
+            }
+            catch (IllegalArgumentException ignore) {
+                return null;
+            }
+        }
+
         return rs.getObject(colIdx);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesTransformer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesTransformer.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesTransformer.java
index 76fb00b..fc0bc88 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesTransformer.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesTransformer.java
@@ -20,11 +20,28 @@ package org.apache.ignite.cache.store.jdbc;
 import java.io.Serializable;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import static java.sql.Types.BIGINT;
+import static java.sql.Types.DECIMAL;
+import static java.sql.Types.DOUBLE;
+import static java.sql.Types.FLOAT;
+import static java.sql.Types.INTEGER;
+import static java.sql.Types.NUMERIC;
+import static java.sql.Types.REAL;
+import static java.sql.Types.SMALLINT;
+import static java.sql.Types.TINYINT;
 
 /**
  * API for implementing custom mapping logic for loaded from store data.
  */
 public interface JdbcTypesTransformer extends Serializable {
+    /** Numeric types. */
+    public final List<Integer> NUMERIC_TYPES =
+        U.sealList(TINYINT, SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, NUMERIC, DECIMAL);
+
+
     /**
      * Retrieves the value of the designated column in the current row of this <code>ResultSet</code> object and
      * will convert to the requested Java data type.

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java
index 368a28e..1de44f7 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java
@@ -30,6 +30,7 @@ import javax.cache.integration.CacheLoaderException;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.store.jdbc.dialect.H2Dialect;
 import org.apache.ignite.cache.store.jdbc.model.Person;
+import org.apache.ignite.cache.store.jdbc.model.Gender;
 import org.apache.ignite.cache.store.jdbc.model.PersonKey;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.ConnectorConfiguration;
@@ -112,7 +113,8 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
             " id INTEGER PRIMARY KEY," +
             " org_id INTEGER," +
             " birthday DATE," +
-            " name VARCHAR(50))");
+            " name VARCHAR(50)," +
+            " gender VARCHAR(50))");
 
         conn.commit();
 
@@ -201,7 +203,8 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
             new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id"),
             new JdbcTypeField(Types.INTEGER, "ORG_ID", Integer.class, "orgId"),
             new JdbcTypeField(Types.DATE, "BIRTHDAY", Date.class, "birthday"),
-            new JdbcTypeField(Types.VARCHAR, "NAME", String.class, "name"));
+            new JdbcTypeField(Types.VARCHAR, "NAME", String.class, "name"),
+            new JdbcTypeField(Types.VARCHAR, "GENDER", Gender.class, "gender"));
 
         return storeTypes;
     }
@@ -260,7 +263,7 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
         conn.commit();
 
         PreparedStatement prnStmt = conn.prepareStatement(
-            "INSERT INTO Person(id, org_id, birthday, name) VALUES (?, ?, ?, ?)");
+            "INSERT INTO Person(id, org_id, birthday, name, gender) VALUES (?, ?, ?, ?, ?)");
 
         Random rnd = new Random();
 
@@ -269,6 +272,7 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
             prnStmt.setInt(2, i % 100);
             prnStmt.setDate(3, Date.valueOf(String.format("%d-%d-%d", 1970 + rnd.nextInt(50), 1 + rnd.nextInt(11), 1 + rnd.nextInt(27))));
             prnStmt.setString(4, "name" + i);
+            prnStmt.setString(5, Gender.random().toString());
 
             prnStmt.addBatch();
         }
@@ -319,7 +323,7 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
     protected void checkCacheLoadWithSql() {
         IgniteCache<Object, Object> c1 = grid().cache(CACHE_NAME);
 
-        c1.loadCache(null, "org.apache.ignite.cache.store.jdbc.model.PersonKey", "select id, org_id, name, birthday from Person");
+        c1.loadCache(null, "org.apache.ignite.cache.store.jdbc.model.PersonKey", "select id, org_id, name, birthday, gender from Person");
 
         assertEquals(PERSON_CNT, c1.size());
     }
@@ -397,7 +401,9 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
 
         Connection conn = getConnection();
         try {
-            PreparedStatement stmt = conn.prepareStatement("SELECT ID, ORG_ID, BIRTHDAY, NAME FROM PERSON WHERE ID = ?");
+            Random rnd = new Random();
+
+            PreparedStatement stmt = conn.prepareStatement("SELECT ID, ORG_ID, BIRTHDAY, NAME, GENDER FROM PERSON WHERE ID = ?");
 
             stmt.setInt(1, -1);
 
@@ -408,8 +414,9 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
             U.closeQuiet(rs);
 
             Date testDate = Date.valueOf("2001-05-05");
+            Gender testGender = Gender.random();
 
-            Person val = new Person(-1, -2, testDate, "Person-to-test-put-insert", 999);
+            Person val = new Person(-1, -2, testDate, "Person-to-test-put-insert", 999, testGender);
 
             Object key = builtinKeys ? Integer.valueOf(-1) : new PersonKey(-1);
 
@@ -424,6 +431,7 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
             assertEquals(-2, rs.getInt(2));
             assertEquals(testDate, rs.getDate(3));
             assertEquals("Person-to-test-put-insert", rs.getString(4));
+            assertEquals(testGender.toString(), rs.getString(5));
 
             assertFalse("Unexpected more data in result set", rs.next());
 
@@ -432,7 +440,7 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
             // Test put-update.
             testDate = Date.valueOf("2016-04-04");
 
-            c1.put(key, new Person(-1, -3, testDate, "Person-to-test-put-update", 999));
+            c1.put(key, new Person(-1, -3, testDate, "Person-to-test-put-update", 999, testGender));
 
             rs = stmt.executeQuery();
 
@@ -442,6 +450,7 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
             assertEquals(-3, rs.getInt(2));
             assertEquals(testDate, rs.getDate(3));
             assertEquals("Person-to-test-put-update", rs.getString(4));
+            assertEquals(testGender.toString(), rs.getString(5));
 
             assertFalse("Unexpected more data in result set", rs.next());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
index 4a0b1da..849cab7 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
@@ -25,6 +25,7 @@ import java.sql.Timestamp;
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Random;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import javax.cache.integration.CacheWriterException;
@@ -233,6 +234,8 @@ public class CacheJdbcPojoStoreTest extends GridAbstractCacheStoreSelfTest<Cache
     public void testLoadCache() throws Exception {
         Connection conn = store.openConnection(false);
 
+        Random rnd = new Random();
+
         PreparedStatement orgStmt = conn.prepareStatement("INSERT INTO Organization(id, name, city) VALUES (?, ?, ?)");
 
         for (int i = 0; i < ORGANIZATION_CNT; i++) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java
index e831445..f1a321b 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java
@@ -33,6 +33,7 @@ import java.util.concurrent.Callable;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheTypeMetadata;
+import org.apache.ignite.cache.store.jdbc.model.Gender;
 import org.apache.ignite.cache.store.jdbc.model.Organization;
 import org.apache.ignite.cache.store.jdbc.model.OrganizationKey;
 import org.apache.ignite.cache.store.jdbc.model.Person;
@@ -208,7 +209,7 @@ public abstract class CacheJdbcStoreAbstractMultithreadedSelfTest<T extends Cach
                         cache.put(new OrganizationKey(id), new Organization(id, "Name" + id, "City" + id));
                     else
                         cache.put(new PersonKey(id), new Person(id, rnd.nextInt(),
-                            new Date(System.currentTimeMillis()), "Name" + id, 1));
+                            new Date(System.currentTimeMillis()), "Name" + id, 1, Gender.random()));
                 }
 
                 return null;
@@ -228,7 +229,7 @@ public abstract class CacheJdbcStoreAbstractMultithreadedSelfTest<T extends Cach
                         cache.putIfAbsent(new OrganizationKey(id), new Organization(id, "Name" + id, "City" + id));
                     else
                         cache.putIfAbsent(new PersonKey(id), new Person(id, rnd.nextInt(),
-                            new Date(System.currentTimeMillis()), "Name" + id, i));
+                            new Date(System.currentTimeMillis()), "Name" + id, i, Gender.random()));
                 }
 
                 return null;
@@ -268,7 +269,7 @@ public abstract class CacheJdbcStoreAbstractMultithreadedSelfTest<T extends Cach
                             map.put(new OrganizationKey(id), new Organization(id, "Name" + id, "City" + id));
                         else
                             map.put(new PersonKey(id), new Person(id, rnd.nextInt(),
-                                new Date(System.currentTimeMillis()), "Name" + id, 1));
+                                new Date(System.currentTimeMillis()), "Name" + id, 1, Gender.random()));
                     }
 
                     IgniteCache<Object, Object> cache = jcache();
@@ -294,11 +295,11 @@ public abstract class CacheJdbcStoreAbstractMultithreadedSelfTest<T extends Cach
 
                     try (Transaction tx = grid().transactions().txStart()) {
                         cache.put(new PersonKey(1), new Person(1, rnd.nextInt(),
-                            new Date(System.currentTimeMillis()), "Name" + 1, 1));
+                            new Date(System.currentTimeMillis()), "Name" + 1, 1, Gender.random()));
                         cache.put(new PersonKey(2), new Person(2, rnd.nextInt(),
-                            new Date(System.currentTimeMillis()), "Name" + 2, 2));
+                            new Date(System.currentTimeMillis()), "Name" + 2, 2, Gender.random()));
                         cache.put(new PersonKey(3), new Person(3, rnd.nextInt(),
-                            new Date(System.currentTimeMillis()), "Name" + 3, 3));
+                            new Date(System.currentTimeMillis()), "Name" + 3, 3, Gender.random()));
 
                         cache.get(new PersonKey(1));
                         cache.get(new PersonKey(4));
@@ -306,9 +307,9 @@ public abstract class CacheJdbcStoreAbstractMultithreadedSelfTest<T extends Cach
                         Map<PersonKey, Person> map =  U.newHashMap(2);
 
                         map.put(new PersonKey(5), new Person(5, rnd.nextInt(),
-                            new Date(System.currentTimeMillis()), "Name" + 5, 5));
+                            new Date(System.currentTimeMillis()), "Name" + 5, 5, Gender.random()));
                         map.put(new PersonKey(6), new Person(6, rnd.nextInt(),
-                            new Date(System.currentTimeMillis()), "Name" + 6, 6));
+                            new Date(System.currentTimeMillis()), "Name" + 6, 6, Gender.random()));
 
                         cache.putAll(map);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Gender.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Gender.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Gender.java
new file mode 100644
index 0000000..8ddb0e2
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Gender.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.store.jdbc.model;
+
+import java.io.Serializable;
+import java.util.Random;
+
+/**
+ * Person gender enum.
+ */
+public enum Gender implements Serializable {
+    /** */
+    MALE,
+    /** */
+    FEMALE;
+
+    /** */
+    private static final Random RAND = new Random();
+
+    /**
+     * Used for testing purposes.
+     */
+    public static Gender random() {
+        return values()[RAND.nextInt(values().length)];
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java
index 52ddfc8..89258b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java
@@ -44,6 +44,9 @@ public class Person implements Serializable {
     /** Value for salary. */
     private Integer salary;
 
+    /** Value of person gender. */
+    private Gender gender;
+
     /**
      * Empty constructor.
      */
@@ -59,13 +62,15 @@ public class Person implements Serializable {
         Integer orgId,
         Date birthday,
         String name,
-        Integer salary
+        Integer salary,
+        Gender gender
     ) {
         this.id = id;
         this.orgId = orgId;
         this.birthday = birthday;
         this.name = name;
         this.salary = salary;
+        this.gender = gender;
     }
 
     /**
@@ -159,6 +164,24 @@ public class Person implements Serializable {
         this.salary = salary;
     }
 
+    /**
+     * Gets gender.
+     *
+     * @return Gender.
+     */
+    public Gender getGender() {
+        return gender;
+    }
+
+    /**
+     * Sets gender.
+     *
+     * @param gender New value for gender.
+     */
+    public void setGender(Gender gender) {
+        this.gender = gender;
+    }
+
     /** {@inheritDoc} */
     @Override public boolean equals(Object o) {
         if (this == o)
@@ -178,6 +201,9 @@ public class Person implements Serializable {
         if (name != null ? !name.equals(that.name) : that.name != null)
             return false;
 
+        if (gender != null ? !gender.equals(that.gender) : that.gender != null)
+            return false;
+
         return true;
     }
 
@@ -189,6 +215,8 @@ public class Person implements Serializable {
 
         res = 31 * res + (name != null ? name.hashCode() : 0);
 
+        res = 31 * res + (gender != null ? gender.hashCode() : 0);
+
         return res;
     }
 
@@ -198,6 +226,7 @@ public class Person implements Serializable {
             ", orgId=" + orgId +
             ", birthday=" + (birthday == null ? null : birthday.getTime()) +
             ", name=" + name +
+            ", gender=" + gender +
             "]";
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml b/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml
index dfaf828..bfb109c 100644
--- a/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml
+++ b/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml
@@ -151,6 +151,14 @@
                                                     <property name="javaFieldName" value="orgId"/>
                                                     <property name="javaFieldType" value="java.lang.Integer"/>
                                                 </bean>
+                                                <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
+                                                    <property name="databaseFieldName" value="GENDER"/>
+                                                    <property name="databaseFieldType">
+                                                        <util:constant static-field="java.sql.Types.VARCHAR"/>
+                                                    </property>
+                                                    <property name="javaFieldName" value="gender"/>
+                                                    <property name="javaFieldType" value="org.apache.ignite.cache.store.jdbc.model.Gender"/>
+                                                </bean>
                                             </list>
                                         </property>
                                     </bean>

http://git-wip-us.apache.org/repos/asf/ignite/blob/f1fca3ad/modules/spring/src/test/config/jdbc-pojo-store-obj.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/jdbc-pojo-store-obj.xml b/modules/spring/src/test/config/jdbc-pojo-store-obj.xml
index 9bc9977..40a14dc 100644
--- a/modules/spring/src/test/config/jdbc-pojo-store-obj.xml
+++ b/modules/spring/src/test/config/jdbc-pojo-store-obj.xml
@@ -151,6 +151,14 @@
                                                     <property name="javaFieldName" value="orgId"/>
                                                     <property name="javaFieldType" value="java.lang.Integer"/>
                                                 </bean>
+                                                <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
+                                                    <property name="databaseFieldName" value="GENDER"/>
+                                                    <property name="databaseFieldType">
+                                                        <util:constant static-field="java.sql.Types.VARCHAR"/>
+                                                    </property>
+                                                    <property name="javaFieldName" value="gender"/>
+                                                    <property name="javaFieldType" value="org.apache.ignite.cache.store.jdbc.model.Gender"/>
+                                                </bean>
                                             </list>
                                         </property>
                                     </bean>


[06/10] ignite git commit: IGNITE-4556 .NET: DML example - clear cache before run

Posted by yz...@apache.org.
IGNITE-4556 .NET: DML example - clear cache before run


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

Branch: refs/heads/ignite-comm-balance-master
Commit: f41eb8d7e36caea319e228a6a0256d08681a2b55
Parents: 83b5bca
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Jan 20 16:09:33 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Jan 20 16:09:33 2017 +0300

----------------------------------------------------------------------
 .../examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs   | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f41eb8d7/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs
index b264a0e..2c47c45 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryDmlExample.cs
@@ -60,6 +60,9 @@ namespace Apache.Ignite.Examples.Datagrid
                 var organizationCache = ignite.GetOrCreateCache<int, Organization>(new CacheConfiguration(
                     OrganizationCacheName, new QueryEntity(typeof(int), typeof(Organization))));
 
+                employeeCache.Clear();
+                organizationCache.Clear();
+
                 Insert(organizationCache, employeeCache);
                 Select(employeeCache, "Inserted data");
 


[09/10] ignite git commit: Merge branches 'ignite-comm-balance-master' and 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-comm-balance-master-apache

Posted by yz...@apache.org.
Merge branches 'ignite-comm-balance-master' and 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-comm-balance-master-apache


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

Branch: refs/heads/ignite-comm-balance-master
Commit: 744b98ca6542a5a3002f25c45ace50b4c32d6c78
Parents: b432478 b7997fc
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Jan 23 12:40:18 2017 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Jan 23 12:40:18 2017 +0300

----------------------------------------------------------------------
 .../tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java |  37 ++-
 .../TcpDiscoveryS3IpFinderAbstractSelfTest.java |  84 +++++
 ...3IpFinderAwsCredentialsProviderSelfTest.java |  46 +++
 ...scoveryS3IpFinderAwsCredentialsSelfTest.java |  45 +++
 .../s3/TcpDiscoveryS3IpFinderSelfTest.java      |  79 -----
 .../ignite/testsuites/IgniteS3TestSuite.java    |  26 +-
 .../store/jdbc/CacheAbstractJdbcStore.java      |  12 +-
 .../store/jdbc/JdbcTypesDefaultTransformer.java |  19 ++
 .../cache/store/jdbc/JdbcTypesTransformer.java  |  17 +
 .../processors/hadoop/HadoopTaskContext.java    |  10 +
 .../internal/processors/odbc/IgniteTypes.java   |  69 ++++
 .../internal/processors/odbc/OdbcTypes.java     | 131 ++++++++
 .../internal/processors/odbc/OdbcUtils.java     |  85 +++++
 .../processors/odbc/escape/OdbcEscapeUtils.java |  52 ++-
 .../platform/cache/PlatformCache.java           |  11 +-
 .../CacheJdbcPojoStoreAbstractSelfTest.java     |  23 +-
 .../store/jdbc/CacheJdbcPojoStoreTest.java      |   3 +
 ...eJdbcStoreAbstractMultithreadedSelfTest.java |  17 +-
 .../ignite/cache/store/jdbc/model/Gender.java   |  41 +++
 .../ignite/cache/store/jdbc/model/Person.java   |  31 +-
 .../odbc/OdbcEscapeSequenceSelfTest.java        | 131 ++++++++
 .../hadoop/impl/v1/HadoopV1MapTask.java         |  89 ++---
 .../hadoop/impl/v1/HadoopV1ReduceTask.java      |  69 ++--
 .../hadoop/impl/v2/HadoopV2Context.java         |  10 -
 .../hadoop/impl/v2/HadoopV2MapTask.java         |  18 +-
 .../hadoop/impl/v2/HadoopV2ReduceTask.java      |  14 +
 .../hadoop/impl/v2/HadoopV2TaskContext.java     |   1 +
 .../hadoop/shuffle/HadoopShuffleJob.java        |   7 -
 .../shuffle/direct/HadoopDirectDataInput.java   |   2 +-
 .../hadoop/taskexecutor/HadoopRunnableTask.java |  12 +-
 .../impl/HadoopAbstractMapReduceTest.java       |   2 +
 .../impl/HadoopMapReduceEmbeddedSelfTest.java   |   6 +-
 .../cpp/binary/src/impl/binary/binary_utils.cpp |   6 +-
 .../cpp/common/include/ignite/common/utils.h    |   8 +
 .../cpp/common/os/linux/src/common/utils.cpp    |  22 +-
 .../cpp/common/os/win/src/common/utils.cpp      |  14 +-
 modules/platforms/cpp/odbc-test/Makefile.am     |   1 +
 .../odbc-test/include/sql_test_suite_fixture.h  |  13 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   1 +
 .../project/vs/odbc-test.vcxproj.filters        |   3 +
 .../cpp/odbc-test/src/api_robustness_test.cpp   |   2 +-
 .../src/sql_aggregate_functions_test.cpp        |   4 +-
 .../src/sql_esc_convert_function_test.cpp       | 160 +++++++++
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  52 ++-
 .../cpp/odbc-test/src/sql_types_test.cpp        | 131 +++++++-
 .../odbc/src/app/application_data_buffer.cpp    |  58 +++-
 .../platforms/cpp/odbc/src/app/parameter.cpp    |   4 +-
 .../cpp/odbc/src/config/connection_info.cpp     | 260 ++++++++++++++-
 .../Apache.Ignite.Core.Tests.csproj             |   1 +
 .../Cache/Store/CacheParallelLoadStoreTest.cs   |   9 +-
 .../Cache/Store/CacheStoreSessionTest.cs        |  22 +-
 .../Cache/Store/CacheStoreTest.cs               | 333 ++++++++++++-------
 .../Cache/Store/CacheTestStore.cs               |  14 +
 .../Cache/Store/NamedNodeCacheStoreTest.cs      |  34 ++
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |  14 +-
 .../Apache.Ignite.Examples.csproj               |   1 +
 .../Datagrid/QueryDmlExample.cs                 | 162 +++++++++
 .../src/test/config/jdbc-pojo-store-builtin.xml |   8 +
 .../src/test/config/jdbc-pojo-store-obj.xml     |   8 +
 59 files changed, 2157 insertions(+), 387 deletions(-)
----------------------------------------------------------------------



[02/10] ignite git commit: IGNITE-3837: ODBC: Support for CONVERT function escape sequence

Posted by yz...@apache.org.
IGNITE-3837: ODBC: Support for CONVERT function escape sequence

This closes #1422


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

Branch: refs/heads/ignite-comm-balance-master
Commit: 664dc88e94a8ac0506c2762b7e964f51c72d7459
Parents: 80bcf27
Author: Sergey Kalashnikov <sk...@gridgain.com>
Authored: Thu Jan 19 13:03:10 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jan 19 13:03:10 2017 +0300

----------------------------------------------------------------------
 .../internal/processors/odbc/IgniteTypes.java   |  69 +++++
 .../internal/processors/odbc/OdbcTypes.java     | 131 ++++++++++
 .../internal/processors/odbc/OdbcUtils.java     |  85 ++++++
 .../processors/odbc/escape/OdbcEscapeUtils.java |  52 +++-
 .../odbc/OdbcEscapeSequenceSelfTest.java        | 131 ++++++++++
 .../cpp/binary/src/impl/binary/binary_utils.cpp |   6 +-
 .../cpp/common/include/ignite/common/utils.h    |   8 +
 .../cpp/common/os/linux/src/common/utils.cpp    |  22 +-
 .../cpp/common/os/win/src/common/utils.cpp      |  14 +-
 modules/platforms/cpp/odbc-test/Makefile.am     |   1 +
 .../odbc-test/include/sql_test_suite_fixture.h  |  13 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   1 +
 .../project/vs/odbc-test.vcxproj.filters        |   3 +
 .../cpp/odbc-test/src/api_robustness_test.cpp   |   2 +-
 .../src/sql_aggregate_functions_test.cpp        |   4 +-
 .../src/sql_esc_convert_function_test.cpp       | 160 ++++++++++++
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  52 +++-
 .../cpp/odbc-test/src/sql_types_test.cpp        | 131 +++++++++-
 .../odbc/src/app/application_data_buffer.cpp    |  58 ++++-
 .../platforms/cpp/odbc/src/app/parameter.cpp    |   4 +-
 .../cpp/odbc/src/config/connection_info.cpp     | 260 +++++++++++++++++--
 21 files changed, 1168 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/IgniteTypes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/IgniteTypes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/IgniteTypes.java
new file mode 100644
index 0000000..1eea4e2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/IgniteTypes.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.odbc;
+
+/**
+ * Data type names usable in SQL queries
+ * after escape sequence transformation
+ */
+public class IgniteTypes {
+    /** Type name for 64-bit integer */
+    static final String BIGINT = "BIGINT";
+
+    /** Type name for byte array */
+    static final String BINARY = "BINARY";
+
+    /** Type name for boolean flag */
+    static final String BIT = "BIT";
+
+    /** Type name for unicode string */
+    static final String CHAR = "CHAR";
+
+    /** Type name for decimal number */
+    static final String DECIMAL = "DECIMAL";
+
+    /** Type name for unicode string */
+    static final String VARCHAR = "VARCHAR";
+
+    /** Type name for floating point number */
+    static final String DOUBLE = "DOUBLE";
+
+    /** Type name for single precision floating point number */
+    static final String REAL = "REAL";
+
+    /** Type name for universally unique identifier */
+    static final String UUID = "UUID";
+
+    /** Type name for 16-bit integer */
+    static final String SMALLINT = "SMALLINT";
+
+    /** Type name for 32-bit integer */
+    static final String INTEGER = "INTEGER";
+
+    /** Type name for 8-bit integer */
+    static final String TINYINT = "TINYINT";
+
+    /** Type name for date */
+    static final String DATE = "DATE";
+
+    /** Type name for time */
+    static final String TIME = "TIME";
+
+    /** Type name for timestamp */
+    static final String TIMESTAMP = "TIMESTAMP";
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTypes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTypes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTypes.java
new file mode 100644
index 0000000..70ac92b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTypes.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.odbc;
+
+/**
+ * Data type names that can occur within ODBC escape sequence
+ */
+public class OdbcTypes {
+    /** Type name for BIGINT */
+    static final String SQL_BIGINT = "SQL_BIGINT";
+
+    /** Type name for BINARY */
+    static final String SQL_BINARY = "SQL_BINARY";
+
+    /** Type name for LONGVARBINARY */
+    static final String SQL_LONGVARBINARY = "SQL_LONGVARBINARY";
+
+    /** Type name for VARBINARY */
+    static final String SQL_VARBINARY = "SQL_VARBINARY";
+
+    /** Type name for BIT */
+    static final String SQL_BIT = "SQL_BIT";
+
+    /** Type name for CHAR */
+    static final String SQL_CHAR = "SQL_CHAR";
+
+    /** Type name for DECIMAL */
+    static final String SQL_DECIMAL = "SQL_DECIMAL";
+
+    /** Type name for NUMERIC */
+    static final String SQL_NUMERIC = "SQL_NUMERIC";
+
+    /** Type name for LONGVARCHAR */
+    static final String SQL_LONGVARCHAR = "SQL_LONGVARCHAR";
+
+    /** Type name for VARCHAR */
+    static final String SQL_VARCHAR = "SQL_VARCHAR";
+
+    /** Type name for WCHAR */
+    static final String SQL_WCHAR = "SQL_WCHAR";
+
+    /** Type name for WLONGVARCHAR */
+    static final String SQL_WLONGVARCHAR = "SQL_WLONGVARCHAR";
+
+    /** Type name for WVARCHAR */
+    static final String SQL_WVARCHAR = "SQL_WVARCHAR";
+
+    /** Type name for DOUBLE */
+    static final String SQL_DOUBLE = "SQL_DOUBLE";
+
+    /** Type name for FLOAT */
+    static final String SQL_FLOAT = "SQL_FLOAT";
+
+    /** Type name for REAL */
+    static final String SQL_REAL = "SQL_REAL";
+
+    /** Type name for GUID */
+    static final String SQL_GUID = "SQL_GUID";
+
+    /** Type name for SMALLINT */
+    static final String SQL_SMALLINT = "SQL_SMALLINT";
+
+    /** Type name for INTEGER */
+    static final String SQL_INTEGER = "SQL_INTEGER";
+
+    /** Type name for DATE */
+    static final String SQL_DATE = "SQL_DATE";
+
+    /** Type name for TIME */
+    static final String SQL_TIME = "SQL_TIME";
+
+    /** Type name for TIMESTAMP */
+    static final String SQL_TIMESTAMP = "SQL_TIMESTAMP";
+
+    /** Type name for TINYINT */
+    static final String SQL_TINYINT = "SQL_TINYINT";
+
+    /** Type name for INTERVAL_SECOND */
+    static final String SQL_INTERVAL_SECOND = "SQL_INTERVAL_SECOND";
+
+    /** Type name for INTERVAL_MINUTE */
+    static final String SQL_INTERVAL_MINUTE = "SQL_INTERVAL_MINUTE";
+
+    /** Type name for INTERVAL_HOUR */
+    static final String SQL_INTERVAL_HOUR = "SQL_INTERVAL_HOUR";
+
+    /** Type name for INTERVAL_DAY */
+    static final String SQL_INTERVAL_DAY = "SQL_INTERVAL_DAY";
+
+    /** Type name for INTERVAL_MONTH */
+    static final String SQL_INTERVAL_MONTH = "SQL_INTERVAL_MONTH";
+
+    /** Type name for INTERVAL_YEAR */
+    static final String SQL_INTERVAL_YEAR = "SQL_INTERVAL_YEAR";
+
+    /** Type name for INTERVAL_YEAR_TO_MONTH */
+    static final String SQL_INTERVAL_YEAR_TO_MONTH = "SQL_INTERVAL_YEAR_TO_MONTH";
+
+    /** Type name for INTERVAL_HOUR_TO_MINUTE */
+    static final String SQL_INTERVAL_HOUR_TO_MINUTE = "SQL_INTERVAL_HOUR_TO_MINUTE";
+
+    /** Type name for INTERVAL_HOUR_TO_SECOND */
+    static final String SQL_INTERVAL_HOUR_TO_SECOND = "SQL_INTERVAL_HOUR_TO_SECOND";
+
+    /** Type name for INTERVAL_MINUTE_TO_SECOND */
+    static final String SQL_INTERVAL_MINUTE_TO_SECOND = "SQL_INTERVAL_MINUTE_TO_SECOND";
+
+    /** Type name for INTERVAL_DAY_TO_HOUR */
+    static final String SQL_INTERVAL_DAY_TO_HOUR = "SQL_INTERVAL_DAY_TO_HOUR";
+
+    /** Type name for INTERVAL_DAY_TO_MINUTE */
+    static final String SQL_INTERVAL_DAY_TO_MINUTE = "SQL_INTERVAL_DAY_TO_MINUTE";
+
+    /** Type name for INTERVAL_DAY_TO_SECOND */
+    static final String SQL_INTERVAL_DAY_TO_SECOND  = "SQL_INTERVAL_DAY_TO_SECOND";
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
index 3903562..d851d13 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.odbc;
 
+import org.apache.ignite.IgniteException;
+
 /**
  * Various ODBC utility methods.
  */
@@ -53,4 +55,87 @@ public class OdbcUtils {
     private OdbcUtils() {
         // No-op.
     }
+
+    /**
+     * Lookup Ignite data type corresponding to specific ODBC data type
+     *
+     * @param odbcDataType ODBC data type identifier
+     * @return Ignite data type name
+     */
+    public static String getIgniteTypeFromOdbcType(String odbcDataType) {
+        assert odbcDataType != null;
+        switch (odbcDataType.toUpperCase()) {
+            case OdbcTypes.SQL_BIGINT:
+                return IgniteTypes.BIGINT;
+
+            case OdbcTypes.SQL_BINARY:
+            case OdbcTypes.SQL_LONGVARBINARY:
+            case OdbcTypes.SQL_VARBINARY:
+                return IgniteTypes.BINARY;
+
+            case OdbcTypes.SQL_BIT:
+                return IgniteTypes.BIT;
+
+            case OdbcTypes.SQL_CHAR:
+                return IgniteTypes.CHAR;
+
+            case OdbcTypes.SQL_DECIMAL:
+            case OdbcTypes.SQL_NUMERIC:
+                return IgniteTypes.DECIMAL;
+
+            case OdbcTypes.SQL_LONGVARCHAR:
+            case OdbcTypes.SQL_VARCHAR:
+            case OdbcTypes.SQL_WCHAR:
+            case OdbcTypes.SQL_WLONGVARCHAR:
+            case OdbcTypes.SQL_WVARCHAR:
+                return IgniteTypes.VARCHAR;
+
+            case OdbcTypes.SQL_DOUBLE:
+            case OdbcTypes.SQL_FLOAT:
+                return IgniteTypes.DOUBLE;
+
+            case OdbcTypes.SQL_REAL:
+                return IgniteTypes.REAL;
+
+            case OdbcTypes.SQL_GUID:
+                return IgniteTypes.UUID;
+
+            case OdbcTypes.SQL_SMALLINT:
+                return IgniteTypes.SMALLINT;
+
+            case OdbcTypes.SQL_INTEGER:
+                return IgniteTypes.INTEGER;
+
+            case OdbcTypes.SQL_DATE:
+                return IgniteTypes.DATE;
+
+            case OdbcTypes.SQL_TIME:
+                return IgniteTypes.TIME;
+
+            case OdbcTypes.SQL_TIMESTAMP:
+                return IgniteTypes.TIMESTAMP;
+
+            case OdbcTypes.SQL_TINYINT:
+                return IgniteTypes.TINYINT;
+
+            //No support for interval types
+            case OdbcTypes.SQL_INTERVAL_SECOND:
+            case OdbcTypes.SQL_INTERVAL_MINUTE:
+            case OdbcTypes.SQL_INTERVAL_HOUR:
+            case OdbcTypes.SQL_INTERVAL_DAY:
+            case OdbcTypes.SQL_INTERVAL_MONTH:
+            case OdbcTypes.SQL_INTERVAL_YEAR:
+            case OdbcTypes.SQL_INTERVAL_YEAR_TO_MONTH:
+            case OdbcTypes.SQL_INTERVAL_HOUR_TO_MINUTE:
+            case OdbcTypes.SQL_INTERVAL_HOUR_TO_SECOND:
+            case OdbcTypes.SQL_INTERVAL_MINUTE_TO_SECOND:
+            case OdbcTypes.SQL_INTERVAL_DAY_TO_HOUR:
+            case OdbcTypes.SQL_INTERVAL_DAY_TO_MINUTE:
+            case OdbcTypes.SQL_INTERVAL_DAY_TO_SECOND:
+                throw new IgniteException("Unsupported ODBC data type '" + odbcDataType + "'");
+
+            default:
+                throw new IgniteException("Invalid ODBC data type '" + odbcDataType + "'");
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
index bbf19c7..01f32d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
@@ -18,8 +18,9 @@
 package org.apache.ignite.internal.processors.odbc.escape;
 
 import org.apache.ignite.IgniteException;
-
+import org.apache.ignite.internal.processors.odbc.OdbcUtils;
 import java.util.LinkedList;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
@@ -40,6 +41,11 @@ public class OdbcEscapeUtils {
     private static final Pattern GUID_PATTERN =
         Pattern.compile("^'\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}'$");
 
+    /** CONVERT function data type parameter pattern: last parameter, after comma */
+    private static final Pattern CONVERT_TYPE_PATTERN =
+        Pattern.compile(",\\s*(SQL_[\\w_]+)\\s*(?:\\(\\s*\\d+\\s*(?:,\\s*\\d+\\s*)?\\))?\\s*\\)\\s*$",
+                        Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
+
     /**
      * Parse escape sequence.
      *
@@ -248,7 +254,7 @@ public class OdbcEscapeUtils {
 
         switch (token.type()) {
             case SCALAR_FUNCTION:
-                return parseExpression(text, startPos0, len0);
+                return parseScalarFunctionExpression(text, startPos0, len0);
 
             case GUID: {
                 String res = parseExpression(text, startPos0, len0, token.type(), GUID_PATTERN);
@@ -326,6 +332,48 @@ public class OdbcEscapeUtils {
     }
 
     /**
+     * Parse scalar function expression.
+     *
+     * @param text Text.
+     * @param startPos Start position.
+     * @param len Length.
+     * @return Parsed expression.
+     */
+    private static String parseScalarFunctionExpression(String text, int startPos, int len) {
+        int pos = startPos;
+        int endPos = startPos + len;
+        final String errPrefix = "Malformed scalar function escape sequence.";
+
+        while ((++pos < endPos) && Character.isWhitespace(text.charAt(pos)));
+        if (pos == endPos)
+            throw new IgniteException(errPrefix + " Expected function name.");
+
+        int funcNamePos = pos;
+        while ((++pos < endPos) && Character.isAlphabetic(text.charAt(pos)));
+        if (pos == endPos)
+            throw new IgniteException(errPrefix + " Expected function parameter list: " +
+                                      substring(text, startPos, len));
+
+        String funcName = text.substring(funcNamePos, pos);
+
+        switch (funcName.toUpperCase()) {
+            case "CONVERT": {
+                Matcher matcher = CONVERT_TYPE_PATTERN.matcher(text.substring(startPos, endPos));
+
+                if (!matcher.find())
+                    throw new IgniteException(errPrefix + " Invalid arguments :" +
+                                              substring(text, startPos, len));
+
+                return (text.substring(startPos, startPos + matcher.start(1)) +
+                        OdbcUtils.getIgniteTypeFromOdbcType(matcher.group(1)) +
+                        text.substring(startPos + matcher.end(1), startPos + len)).trim();
+            }
+            default:
+                return substring(text, startPos, len).trim();
+        }
+    }
+
+    /**
      * Append nested results.
      *
      * @param text Original text.

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
index 5303c6e..ecb6c2d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
@@ -74,6 +74,137 @@ public class OdbcEscapeSequenceSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test escape sequence for explicit data type conversion
+     */
+    public void testConvertFunction() throws Exception {
+        check(
+         "CONVERT ( CURDATE(), CHAR )",
+         "{ fn CONVERT ( { fn CURDATE() }, SQL_CHAR ) }"
+        );
+
+        check(
+         "conVerT ( some_expression('one', 'two') , DECIMAL ( 5 , 2 ) )",
+         "{ fn conVerT ( some_expression('one', 'two') , SQL_DECIMAL ( 5 , 2 ) ) }"
+        );
+
+        check(
+         "convert(field,CHAR)",
+         "{fn convert(field,sql_char)}"
+        );
+
+        check(
+         "convert(field,BIGINT)",
+         "{fn convert(field,sql_bigint)}"
+        );
+
+        check(
+         "convert(field,BINARY)",
+         "{fn convert(field,sql_binary)}" // also sql_varbinary,sql_longvarbinary
+        );
+
+        check(
+         "convert(field,BIT)",
+         "{fn convert(field,sql_bit)}"
+        );
+
+        check(
+         "convert(field,CHAR(100))",
+         "{fn convert(field,sql_char(100))}"
+        );
+
+        check(
+         "convert(field,DECIMAL(5,2))",
+         "{fn convert(field,sql_decimal(5,2))}" // also sql_numeric
+        );
+
+        check(
+         "convert(field,VARCHAR(100))",
+         "{fn convert(field,sql_varchar(100))}" // also sql_longvarchar,sql_wchar,sql_wlongvarchar,sql_wvarchar
+        );
+
+        check(
+         "convert(field,DOUBLE)",
+         "{fn convert(field,sql_double)}" // also sql_float
+        );
+
+        check(
+         "convert(field,REAL)",
+         "{fn convert(field,sql_real)}"
+        );
+
+        check(
+         "convert(field,UUID)",
+         "{fn convert(field,sql_guid)}"
+        );
+
+        check(
+         "convert(field,SMALLINT)",
+         "{fn convert(field,sql_smallint)}"
+        );
+
+        check(
+         "convert(field,INTEGER)",
+         "{fn convert(field,sql_integer)}"
+        );
+
+        check(
+         "convert(field,DATE)",
+         "{fn convert(field,sql_date)}"
+        );
+
+        check(
+         "convert(field,TIME)",
+         "{fn convert(field,sql_time)}"
+        );
+
+        check(
+         "convert(field,TIMESTAMP)",
+         "{fn convert(field,sql_timestamp)}"
+        );
+
+        check(
+         "convert(field,TINYINT)",
+         "{fn convert(field,sql_tinyint)}"
+        );
+
+        //invalid odbc type
+        checkFail("{fn convert(field,char)}");
+
+        //no support for interval types
+        checkFail("{fn convert(field,sql_interval_second)}");
+        checkFail("{fn convert(field,sql_interval_minute)}");
+        checkFail("{fn convert(field,sql_interval_hour)}");
+        checkFail("{fn convert(field,sql_interval_day)}");
+        checkFail("{fn convert(field,sql_interval_month)}");
+        checkFail("{fn convert(field,sql_interval_year)}");
+        checkFail("{fn convert(field,sql_interval_year_to_month)}");
+        checkFail("{fn convert(field,sql_interval_hour_to_minute)}");
+        checkFail("{fn convert(field,sql_interval_hour_to_second)}");
+        checkFail("{fn convert(field,sql_interval_minute_to_second)}");
+        checkFail("{fn convert(field,sql_interval_day_to_hour)}");
+        checkFail("{fn convert(field,sql_interval_day_to_minute)}");
+        checkFail("{fn convert(field,sql_interval_day_to_second)}");
+
+        //failure: expected function name
+        checkFail("{fn    }");
+
+        //failure: expected function parameter list
+        checkFail("{fn convert}");
+
+        //failure: expected data type parameter for convert function
+        checkFail("{fn convert ( justoneparam ) }");
+
+        //failure: empty precision/scale
+        checkFail("{fn convert ( justoneparam, sql_decimal( ) }");
+
+        //failure: empty precision/scale
+        checkFail("{fn convert ( justoneparam, sql_decimal(not_a_number) }");
+
+        //failure: missing scale after comma
+        checkFail("{fn convert ( justoneparam, sql_decimal(10,) }");
+    }
+
+    /**
      * Test simple nested escape sequences. Depth = 2.
      */
     public void testNestedFunction() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
index 1a1946c..22738ef 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
@@ -220,13 +220,13 @@ namespace ignite
                 int64_t milliseconds = stream->ReadInt64();
                 int32_t nanoseconds = stream->ReadInt32();
 
-                return Timestamp(milliseconds / 1000, nanoseconds);
+                return Timestamp(milliseconds / 1000, (milliseconds % 1000) * 1000000 + nanoseconds);
             }
 
             void BinaryUtils::WriteTimestamp(interop::InteropOutputStream* stream, const Timestamp val)
             {
-                stream->WriteInt64(val.GetSeconds() * 1000);
-                stream->WriteInt32(val.GetSecondFraction());
+                stream->WriteInt64(val.GetSeconds() * 1000 + val.GetSecondFraction() / 1000000);
+                stream->WriteInt32(val.GetSecondFraction() % 1000000);
             }
 
             void BinaryUtils::WriteString(interop::InteropOutputStream* stream, const char* val, const int32_t len)

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/common/include/ignite/common/utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/utils.h b/modules/platforms/cpp/common/include/ignite/common/utils.h
index f4d2a9f..6ac3c17 100644
--- a/modules/platforms/cpp/common/include/ignite/common/utils.h
+++ b/modules/platforms/cpp/common/include/ignite/common/utils.h
@@ -204,6 +204,14 @@ namespace ignite
 
             return i == end;
         }
+
+        /**
+        * Converts 32-bit integer to big endian format
+        *
+        * @param value Input value
+        * @return Resulting value
+        */
+        IGNITE_IMPORT_EXPORT uint32_t ToBigEndian(uint32_t value);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/linux/src/common/utils.cpp b/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
index e37a91c..0fa9231 100644
--- a/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
+++ b/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 #include <time.h>
 
 #include <sys/stat.h>
@@ -109,17 +109,17 @@ namespace ignite
         std::string GetEnv(const std::string& name, bool& found)
         {
             char* val = std::getenv(name.c_str());
-            
+
             if (val)
             {
                 found = true;
-                
+
                 return std::string(val);
             }
             else
             {
                 found = false;
-                
+
                 return std::string();
             }
         }
@@ -127,10 +127,22 @@ namespace ignite
         bool FileExists(const std::string& path)
         {
             struct stat s;
-            
+
             int res = stat(path.c_str(), &s);
 
             return res != -1;
         }
+
+        uint32_t ToBigEndian(uint32_t value)
+        {
+            // The answer is 42
+            static const int num = 42;
+            static const bool isLittleEndian = (*reinterpret_cast<const char*>(&num) == num);
+
+            if (isLittleEndian)
+                return ((value & 0xFF) << 24) | (((value >> 8) & 0xFF) << 16) | (((value >> 16) & 0xFF) << 8) | ((value >> 24) & 0xFF);
+
+            return value;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/common/os/win/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/win/src/common/utils.cpp b/modules/platforms/cpp/common/os/win/src/common/utils.cpp
index 77c90b8..c6afce2 100644
--- a/modules/platforms/cpp/common/os/win/src/common/utils.cpp
+++ b/modules/platforms/cpp/common/os/win/src/common/utils.cpp
@@ -115,7 +115,7 @@ namespace ignite
 
                 return std::string(res0);
             }
-            else 
+            else
             {
                 found = false;
 
@@ -138,5 +138,17 @@ namespace ignite
                 return true;
             }
         }
+
+        uint32_t ToBigEndian(uint32_t value)
+        {
+            // The answer is 42
+            static const int num = 42;
+            static const bool isLittleEndian = (*reinterpret_cast<const char*>(&num) == num);
+
+            if (isLittleEndian)
+                return ((value & 0xFF) << 24) | (((value >> 8) & 0xFF) << 16) | (((value >> 16) & 0xFF) << 8) | ((value >> 24) & 0xFF);
+
+            return value;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am
index c2f3fa2..56ae56a 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -69,6 +69,7 @@ ignite_odbc_tests_SOURCES = \
     src/sql_numeric_functions_test.cpp \
     src/sql_aggregate_functions_test.cpp \
     src/sql_system_functions_test.cpp \
+    src/sql_esc_convert_function_test.cpp \
     src/sql_operators_test.cpp \
     src/sql_value_expressions_test.cpp \
     src/sql_types_test.cpp \

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h b/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
index 55353e5..0fa6ec9 100644
--- a/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
+++ b/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
@@ -35,6 +35,7 @@
 
 #include "ignite/ignite.h"
 #include "ignite/ignition.h"
+#include "ignite/common/decimal.h"
 
 #include "test_type.h"
 
@@ -195,6 +196,18 @@ namespace ignite
 
     template<>
     void SqlTestSuiteFixture::CheckSingleResult<std::vector<int8_t> >(const char* request, const std::vector<int8_t>& expected);
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<ignite::common::Decimal>(const char* request, const ignite::common::Decimal& expected);
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<Date>(const char* request, const Date& expected);
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<SQL_TIME_STRUCT>(const char* request, const SQL_TIME_STRUCT& expected);
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<Timestamp>(const char* request, const Timestamp& expected);
 }
 
 #endif //_IGNITE_ODBC_TEST_SQL_TEST_SUIT_FIXTURE

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
index 6f85896..8740d5a 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
@@ -178,6 +178,7 @@
     <ClCompile Include="..\..\src\sql_operators_test.cpp" />
     <ClCompile Include="..\..\src\sql_string_functions_test.cpp" />
     <ClCompile Include="..\..\src\sql_system_functions_test.cpp" />
+    <ClCompile Include="..\..\src\sql_esc_convert_function_test.cpp" />
     <ClCompile Include="..\..\src\sql_types_test.cpp" />
     <ClCompile Include="..\..\src\sql_value_expressions_test.cpp" />
     <ClCompile Include="..\..\src\teamcity\teamcity_boost.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
index bedceaa..a53cc47 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
@@ -94,6 +94,9 @@
     <ClCompile Include="..\..\src\sql_system_functions_test.cpp">
       <Filter>Code</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\sql_esc_convert_function_test.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\src\sql_operators_test.cpp">
       <Filter>Code</Filter>
     </ClCompile>

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
index 0b6df93..5247129 100644
--- a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
@@ -354,7 +354,7 @@ BOOST_AUTO_TEST_CASE(TestSQLConnect)
     // Everyting is ok.
     SQLRETURN ret = SQLGetInfo(dbc, SQL_DRIVER_NAME, buffer, ODBC_BUFFER_SIZE, &resLen);
 
-    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc);
 
     // Resulting length is null.
     SQLGetInfo(dbc, SQL_DRIVER_NAME, buffer, ODBC_BUFFER_SIZE, 0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
index 3fa4d97..de1f5f8 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
@@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(TestAggregateFunctionAvgFloat)
     {
         testCache.Put(i, in[i]);
 
-        avg += in[i].i32Field;
+        avg += in[i].floatField;
     }
 
     avg /= in.size();
@@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(TestAggregateFunctionAvgFloatDistinct)
     {
         testCache.Put(i, in[i]);
 
-        avg += in[i].i32Field;
+        avg += in[i].floatField;
     }
 
     avg /= in.size();

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp
new file mode 100644
index 0000000..d9a14a9
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _MSC_VER
+#   define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+#include "ignite/common/decimal.h"
+#include "ignite/common/utils.h"
+#include "sql_test_suite_fixture.h"
+#include "test_utils.h"
+
+using namespace ignite;
+using namespace ignite::common;
+using namespace boost::unit_test;
+
+BOOST_FIXTURE_TEST_SUITE(SqlEscConvertFunctionTestSuite, ignite::SqlTestSuiteFixture)
+
+int CheckConnectionInfo(HDBC dbc, int infoType)
+{
+    SQLUINTEGER mask = 0;
+    SQLRETURN ret = SQLGetInfo(dbc, infoType, &mask, sizeof(mask), 0);
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc);
+    return mask;
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionGetInfo)
+{
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_FUNCTIONS) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_BIGINT) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_BINARY) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_BIT) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_CHAR) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_DATE) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_DECIMAL) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_DOUBLE) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_FLOAT) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_INTEGER) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_LONGVARCHAR) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_NUMERIC) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_REAL) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_SMALLINT) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_TIME) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_TIMESTAMP) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_TINYINT) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_VARBINARY) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_VARCHAR) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_LONGVARBINARY) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_WCHAR) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_WLONGVARCHAR) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_WVARCHAR) != 0);
+    BOOST_REQUIRE(CheckConnectionInfo(dbc, SQL_CONVERT_GUID) != 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionInt64)
+{
+    CheckSingleResult<int64_t>("SELECT {fn CONVERT(72623859790382856, SQL_BIGINT)}", 72623859790382856);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionInt32)
+{
+    CheckSingleResult<int32_t>("SELECT {fn CONVERT(1234567890, SQL_INTEGER)}", 1234567890);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionInt16)
+{
+    CheckSingleResult<int16_t>("SELECT {fn CONVERT(12345, SQL_SMALLINT)}", 12345);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionInt8)
+{
+    CheckSingleResult<int8_t>("SELECT {fn CONVERT(123, SQL_TINYINT)}", 123);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionByteArray)
+{
+    int32_t value = ToBigEndian(123456);
+
+    std::vector<int8_t> val;
+    val.assign((const int8_t*)&value, (const int8_t*)&value+sizeof(value));
+
+    CheckSingleResult<std::vector<int8_t> >("SELECT {fn CONVERT(123456, SQL_BINARY(4))}", val);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionBool)
+{
+    CheckSingleResult<bool>("SELECT {fn CONVERT(1, SQL_BIT)}", true);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionString)
+{
+    CheckSingleResult<std::string>("SELECT {fn CONVERT(123, SQL_VARCHAR(10))}", "123");
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionDecimal)
+{
+    CheckSingleResult<Decimal>("SELECT {fn CONVERT(-1.25, SQL_DECIMAL(5,2))}", Decimal("-1.25"));
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionDouble)
+{
+    CheckSingleResult<double>("SELECT CAST(-1.25 AS DOUBLE)", -1.25);
+    CheckSingleResult<double>("SELECT CONVERT(-1.25, DOUBLE)", -1.25);
+    CheckSingleResult<double>("SELECT {fn CONVERT(-1.25, SQL_DOUBLE)}", -1.25);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionFloat)
+{
+    CheckSingleResult<float>("SELECT CAST(-1.25 AS REAL)", -1.25);
+    CheckSingleResult<float>("SELECT CONVERT(-1.25, REAL)", -1.25);
+    CheckSingleResult<float>("SELECT CAST(-1.25 AS FLOAT4)", -1.25);
+    CheckSingleResult<float>("SELECT CONVERT(-1.25, FLOAT4)", -1.25);
+    CheckSingleResult<float>("SELECT {fn CONVERT(-1.25, SQL_REAL)}", -1.25);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionGuid)
+{
+    //no support for binding as GUID because we report v3.0 to DM, thus fallback to string binding for now
+    CheckSingleResult<std::string>("SELECT {fn CONVERT({guid '04cc382a-0b82-f520-08d0-07a0620c0004'}, SQL_GUID)}", "04cc382a-0b82-f520-08d0-07a0620c0004");
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionDate)
+{
+    using ignite::impl::binary::BinaryUtils;
+    Date date = BinaryUtils::MakeDateGmt(1983, 3, 14);
+    CheckSingleResult<Date>("SELECT {fn CONVERT('1983-03-14', SQL_DATE)}", date);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionTime)
+{
+    SQL_TIME_STRUCT exp;
+    exp.hour = 13;
+    exp.minute = 20;
+    exp.second = 15;
+    CheckSingleResult<SQL_TIME_STRUCT>("SELECT {fn CONVERT('13:20:15', SQL_TIME)}", exp);
+}
+
+BOOST_AUTO_TEST_CASE(TestEscConvertFunctionTimestamp)
+{
+    using ignite::impl::binary::BinaryUtils;
+    Timestamp ts = BinaryUtils::MakeTimestampGmt(1983, 3, 14, 13, 20, 15, 999999999);
+    CheckSingleResult<Timestamp>("SELECT {fn CONVERT('1983-03-14 13:20:15.999999999', SQL_TIMESTAMP)}", ts);
+}
+
+BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
index b118ff8..1ecd26a 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
@@ -177,7 +177,7 @@ namespace ignite
     template<>
     void SqlTestSuiteFixture::CheckSingleResult<float>(const char* request, const float& expected)
     {
-        SQLFLOAT res = 0;
+        SQLREAL res = 0;
 
         CheckSingleResult0(request, SQL_C_FLOAT, &res, 0, 0);
 
@@ -257,7 +257,7 @@ namespace ignite
     template<>
     void SqlTestSuiteFixture::CheckSingleResult<float>(const char* request)
     {
-        SQLFLOAT res = 0;
+        SQLREAL res = 0;
 
         CheckSingleResult0(request, SQL_C_FLOAT, &res, 0, 0);
     }
@@ -302,4 +302,52 @@ namespace ignite
             BOOST_REQUIRE_EQUAL_COLLECTIONS(expected.begin(), expected.end(), actual.begin(), actual.end());
         }
     }
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<ignite::common::Decimal>(const char* request, const ignite::common::Decimal& expected)
+    {
+        SQLCHAR res[ODBC_BUFFER_SIZE] = { 0 };
+        SQLLEN resLen = 0;
+
+        CheckSingleResult0(request, SQL_C_CHAR, res, ODBC_BUFFER_SIZE, &resLen);
+        ignite::common::Decimal actual(std::string(res, res + resLen));
+    }
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<Date>(const char* request, const Date& expected)
+    {
+        SQL_DATE_STRUCT res;
+
+        CheckSingleResult0(request, SQL_C_DATE, &res, 0, 0);
+
+        using ignite::impl::binary::BinaryUtils;
+        Date actual = BinaryUtils::MakeDateGmt(res.year, res.month, res.day);
+        BOOST_REQUIRE_EQUAL(actual.GetSeconds(), expected.GetSeconds());
+    }
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<SQL_TIME_STRUCT>(const char* request, const SQL_TIME_STRUCT& expected)
+    {
+        SQL_TIME_STRUCT res;
+
+        CheckSingleResult0(request, SQL_C_TIME, &res, 0, 0);
+
+        BOOST_REQUIRE_EQUAL(res.hour, expected.hour);
+        BOOST_REQUIRE_EQUAL(res.minute, expected.minute);
+        BOOST_REQUIRE_EQUAL(res.second, expected.second);
+    }
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<Timestamp>(const char* request, const Timestamp& expected)
+    {
+        SQL_TIMESTAMP_STRUCT res;
+
+        CheckSingleResult0(request, SQL_C_TIMESTAMP, &res, 0, 0);
+
+        using ignite::impl::binary::BinaryUtils;
+        Timestamp actual = BinaryUtils::MakeTimestampGmt(res.year, res.month, res.day, res.hour, res.minute, res.second, res.fraction);
+
+        BOOST_REQUIRE_EQUAL(actual.GetSeconds(), expected.GetSeconds());
+        BOOST_REQUIRE_EQUAL(actual.GetSecondFraction(), expected.GetSecondFraction());
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
index 33797b0..bba806c 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
@@ -76,14 +76,14 @@ BOOST_AUTO_TEST_CASE(TestByteArraySelect)
 BOOST_AUTO_TEST_CASE(TestByteArrayParam)
 {
     SQLRETURN ret;
-    
+
     TestType in;
     in.i8Field = 101;
 
     const int8_t data[] = { 'A','B','C','D','E','F','G','H','I','J' };
     in.i8ArrayField.assign(data, data + sizeof(data) / sizeof(data[0]));
 
-    testCache.Put(1, in);   
+    testCache.Put(1, in);
 
     SQLLEN colLen = 0;
     SQLCHAR colData = 0;
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(TestByteArrayParamInsert)
 
     if (!SQL_SUCCEEDED(ret))
         BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
-    
+
     SQLLEN paramLen = paramData.size();
 
     ret = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_VARBINARY, paramData.size(), 0, &paramData[0], paramData.size(), &paramLen);
@@ -188,4 +188,129 @@ BOOST_AUTO_TEST_CASE(TestByteParamInsert)
     BOOST_REQUIRE_EQUAL(out.i8Field, data);
 }
 
+BOOST_AUTO_TEST_CASE(TestTimestampSelect)
+{
+    TestType in1;
+    in1.i32Field = 1;
+    in1.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2017, 1, 13, 19, 54, 01, 987654321);
+
+    testCache.Put(1, in1);
+
+    CheckSingleResult<int32_t>(
+        "SELECT i32Field FROM TestType WHERE timestampField = '2017-01-13 19:54:01.987654321'", in1.i32Field);
+
+    CheckSingleResult<Timestamp>(
+        "SELECT timestampField FROM TestType WHERE i32Field = 1", in1.timestampField);
+}
+
+BOOST_AUTO_TEST_CASE(TestTimestampInsert)
+{
+    SQLRETURN ret;
+
+    SQLCHAR request[] = "INSERT INTO TestType(_key, timestampField) VALUES(?, ?)";
+
+    ret = SQLPrepare(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    int64_t key = 1;
+    ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_BIGINT, 0, 0, &key, 0, 0);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQL_TIMESTAMP_STRUCT data;
+    data.year = 2017;
+    data.month = 1;
+    data.day = 13;
+    data.hour = 19;
+    data.minute = 54;
+    data.second = 1;
+    data.fraction = 987654321;
+
+    using ignite::impl::binary::BinaryUtils;
+    Timestamp expected = BinaryUtils::MakeTimestampGmt(data.year, data.month, data.day, data.hour,
+        data.minute, data.second, data.fraction);
+
+    SQLLEN lenInd = sizeof(data);
+    ret = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_TIMESTAMP, SQL_TIMESTAMP, sizeof(data), 0, &data, sizeof(data), &lenInd);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLExecute(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    TestType out = testCache.Get(key);
+
+    BOOST_REQUIRE_EQUAL(out.timestampField.GetSeconds(), expected.GetSeconds());
+    BOOST_REQUIRE_EQUAL(out.timestampField.GetSecondFraction(), expected.GetSecondFraction());
+}
+
+BOOST_AUTO_TEST_CASE(TestTimeSelect)
+{
+    SQL_TIME_STRUCT ts;
+    ts.hour = 19;
+    ts.minute = 54;
+    ts.second = 1;
+
+    TestType in1;
+    in1.i32Field = 1;
+    in1.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2017, 1, 13, ts.hour, ts.minute, ts.second);
+
+    testCache.Put(1, in1);
+
+    CheckSingleResult<SQL_TIME_STRUCT>(
+        "SELECT CAST(timestampField AS TIME) FROM TestType WHERE i32Field = 1", ts);
+
+    CheckSingleResult<int32_t>(
+        "SELECT i32Field FROM TestType WHERE CAST(timestampField AS TIME) = '19:54:01'", in1.i32Field);
+}
+
+BOOST_AUTO_TEST_CASE(TestTimeInsertToTimestamp)
+{
+    SQLRETURN ret;
+
+    SQLCHAR request[] = "INSERT INTO TestType(_key, timestampField) VALUES(?, ?)";
+
+    ret = SQLPrepare(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    int64_t key = 1;
+    ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_BIGINT, 0, 0, &key, 0, 0);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQL_TIME_STRUCT data = { 0 };
+    data.hour = 19;
+    data.minute = 54;
+    data.second = 1;
+
+    using ignite::impl::binary::BinaryUtils;
+    Timestamp expected = BinaryUtils::MakeTimestampGmt(1970, 1, 1, data.hour,
+        data.minute, data.second, 0);
+
+    SQLLEN lenInd = sizeof(data);
+    ret = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_TIME, SQL_TIMESTAMP, sizeof(data), 0, &data, sizeof(data), &lenInd);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLExecute(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    TestType out = testCache.Get(key);
+
+    BOOST_REQUIRE_EQUAL(out.timestampField.GetSeconds(), expected.GetSeconds());
+    BOOST_REQUIRE_EQUAL(out.timestampField.GetSecondFraction(), expected.GetSecondFraction());
+}
+
 BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
index 71c5f39..85979c8 100644
--- a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
+++ b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
@@ -45,7 +45,7 @@ namespace ignite
                 // No-op.
             }
 
-            ApplicationDataBuffer::ApplicationDataBuffer(type_traits::IgniteSqlType type, 
+            ApplicationDataBuffer::ApplicationDataBuffer(type_traits::IgniteSqlType type,
                 void* buffer, SqlLen buflen, SqlLen* reslen, int** offset) :
                 type(type),
                 buffer(buffer),
@@ -736,6 +736,20 @@ namespace ignite
                         break;
                     }
 
+                    case IGNITE_ODBC_C_TYPE_TTIME:
+                    {
+                        SQL_TIME_STRUCT* buffer = reinterpret_cast<SQL_TIME_STRUCT*>(dataPtr);
+
+                        buffer->hour = tmTime.tm_hour;
+                        buffer->minute = tmTime.tm_min;
+                        buffer->second = tmTime.tm_sec;
+
+                        if (resLenPtr)
+                            *resLenPtr = static_cast<SqlLen>(sizeof(SQL_TIME_STRUCT));
+
+                        break;
+                    }
+
                     case IGNITE_ODBC_C_TYPE_TTIMESTAMP:
                     {
                         SQL_TIMESTAMP_STRUCT* buffer = reinterpret_cast<SQL_TIMESTAMP_STRUCT*>(dataPtr);
@@ -856,6 +870,20 @@ namespace ignite
                         break;
                     }
 
+                    case IGNITE_ODBC_C_TYPE_TTIME:
+                    {
+                        SQL_TIME_STRUCT* buffer = reinterpret_cast<SQL_TIME_STRUCT*>(dataPtr);
+
+                        buffer->hour = tmTime.tm_hour;
+                        buffer->minute = tmTime.tm_min;
+                        buffer->second = tmTime.tm_sec;
+
+                        if (resLenPtr)
+                            *resLenPtr = static_cast<SqlLen>(sizeof(SQL_TIME_STRUCT));
+
+                        break;
+                    }
+
                     case IGNITE_ODBC_C_TYPE_TTIMESTAMP:
                     {
                         SQL_TIMESTAMP_STRUCT* buffer = reinterpret_cast<SQL_TIMESTAMP_STRUCT*>(dataPtr);
@@ -1080,7 +1108,7 @@ namespace ignite
                 return ApplyOffset(reslen);
             }
 
-            void* ApplicationDataBuffer::GetData() 
+            void* ApplicationDataBuffer::GetData()
             {
                 return ApplyOffset(buffer);
             }
@@ -1228,6 +1256,19 @@ namespace ignite
                         break;
                     }
 
+                    case IGNITE_ODBC_C_TYPE_TTIME:
+                    {
+                        const SQL_TIME_STRUCT* buffer = reinterpret_cast<const SQL_TIME_STRUCT*>(GetData());
+
+                        tmTime.tm_year = 70;
+                        tmTime.tm_mday = 1;
+                        tmTime.tm_hour = buffer->hour;
+                        tmTime.tm_min = buffer->minute;
+                        tmTime.tm_sec = buffer->second;
+
+                        break;
+                    }
+
                     case IGNITE_ODBC_C_TYPE_TTIMESTAMP:
                     {
                         const SQL_TIMESTAMP_STRUCT* buffer = reinterpret_cast<const SQL_TIMESTAMP_STRUCT*>(GetData());
@@ -1289,6 +1330,19 @@ namespace ignite
                         break;
                     }
 
+                    case IGNITE_ODBC_C_TYPE_TTIME:
+                    {
+                        const SQL_TIME_STRUCT* buffer = reinterpret_cast<const SQL_TIME_STRUCT*>(GetData());
+
+                        tmTime.tm_year = 70;
+                        tmTime.tm_mday = 1;
+                        tmTime.tm_hour = buffer->hour;
+                        tmTime.tm_min = buffer->minute;
+                        tmTime.tm_sec = buffer->second;
+
+                        break;
+                    }
+
                     case IGNITE_ODBC_C_TYPE_TTIMESTAMP:
                     {
                         const SQL_TIMESTAMP_STRUCT* buffer = reinterpret_cast<const SQL_TIMESTAMP_STRUCT*>(GetData());

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc/src/app/parameter.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/parameter.cpp b/modules/platforms/cpp/odbc/src/app/parameter.cpp
index 937ef58..ded2e4b 100644
--- a/modules/platforms/cpp/odbc/src/app/parameter.cpp
+++ b/modules/platforms/cpp/odbc/src/app/parameter.cpp
@@ -40,7 +40,7 @@ namespace ignite
                 // No-op.
             }
 
-            Parameter::Parameter(const ApplicationDataBuffer& buffer, int16_t sqlType, 
+            Parameter::Parameter(const ApplicationDataBuffer& buffer, int16_t sqlType,
                 size_t columnSize, int16_t decDigits) :
                 buffer(buffer),
                 sqlType(sqlType),
@@ -150,12 +150,14 @@ namespace ignite
                         break;
                     }
 
+                    case SQL_TYPE_DATE:
                     case SQL_DATE:
                     {
                         writer.WriteDate(buf.GetDate());
                         break;
                     }
 
+                    case SQL_TYPE_TIMESTAMP:
                     case SQL_TIMESTAMP:
                     {
                         writer.WriteTimestamp(buf.GetTimestamp());

http://git-wip-us.apache.org/repos/asf/ignite/blob/664dc88e/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index ed76aab..a34d434 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -29,11 +29,11 @@
 
 #ifndef SQL_ASYNC_NOTIFICATION_NOT_CAPABLE
 #define SQL_ASYNC_NOTIFICATION_NOT_CAPABLE      0x00000000L
-#endif 
+#endif
 
 #ifndef SQL_ASYNC_NOTIFICATION_CAPABLE
 #define SQL_ASYNC_NOTIFICATION_CAPABLE          0x00000001L
-#endif 
+#endif
 
 namespace ignite
 {
@@ -93,7 +93,32 @@ namespace ignite
                     DBG_STR_CASE(SQL_SQL92_VALUE_EXPRESSIONS);
                     DBG_STR_CASE(SQL_STATIC_CURSOR_ATTRIBUTES1);
                     DBG_STR_CASE(SQL_STATIC_CURSOR_ATTRIBUTES2);
-                default: 
+                    DBG_STR_CASE(SQL_CONVERT_BIGINT);
+                    DBG_STR_CASE(SQL_CONVERT_BINARY);
+                    DBG_STR_CASE(SQL_CONVERT_BIT);
+                    DBG_STR_CASE(SQL_CONVERT_CHAR);
+                    DBG_STR_CASE(SQL_CONVERT_DATE);
+                    DBG_STR_CASE(SQL_CONVERT_DECIMAL);
+                    DBG_STR_CASE(SQL_CONVERT_DOUBLE);
+                    DBG_STR_CASE(SQL_CONVERT_FLOAT);
+                    DBG_STR_CASE(SQL_CONVERT_INTEGER);
+                    DBG_STR_CASE(SQL_CONVERT_LONGVARCHAR);
+                    DBG_STR_CASE(SQL_CONVERT_NUMERIC);
+                    DBG_STR_CASE(SQL_CONVERT_REAL);
+                    DBG_STR_CASE(SQL_CONVERT_SMALLINT);
+                    DBG_STR_CASE(SQL_CONVERT_TIME);
+                    DBG_STR_CASE(SQL_CONVERT_TIMESTAMP);
+                    DBG_STR_CASE(SQL_CONVERT_TINYINT);
+                    DBG_STR_CASE(SQL_CONVERT_VARBINARY);
+                    DBG_STR_CASE(SQL_CONVERT_VARCHAR);
+                    DBG_STR_CASE(SQL_CONVERT_LONGVARBINARY);
+                    DBG_STR_CASE(SQL_CONVERT_WCHAR);
+                    DBG_STR_CASE(SQL_CONVERT_INTERVAL_DAY_TIME);
+                    DBG_STR_CASE(SQL_CONVERT_INTERVAL_YEAR_MONTH);
+                    DBG_STR_CASE(SQL_CONVERT_WLONGVARCHAR);
+                    DBG_STR_CASE(SQL_CONVERT_WVARCHAR);
+                    DBG_STR_CASE(SQL_CONVERT_GUID);
+                default:
                     break;
                 }
                 return "<< UNKNOWN TYPE >>";
@@ -114,7 +139,7 @@ namespace ignite
                 strParams[SQL_DBMS_VER]        = "03.00";
 
 #ifdef SQL_DRIVER_VER
-                // Driver version. At a minimum, the version is of the form 
+                // Driver version. At a minimum, the version is of the form
                 // ##.##.####, where the first two digits are the major version,
                 // the next two digits are the minor version, and the last four
                 // digits are the release version.
@@ -122,7 +147,7 @@ namespace ignite
 #endif // SQL_DRIVER_VER
 
 #ifdef SQL_COLUMN_ALIAS
-                // A character string: "Y" if the data source supports column 
+                // A character string: "Y" if the data source supports column
                 // aliases; otherwise, "N".
                 strParams[SQL_COLUMN_ALIAS] = "Y";
 #endif // SQL_COLUMN_ALIAS
@@ -165,7 +190,7 @@ namespace ignite
 #endif // SQL_TABLE_TERM
 
 #ifdef SQL_SCHEMA_TERM
-                // A character string with the data source vendor's name for 
+                // A character string with the data source vendor's name for
                 // a schema; for example, "owner", "Authorization ID", or "Schema".
                 strParams[SQL_SCHEMA_TERM] = "schema";
 #endif // SQL_SCHEMA_TERM
@@ -191,9 +216,9 @@ namespace ignite
 
 #ifdef SQL_ASYNC_NOTIFICATION
                 // Indicates if the driver supports asynchronous notification.
-                // SQL_ASYNC_NOTIFICATION_CAPABLE  = Asynchronous execution 
+                // SQL_ASYNC_NOTIFICATION_CAPABLE  = Asynchronous execution
                 // notification is supported by the driver.
-                // SQL_ASYNC_NOTIFICATION_NOT_CAPABLE Asynchronous execution 
+                // SQL_ASYNC_NOTIFICATION_NOT_CAPABLE Asynchronous execution
                 // notification is not supported by the driver.
                 intParams[SQL_ASYNC_NOTIFICATION] = SQL_ASYNC_NOTIFICATION_NOT_CAPABLE;
 #endif // SQL_ASYNC_NOTIFICATION
@@ -204,7 +229,7 @@ namespace ignite
 #endif // SQL_GETDATA_EXTENSIONS
 
 #ifdef SQL_ODBC_INTERFACE_CONFORMANCE
-                // Indicates the level of the ODBC 3.x interface that the driver 
+                // Indicates the level of the ODBC 3.x interface that the driver
                 // complies with.
                 intParams[SQL_ODBC_INTERFACE_CONFORMANCE] = SQL_OIC_CORE;
 #endif // SQL_ODBC_INTERFACE_CONFORMANCE
@@ -226,7 +251,7 @@ namespace ignite
 #endif // SQL_SCHEMA_USAGE
 
 #ifdef SQL_MAX_IDENTIFIER_LEN
-                // Indicates the maximum size in characters that the data source 
+                // Indicates the maximum size in characters that the data source
                 // supports for user-defined names.
                 intParams[SQL_MAX_IDENTIFIER_LEN] = 128;
 #endif // SQL_MAX_IDENTIFIER_LEN
@@ -240,7 +265,7 @@ namespace ignite
 #ifdef SQL_NUMERIC_FUNCTIONS
                 // Bitmask enumerating the scalar numeric functions supported by
                 // the driver and associated data source.
-                intParams[SQL_NUMERIC_FUNCTIONS] = SQL_FN_NUM_ABS | SQL_FN_NUM_ACOS | SQL_FN_NUM_ASIN | 
+                intParams[SQL_NUMERIC_FUNCTIONS] = SQL_FN_NUM_ABS | SQL_FN_NUM_ACOS | SQL_FN_NUM_ASIN |
                     SQL_FN_NUM_ATAN | SQL_FN_NUM_ATAN2 | SQL_FN_NUM_CEILING | SQL_FN_NUM_COS | SQL_FN_NUM_COT |
                     SQL_FN_NUM_EXP | SQL_FN_NUM_FLOOR | SQL_FN_NUM_LOG | SQL_FN_NUM_MOD | SQL_FN_NUM_SIGN |
                     SQL_FN_NUM_SIN | SQL_FN_NUM_SQRT | SQL_FN_NUM_TAN | SQL_FN_NUM_PI | SQL_FN_NUM_RAND |
@@ -270,7 +295,7 @@ namespace ignite
 #endif // SQL_TIMEDATE_FUNCTIONS
 
 #ifdef SQL_TIMEDATE_ADD_INTERVALS
-                // Bitmask enumerating timestamp intervals supported by the driver 
+                // Bitmask enumerating timestamp intervals supported by the driver
                 // and associated data source for the TIMESTAMPADD scalar function.
                 intParams[SQL_TIMEDATE_ADD_INTERVALS] = 0;
 #endif // SQL_TIMEDATE_ADD_INTERVALS
@@ -296,11 +321,11 @@ namespace ignite
 #ifdef SQL_CONVERT_FUNCTIONS
                 // Bitmask enumerating the scalar conversion functions supported
                 // by the driver and associated data source.
-                intParams[SQL_CONVERT_FUNCTIONS] = 0;
+                intParams[SQL_CONVERT_FUNCTIONS] = SQL_FN_CVT_CONVERT | SQL_FN_CVT_CAST;
 #endif // SQL_CONVERT_FUNCTIONS
 
 #ifdef SQL_OJ_CAPABILITIES
-                // Bitmask enumerating the types of outer joins supported by the 
+                // Bitmask enumerating the types of outer joins supported by the
                 // driver and data source.
                 intParams[SQL_OJ_CAPABILITIES] = SQL_OJ_LEFT | SQL_OJ_NOT_ORDERED | SQL_OJ_ALL_COMPARISON_OPS;
 #endif // SQL_OJ_CAPABILITIES
@@ -330,7 +355,7 @@ namespace ignite
 #ifdef SQL_SQL92_VALUE_EXPRESSIONS
                 // Bitmask enumerating the value expressions supported,
                 // as defined in SQL-92.
-                intParams[SQL_SQL92_VALUE_EXPRESSIONS] = SQL_SVE_CASE | 
+                intParams[SQL_SQL92_VALUE_EXPRESSIONS] = SQL_SVE_CASE |
                     SQL_SVE_CAST | SQL_SVE_COALESCE | SQL_SVE_NULLIF;
 #endif // SQL_SQL92_VALUE_EXPRESSIONS
 
@@ -366,6 +391,207 @@ namespace ignite
                 intParams[SQL_STATIC_CURSOR_ATTRIBUTES2] = 0;
 #endif //SQL_STATIC_CURSOR_ATTRIBUTES2
 
+#ifdef SQL_CONVERT_BIGINT
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type BIGINT
+                intParams[SQL_CONVERT_BIGINT] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR | SQL_CVT_WCHAR |
+                    SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_BIT |
+                    SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER | SQL_CVT_BIGINT |
+                    SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_BIGINT
+
+#ifdef SQL_CONVERT_BINARY
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type BINARY
+                intParams[SQL_CONVERT_BINARY] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL |
+                    SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_REAL |
+                    SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY |
+                    SQL_CVT_DATE | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_BINARY
+
+#ifdef SQL_CONVERT_BIT
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type BIT
+                intParams[SQL_CONVERT_BIT] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR | SQL_CVT_NUMERIC |
+                    SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER | SQL_CVT_BIGINT;
+#endif //SQL_CONVERT_BIT
+
+#ifdef SQL_CONVERT_CHAR
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type CHAR
+                intParams[SQL_CONVERT_CHAR] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER |
+                    SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_DATE | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_CHAR
+
+#ifdef SQL_CONVERT_VARCHAR
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type VARCHAR
+                intParams[SQL_CONVERT_VARCHAR] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER |
+                    SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_DATE | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_VARCHAR
+
+#ifdef SQL_CONVERT_LONGVARCHAR
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type LONGVARCHAR
+                intParams[SQL_CONVERT_LONGVARCHAR] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER |
+                    SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_DATE | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_LONGVARCHAR
+
+#ifdef SQL_CONVERT_WCHAR
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type WCHAR
+                intParams[SQL_CONVERT_WCHAR] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER |
+                    SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_DATE | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_WCHAR
+
+#ifdef SQL_CONVERT_WVARCHAR
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type WVARCHAR
+                intParams[SQL_CONVERT_WVARCHAR] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER |
+                    SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_DATE | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_WVARCHAR
+
+#ifdef SQL_CONVERT_WLONGVARCHAR
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type WLONGVARCHAR
+                intParams[SQL_CONVERT_WLONGVARCHAR] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER |
+                    SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_DATE | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_WLONGVARCHAR
+
+#ifdef SQL_CONVERT_DATE
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type DATE
+                intParams[SQL_CONVERT_DATE] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY |
+                    SQL_CVT_DATE | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_DATE
+
+#ifdef SQL_CONVERT_DECIMAL
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type DECIMAL
+                intParams[SQL_CONVERT_DECIMAL] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER | SQL_CVT_BIGINT |
+                    SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_DECIMAL
+
+#ifdef SQL_CONVERT_DOUBLE
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type DOUBLE
+                intParams[SQL_CONVERT_DOUBLE] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR | SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER |
+                    SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_DOUBLE
+
+#ifdef SQL_CONVERT_FLOAT
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type FLOAT
+                intParams[SQL_CONVERT_FLOAT] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT | SQL_CVT_INTEGER |
+                    SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_FLOAT
+
+#ifdef SQL_CONVERT_REAL
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type REAL
+                intParams[SQL_CONVERT_REAL] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT |
+                    SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE |
+                    SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_REAL
+
+#ifdef SQL_CONVERT_INTEGER
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type INTEGER
+                intParams[SQL_CONVERT_INTEGER] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT |
+                    SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY |
+                    SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_INTEGER
+
+#ifdef SQL_CONVERT_NUMERIC
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type NUMERIC
+                intParams[SQL_CONVERT_NUMERIC] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT |
+                    SQL_CVT_SMALLINT | SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_REAL |
+                    SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_NUMERIC
+
+#ifdef SQL_CONVERT_SMALLINT
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type SMALLINT
+                intParams[SQL_CONVERT_SMALLINT] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT |
+                    SQL_CVT_SMALLINT | SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_REAL |
+                    SQL_CVT_FLOAT | SQL_CVT_DOUBLE | SQL_CVT_BINARY | SQL_CVT_VARBINARY |
+                    SQL_CVT_LONGVARBINARY | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_SMALLINT
+
+#ifdef SQL_CONVERT_TINYINT
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type TINYINT
+                intParams[SQL_CONVERT_TINYINT] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT |
+                    SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE |
+                    SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_TINYINT
+
+#ifdef SQL_CONVERT_TIME
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type TIME
+                intParams[SQL_CONVERT_TIME] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY |
+                    SQL_CVT_TIME | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_TIME
+
+#ifdef SQL_CONVERT_TIMESTAMP
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type TIMESTAMP
+                intParams[SQL_CONVERT_TIMESTAMP] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_BINARY |
+                    SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_DATE | SQL_CVT_TIME | SQL_CVT_TIMESTAMP;
+#endif //SQL_CONVERT_TIMESTAMP
+
+#ifdef SQL_CONVERT_VARBINARY
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type VARBINARY
+                intParams[SQL_CONVERT_VARBINARY] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT |
+                    SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE |
+                    SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_DATE |
+                    SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_VARBINARY
+
+#ifdef SQL_CONVERT_LONGVARBINARY
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type LONGVARBINARY
+                intParams[SQL_CONVERT_LONGVARBINARY] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_SMALLINT |
+                    SQL_CVT_INTEGER | SQL_CVT_BIGINT | SQL_CVT_REAL | SQL_CVT_FLOAT | SQL_CVT_DOUBLE |
+                    SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_DATE |
+                    SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_GUID;
+#endif //SQL_CONVERT_LONGVARBINARY
+
+#ifdef SQL_CONVERT_GUID
+                // Bitmask indicates the conversions supported by the CONVERT scalar function for target type GUID
+                intParams[SQL_CONVERT_GUID] = SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR |
+                    SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR |
+                    SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_GUID;
+#endif //SQL_CONVERT_GUID
+
                 //======================= Short Params ========================
 #ifdef SQL_MAX_CONCURRENT_ACTIVITIES
                 // The maximum number of active statements that the driver can
@@ -409,10 +635,10 @@ namespace ignite
 
                 StringInfoMap::const_iterator itStr = strParams.find(type);
 
-                if (itStr != strParams.end()) 
+                if (itStr != strParams.end())
                 {
                     unsigned short strlen = static_cast<short>(
-                        utility::CopyStringToBuffer(itStr->second, 
+                        utility::CopyStringToBuffer(itStr->second,
                             reinterpret_cast<char*>(buf), buflen));
 
                     if (reslen)


[07/10] ignite git commit: IGNITE-4507: Hadoop: added direct output support for combiner. This closes #1434.

Posted by yz...@apache.org.
IGNITE-4507: Hadoop: added direct output support for combiner. This closes #1434.


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

Branch: refs/heads/ignite-comm-balance-master
Commit: d596f02b1c64c789f91dea57d349510101d3e201
Parents: d6d42c2
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Fri Jan 20 17:33:34 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jan 20 17:33:34 2017 +0300

----------------------------------------------------------------------
 .../processors/hadoop/HadoopTaskContext.java    | 10 +++
 .../hadoop/impl/v1/HadoopV1MapTask.java         | 89 +++++++++++---------
 .../hadoop/impl/v1/HadoopV1ReduceTask.java      | 69 +++++++++------
 .../hadoop/impl/v2/HadoopV2Context.java         | 10 ---
 .../hadoop/impl/v2/HadoopV2MapTask.java         | 18 ++--
 .../hadoop/impl/v2/HadoopV2ReduceTask.java      | 14 +++
 .../hadoop/impl/v2/HadoopV2TaskContext.java     |  1 +
 .../hadoop/shuffle/HadoopShuffleJob.java        |  7 --
 .../shuffle/direct/HadoopDirectDataInput.java   |  2 +-
 .../hadoop/taskexecutor/HadoopRunnableTask.java | 12 ++-
 .../impl/HadoopAbstractMapReduceTest.java       |  2 +
 .../impl/HadoopMapReduceEmbeddedSelfTest.java   |  6 +-
 12 files changed, 145 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopTaskContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopTaskContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopTaskContext.java
index dddd017..d6e9394 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopTaskContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopTaskContext.java
@@ -207,4 +207,14 @@ public abstract class HadoopTaskContext {
      * @throws IgniteCheckedException On any error in callable.
      */
     public abstract <T> T runAsJobOwner(Callable<T> c) throws IgniteCheckedException;
+
+    /**
+     * Callback invoked from mapper thread when map is finished.
+     *
+     * @throws IgniteCheckedException If failed.
+     */
+    public void onMapperFinished() throws IgniteCheckedException {
+        if (output instanceof HadoopMapperAwareTaskOutput)
+            ((HadoopMapperAwareTaskOutput)output).onMapperFinished();
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1MapTask.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1MapTask.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1MapTask.java
index 65ff280..2aa4292 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1MapTask.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1MapTask.java
@@ -30,6 +30,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.processors.hadoop.HadoopFileBlock;
 import org.apache.ignite.internal.processors.hadoop.HadoopInputSplit;
 import org.apache.ignite.internal.processors.hadoop.HadoopJob;
+import org.apache.ignite.internal.processors.hadoop.HadoopMapperUtils;
 import org.apache.ignite.internal.processors.hadoop.HadoopTaskCancelledException;
 import org.apache.ignite.internal.processors.hadoop.HadoopTaskContext;
 import org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo;
@@ -45,7 +46,7 @@ public class HadoopV1MapTask extends HadoopV1Task {
     /**
      * Constructor.
      *
-     * @param taskInfo 
+     * @param taskInfo Taks info.
      */
     public HadoopV1MapTask(HadoopTaskInfo taskInfo) {
         super(taskInfo);
@@ -56,67 +57,79 @@ public class HadoopV1MapTask extends HadoopV1Task {
     @Override public void run(HadoopTaskContext taskCtx) throws IgniteCheckedException {
         HadoopJob job = taskCtx.job();
 
-        HadoopV2TaskContext ctx = (HadoopV2TaskContext)taskCtx;
+        HadoopV2TaskContext taskCtx0 = (HadoopV2TaskContext)taskCtx;
 
-        JobConf jobConf = ctx.jobConf();
+        if (taskCtx.taskInfo().hasMapperIndex())
+            HadoopMapperUtils.mapperIndex(taskCtx.taskInfo().mapperIndex());
+        else
+            HadoopMapperUtils.clearMapperIndex();
 
-        InputFormat inFormat = jobConf.getInputFormat();
+        try {
+            JobConf jobConf = taskCtx0.jobConf();
 
-        HadoopInputSplit split = info().inputSplit();
+            InputFormat inFormat = jobConf.getInputFormat();
 
-        InputSplit nativeSplit;
+            HadoopInputSplit split = info().inputSplit();
 
-        if (split instanceof HadoopFileBlock) {
-            HadoopFileBlock block = (HadoopFileBlock)split;
+            InputSplit nativeSplit;
 
-            nativeSplit = new FileSplit(new Path(block.file().toString()), block.start(), block.length(), EMPTY_HOSTS);
-        }
-        else
-            nativeSplit = (InputSplit)ctx.getNativeSplit(split);
+            if (split instanceof HadoopFileBlock) {
+                HadoopFileBlock block = (HadoopFileBlock)split;
 
-        assert nativeSplit != null;
+                nativeSplit = new FileSplit(new Path(block.file().toString()), block.start(), block.length(), EMPTY_HOSTS);
+            }
+            else
+                nativeSplit = (InputSplit)taskCtx0.getNativeSplit(split);
 
-        Reporter reporter = new HadoopV1Reporter(taskCtx);
+            assert nativeSplit != null;
 
-        HadoopV1OutputCollector collector = null;
+            Reporter reporter = new HadoopV1Reporter(taskCtx);
 
-        try {
-            collector = collector(jobConf, ctx, !job.info().hasCombiner() && !job.info().hasReducer(),
-                fileName(), ctx.attemptId());
+            HadoopV1OutputCollector collector = null;
 
-            RecordReader reader = inFormat.getRecordReader(nativeSplit, jobConf, reporter);
+            try {
+                collector = collector(jobConf, taskCtx0, !job.info().hasCombiner() && !job.info().hasReducer(),
+                    fileName(), taskCtx0.attemptId());
 
-            Mapper mapper = ReflectionUtils.newInstance(jobConf.getMapperClass(), jobConf);
+                RecordReader reader = inFormat.getRecordReader(nativeSplit, jobConf, reporter);
 
-            Object key = reader.createKey();
-            Object val = reader.createValue();
+                Mapper mapper = ReflectionUtils.newInstance(jobConf.getMapperClass(), jobConf);
 
-            assert mapper != null;
+                Object key = reader.createKey();
+                Object val = reader.createValue();
+
+                assert mapper != null;
 
-            try {
                 try {
-                    while (reader.next(key, val)) {
-                        if (isCancelled())
-                            throw new HadoopTaskCancelledException("Map task cancelled.");
+                    try {
+                        while (reader.next(key, val)) {
+                            if (isCancelled())
+                                throw new HadoopTaskCancelledException("Map task cancelled.");
+
+                            mapper.map(key, val, collector, reporter);
+                        }
 
-                        mapper.map(key, val, collector, reporter);
+                        taskCtx.onMapperFinished();
+                    }
+                    finally {
+                        mapper.close();
                     }
                 }
                 finally {
-                    mapper.close();
+                    collector.closeWriter();
                 }
+
+                collector.commit();
             }
-            finally {
-                collector.closeWriter();
-            }
+            catch (Exception e) {
+                if (collector != null)
+                    collector.abort();
 
-            collector.commit();
+                throw new IgniteCheckedException(e);
+            }
         }
-        catch (Exception e) {
-            if (collector != null)
-                collector.abort();
-
-            throw new IgniteCheckedException(e);
+        finally {
+            HadoopMapperUtils.clearMapperIndex();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1ReduceTask.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1ReduceTask.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1ReduceTask.java
index 92c024e..5c1dd15 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1ReduceTask.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v1/HadoopV1ReduceTask.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.mapred.Reporter;
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.processors.hadoop.HadoopJob;
+import org.apache.ignite.internal.processors.hadoop.HadoopMapperUtils;
 import org.apache.ignite.internal.processors.hadoop.HadoopTaskCancelledException;
 import org.apache.ignite.internal.processors.hadoop.HadoopTaskContext;
 import org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo;
@@ -53,49 +54,63 @@ public class HadoopV1ReduceTask extends HadoopV1Task {
     @Override public void run(HadoopTaskContext taskCtx) throws IgniteCheckedException {
         HadoopJob job = taskCtx.job();
 
-        HadoopV2TaskContext ctx = (HadoopV2TaskContext)taskCtx;
+        HadoopV2TaskContext taskCtx0 = (HadoopV2TaskContext)taskCtx;
 
-        JobConf jobConf = ctx.jobConf();
-
-        HadoopTaskInput input = taskCtx.input();
-
-        HadoopV1OutputCollector collector = null;
+        if (!reduce && taskCtx.taskInfo().hasMapperIndex())
+            HadoopMapperUtils.mapperIndex(taskCtx.taskInfo().mapperIndex());
+        else
+            HadoopMapperUtils.clearMapperIndex();
 
         try {
-            collector = collector(jobConf, ctx, reduce || !job.info().hasReducer(), fileName(), ctx.attemptId());
+            JobConf jobConf = taskCtx0.jobConf();
 
-            Reducer reducer;
-            if (reduce) reducer = ReflectionUtils.newInstance(jobConf.getReducerClass(),
-                jobConf);
-            else reducer = ReflectionUtils.newInstance(jobConf.getCombinerClass(),
-                jobConf);
+            HadoopTaskInput input = taskCtx.input();
 
-            assert reducer != null;
+            HadoopV1OutputCollector collector = null;
 
             try {
+                collector = collector(jobConf, taskCtx0, reduce || !job.info().hasReducer(), fileName(), taskCtx0.attemptId());
+
+                Reducer reducer;
+                if (reduce) reducer = ReflectionUtils.newInstance(jobConf.getReducerClass(),
+                    jobConf);
+                else reducer = ReflectionUtils.newInstance(jobConf.getCombinerClass(),
+                    jobConf);
+
+                assert reducer != null;
+
                 try {
-                    while (input.next()) {
-                        if (isCancelled())
-                            throw new HadoopTaskCancelledException("Reduce task cancelled.");
+                    try {
+                        while (input.next()) {
+                            if (isCancelled())
+                                throw new HadoopTaskCancelledException("Reduce task cancelled.");
+
+                            reducer.reduce(input.key(), input.values(), collector, Reporter.NULL);
+                        }
 
-                        reducer.reduce(input.key(), input.values(), collector, Reporter.NULL);
+                        if (!reduce)
+                            taskCtx.onMapperFinished();
+                    }
+                    finally {
+                        reducer.close();
                     }
                 }
                 finally {
-                    reducer.close();
+                    collector.closeWriter();
                 }
+
+                collector.commit();
             }
-            finally {
-                collector.closeWriter();
-            }
+            catch (Exception e) {
+                if (collector != null)
+                    collector.abort();
 
-            collector.commit();
+                throw new IgniteCheckedException(e);
+            }
         }
-        catch (Exception e) {
-            if (collector != null)
-                collector.abort();
-
-            throw new IgniteCheckedException(e);
+        finally {
+            if (!reduce)
+                HadoopMapperUtils.clearMapperIndex();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2Context.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2Context.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2Context.java
index eec0636..1f4e675 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2Context.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2Context.java
@@ -154,16 +154,6 @@ public class HadoopV2Context extends JobContextImpl implements MapContext, Reduc
         }
     }
 
-    /**
-     * Callback invoked from mapper thread when map is finished.
-     *
-     * @throws IgniteCheckedException If failed.
-     */
-    public void onMapperFinished() throws IgniteCheckedException {
-        if (output instanceof HadoopMapperAwareTaskOutput)
-            ((HadoopMapperAwareTaskOutput)output).onMapperFinished();
-    }
-
     /** {@inheritDoc} */
     @Override public OutputCommitter getOutputCommitter() {
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2MapTask.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2MapTask.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2MapTask.java
index eb3b935..1519199 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2MapTask.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2MapTask.java
@@ -56,30 +56,32 @@ public class HadoopV2MapTask extends HadoopV2Task {
             HadoopMapperUtils.clearMapperIndex();
 
         try {
-            InputSplit nativeSplit = hadoopContext().getInputSplit();
+            HadoopV2Context hadoopCtx = hadoopContext();
+
+            InputSplit nativeSplit = hadoopCtx.getInputSplit();
 
             if (nativeSplit == null)
                 throw new IgniteCheckedException("Input split cannot be null.");
 
             InputFormat inFormat = ReflectionUtils.newInstance(jobCtx.getInputFormatClass(),
-                hadoopContext().getConfiguration());
+                hadoopCtx.getConfiguration());
 
-            RecordReader reader = inFormat.createRecordReader(nativeSplit, hadoopContext());
+            RecordReader reader = inFormat.createRecordReader(nativeSplit, hadoopCtx);
 
-            reader.initialize(nativeSplit, hadoopContext());
+            reader.initialize(nativeSplit, hadoopCtx);
 
-            hadoopContext().reader(reader);
+            hadoopCtx.reader(reader);
 
             HadoopJobInfo jobInfo = taskCtx.job().info();
 
             outputFormat = jobInfo.hasCombiner() || jobInfo.hasReducer() ? null : prepareWriter(jobCtx);
 
-            Mapper mapper = ReflectionUtils.newInstance(jobCtx.getMapperClass(), hadoopContext().getConfiguration());
+            Mapper mapper = ReflectionUtils.newInstance(jobCtx.getMapperClass(), hadoopCtx.getConfiguration());
 
             try {
-                mapper.run(new WrappedMapper().getMapContext(hadoopContext()));
+                mapper.run(new WrappedMapper().getMapContext(hadoopCtx));
 
-                hadoopContext().onMapperFinished();
+                taskCtx.onMapperFinished();
             }
             finally {
                 closeWriter();

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2ReduceTask.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2ReduceTask.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2ReduceTask.java
index 930ec1d..09e0634 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2ReduceTask.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2ReduceTask.java
@@ -24,6 +24,7 @@ import org.apache.hadoop.mapreduce.lib.reduce.WrappedReducer;
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.processors.hadoop.HadoopMapperUtils;
 import org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo;
 
 /**
@@ -53,10 +54,17 @@ public class HadoopV2ReduceTask extends HadoopV2Task {
 
         JobContextImpl jobCtx = taskCtx.jobContext();
 
+        // Set mapper index for combiner tasks
+        if (!reduce && taskCtx.taskInfo().hasMapperIndex())
+            HadoopMapperUtils.mapperIndex(taskCtx.taskInfo().mapperIndex());
+        else
+            HadoopMapperUtils.clearMapperIndex();
+
         try {
             outputFormat = reduce || !taskCtx.job().info().hasReducer() ? prepareWriter(jobCtx) : null;
 
             Reducer reducer;
+
             if (reduce) reducer = ReflectionUtils.newInstance(jobCtx.getReducerClass(),
                 jobCtx.getConfiguration());
             else reducer = ReflectionUtils.newInstance(jobCtx.getCombinerClass(),
@@ -64,6 +72,9 @@ public class HadoopV2ReduceTask extends HadoopV2Task {
 
             try {
                 reducer.run(new WrappedReducer().getReducerContext(hadoopContext()));
+
+                if (!reduce)
+                    taskCtx.onMapperFinished();
             }
             finally {
                 closeWriter();
@@ -84,6 +95,9 @@ public class HadoopV2ReduceTask extends HadoopV2Task {
             throw new IgniteCheckedException(e);
         }
         finally {
+            if (!reduce)
+                HadoopMapperUtils.clearMapperIndex();
+
             if (err != null)
                 abort(outputFormat);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2TaskContext.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2TaskContext.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2TaskContext.java
index 5229590..8acc7aa 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2TaskContext.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/v2/HadoopV2TaskContext.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.processors.hadoop.HadoopInputSplit;
 import org.apache.ignite.internal.processors.hadoop.HadoopJob;
 import org.apache.ignite.internal.processors.hadoop.HadoopJobId;
 import org.apache.ignite.internal.processors.hadoop.HadoopJobProperty;
+import org.apache.ignite.internal.processors.hadoop.HadoopMapperAwareTaskOutput;
 import org.apache.ignite.internal.processors.hadoop.HadoopPartitioner;
 import org.apache.ignite.internal.processors.hadoop.HadoopSerialization;
 import org.apache.ignite.internal.processors.hadoop.HadoopSplitWrapper;

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
index 0394865..3646aa7 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
@@ -182,13 +182,6 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
         boolean stripeMappers0 = get(job.info(), SHUFFLE_MAPPER_STRIPED_OUTPUT, false);
 
         if (stripeMappers0) {
-            if (job.info().hasCombiner()) {
-                log.info("Striped mapper output is disabled because it cannot be used together with combiner [jobId=" +
-                    job.id() + ']');
-
-                stripeMappers0 = false;
-            }
-
             if (!embedded) {
                 log.info("Striped mapper output is disabled becuase it cannot be used in external mode [jobId=" +
                     job.id() + ']');

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataInput.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataInput.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataInput.java
index e3a713a..ef2905b 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataInput.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataInput.java
@@ -48,7 +48,7 @@ public class HadoopDirectDataInput extends InputStream implements DataInput {
 
     /** {@inheritDoc} */
     @Override public int read() throws IOException {
-        return readByte();
+        return (int)readByte() & 0xFF;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/HadoopRunnableTask.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/HadoopRunnableTask.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/HadoopRunnableTask.java
index a57efe6..339bf5b 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/HadoopRunnableTask.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/HadoopRunnableTask.java
@@ -122,7 +122,7 @@ public abstract class HadoopRunnableTask implements Callable<Void> {
 
     /**
      * Implements actual task running.
-     * @throws IgniteCheckedException
+     * @throws IgniteCheckedException On error.
      */
     void call0() throws IgniteCheckedException {
         execStartTs = U.currentTimeMillis();
@@ -144,7 +144,15 @@ public abstract class HadoopRunnableTask implements Callable<Void> {
             runTask(perfCntr);
 
             if (info.type() == MAP && job.info().hasCombiner()) {
-                ctx.taskInfo(new HadoopTaskInfo(COMBINE, info.jobId(), info.taskNumber(), info.attempt(), null));
+                // Switch to combiner.
+                HadoopTaskInfo combineTaskInfo = new HadoopTaskInfo(COMBINE, info.jobId(), info.taskNumber(),
+                    info.attempt(), null);
+
+                // Mapper and combiner share the same index.
+                if (ctx.taskInfo().hasMapperIndex())
+                    combineTaskInfo.mapperIndex(ctx.taskInfo().mapperIndex());
+
+                ctx.taskInfo(combineTaskInfo);
 
                 try {
                     runTask(perfCntr);

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractMapReduceTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractMapReduceTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractMapReduceTest.java
index 89005f6..cd997a4 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractMapReduceTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractMapReduceTest.java
@@ -172,6 +172,8 @@ public class HadoopAbstractMapReduceTest extends HadoopAbstractWordCountTest {
      */
     protected final void doTest(IgfsPath inFile, boolean useNewMapper, boolean useNewCombiner, boolean useNewReducer)
         throws Exception {
+        log.info("useNewMapper=" + useNewMapper + ", useNewCombiner=" + useNewCombiner + ", useNewReducer=" + useNewReducer);
+
         igfs.delete(new IgfsPath(PATH_OUTPUT), true);
 
         JobConf jobConf = new JobConf();

http://git-wip-us.apache.org/repos/asf/ignite/blob/d596f02b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceEmbeddedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceEmbeddedSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceEmbeddedSelfTest.java
index 8897a38..bce67f6 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceEmbeddedSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceEmbeddedSelfTest.java
@@ -55,14 +55,14 @@ public class HadoopMapReduceEmbeddedSelfTest extends HadoopMapReduceTest {
         return cfg;
     }
 
-    /*
+    /**
      * @throws Exception If fails.
      */
     public void testMultiReducerWholeMapReduceExecution() throws Exception {
         checkMultiReducerWholeMapReduceExecution(false);
     }
 
-    /*
+    /**
      * @throws Exception If fails.
      */
     public void testMultiReducerWholeMapReduceExecutionStriped() throws Exception {
@@ -100,6 +100,8 @@ public class HadoopMapReduceEmbeddedSelfTest extends HadoopMapReduceTest {
 
             if (striped)
                 jobConf.set(HadoopJobProperty.SHUFFLE_MAPPER_STRIPED_OUTPUT.propertyName(), "true");
+            else
+                jobConf.set(HadoopJobProperty.SHUFFLE_MAPPER_STRIPED_OUTPUT.propertyName(), "false");
 
             jobConf.set(CommonConfigurationKeys.IO_SERIALIZATIONS_KEY, CustomSerialization.class.getName());