Repository: ignite
Updated Branches:
  refs/heads/master 54bac7500 -> 08f965976


IGNITE-5779 - Fixes #3471.

Signed-off-by: Igor Rudyak <igor.rud...@rallyhealth.com>


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

Branch: refs/heads/master
Commit: 08f96597660e57e8b558d57387b1bba3c3889902
Parents: 54bac75
Author: Igor Rudyak <igor.rud...@rallyhealth.com>
Authored: Sun Feb 4 22:06:47 2018 -0800
Committer: Igor Rudyak <igor.rud...@rallyhealth.com>
Committed: Sun Feb 4 22:06:47 2018 -0800

----------------------------------------------------------------------
 .../cache/store/cassandra/CassandraCacheStore.java      |  3 ++-
 .../store/cassandra/common/PropertyMappingHelper.java   |  7 +++----
 .../store/cassandra/session/CassandraSessionImpl.java   |  3 +--
 .../org/apache/ignite/tests/load/PersonGenerator.java   |  2 +-
 .../test/java/org/apache/ignite/tests/pojos/Person.java | 12 ++++++------
 .../org/apache/ignite/tests/pojos/SimplePerson.java     |  8 ++++----
 .../java/org/apache/ignite/tests/utils/TestsHelper.java |  4 ++--
 7 files changed, 19 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/08f96597/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
----------------------------------------------------------------------
diff --git 
a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
 
b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
index b438946..b223cb3 100644
--- 
a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
+++ 
b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
@@ -272,7 +272,8 @@ public class CassandraCacheStore<K, V> implements 
CacheStore<K, V> {
 
                 /** {@inheritDoc} */
                 @Override protected void process(Row row) {
-                    data.put((K)controller.buildKeyObject(row), 
(V)controller.buildValueObject(row));
+                    if (row != null)
+                        data.put((K)controller.buildKeyObject(row), 
(V)controller.buildValueObject(row));
                 }
             }, keys);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/08f96597/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
----------------------------------------------------------------------
diff --git 
a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
 
b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
index 66d7294..ed9f054 100644
--- 
a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
+++ 
b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
@@ -46,8 +46,8 @@ public class PropertyMappingHelper {
         put(String.class, DataType.Name.TEXT);
         put(Integer.class, DataType.Name.INT);
         put(int.class, DataType.Name.INT);
-        put(Short.class, DataType.Name.INT);
-        put(short.class, DataType.Name.INT);
+        put(Short.class, DataType.Name.SMALLINT);
+        put(short.class, DataType.Name.SMALLINT);
         put(Long.class, DataType.Name.BIGINT);
         put(long.class, DataType.Name.BIGINT);
         put(Double.class, DataType.Name.DOUBLE);
@@ -129,7 +129,7 @@ public class PropertyMappingHelper {
             return row.getInt(col);
 
         if (Short.class.equals(clazz) || short.class.equals(clazz))
-            return (short)row.getInt(col);
+            return row.getShort(col);
 
         if (Long.class.equals(clazz) || long.class.equals(clazz))
             return row.getLong(col);
@@ -148,7 +148,6 @@ public class PropertyMappingHelper {
 
         if (PropertyMappingHelper.BYTES_ARRAY_CLASS.equals(clazz)) {
             ByteBuffer buf = row.getBytes(col);
-
             return buf == null ? null : buf.array();
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/08f96597/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/CassandraSessionImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/CassandraSessionImpl.java
 
b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/CassandraSessionImpl.java
index 819120a..4fb0cb2 100644
--- 
a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/CassandraSessionImpl.java
+++ 
b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/CassandraSessionImpl.java
@@ -286,8 +286,7 @@ public class CassandraSessionImpl implements 
CassandraSession {
                         ResultSet resSet = 
futureResult.getValue().getUninterruptibly();
                         Row row = resSet != null && 
resSet.iterator().hasNext() ? resSet.iterator().next() : null;
 
-                        if (row != null)
-                            assistant.process(row, futureResult.getKey());
+                        assistant.process(row, futureResult.getKey());
                     }
                     catch (Throwable e) {
                         if (CassandraHelper.isTableAbsenceError(e))

http://git-wip-us.apache.org/repos/asf/ignite/blob/08f96597/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/PersonGenerator.java
----------------------------------------------------------------------
diff --git 
a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/PersonGenerator.java
 
b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/PersonGenerator.java
index 01c5c77..1ccd44a 100644
--- 
a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/PersonGenerator.java
+++ 
b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/PersonGenerator.java
@@ -38,6 +38,6 @@ public class PersonGenerator implements Generator {
 
     /** {@inheritDoc} */
     @Override public Object generate(long i) {
-        return new Person(i, Long.toString(i), Long.toString(i), (int)(i % 
100), i % 2 == 0, i, i, DATE, PHONES);
+        return new Person(i, Long.toString(i), Long.toString(i), (short)(i % 
100), i % 2 == 0, i, i, DATE, PHONES);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/08f96597/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java
----------------------------------------------------------------------
diff --git 
a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java
 
b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java
index 89d4851..26d80e3 100644
--- 
a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java
+++ 
b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java
@@ -41,7 +41,7 @@ public class Person implements Externalizable {
     private String fullName;
 
     /** */
-    private int age;
+    private short age;
 
     /** */
     private boolean married;
@@ -64,7 +64,7 @@ public class Person implements Externalizable {
     }
 
     /** */
-    public Person(long personNum, String firstName, String lastName, int age, 
boolean married,
+    public Person(long personNum, String firstName, String lastName, short 
age, boolean married,
         long height, float weight, Date birthDate, List<String> phones) {
         this.personNum = personNum;
         this.firstName = firstName;
@@ -83,7 +83,7 @@ public class Person implements Externalizable {
         out.writeLong(personNum);
         out.writeObject(firstName);
         out.writeObject(lastName);
-        out.writeInt(age);
+        out.writeShort(age);
         out.writeBoolean(married);
         out.writeLong(height);
         out.writeFloat(weight);
@@ -97,7 +97,7 @@ public class Person implements Externalizable {
         personNum = in.readLong();
         firstName = (String)in.readObject();
         lastName = (String)in.readObject();
-        age = in.readInt();
+        age = in.readShort();
         married = in.readBoolean();
         height = in.readLong();
         weight = in.readFloat();
@@ -209,13 +209,13 @@ public class Person implements Externalizable {
 
     /** */
     @SuppressWarnings("UnusedDeclaration")
-    public void setAge(int age) {
+    public void setAge(short age) {
         this.age = age;
     }
 
     /** */
     @SuppressWarnings("UnusedDeclaration")
-    public int getAge() {
+    public short getAge() {
         return age;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/08f96597/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/SimplePerson.java
----------------------------------------------------------------------
diff --git 
a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/SimplePerson.java
 
b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/SimplePerson.java
index 0d24ea6..ebe3b6b 100644
--- 
a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/SimplePerson.java
+++ 
b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/SimplePerson.java
@@ -44,7 +44,7 @@ public class SimplePerson implements Externalizable {
 
     /** */
     @QuerySqlField(name = "age")
-    private int age;
+    private short age;
 
     /** */
     @QuerySqlField(name = "married", index = true)
@@ -85,7 +85,7 @@ public class SimplePerson implements Externalizable {
     }
 
     /** */
-    public SimplePerson(long personNum, String firstName, String lastName, int 
age, boolean married,
+    public SimplePerson(long personNum, String firstName, String lastName, 
short age, boolean married,
                         long height, float weight, Date birthDate, 
List<String> phones) {
         this.personNum = personNum;
         this.firstName = firstName;
@@ -104,7 +104,7 @@ public class SimplePerson implements Externalizable {
         out.writeLong(personNum);
         out.writeObject(firstName);
         out.writeObject(lastName);
-        out.writeInt(age);
+        out.writeShort(age);
         out.writeBoolean(married);
         out.writeLong(height);
         out.writeFloat(weight);
@@ -118,7 +118,7 @@ public class SimplePerson implements Externalizable {
         personNum = in.readLong();
         firstName = (String)in.readObject();
         lastName = (String)in.readObject();
-        age = in.readInt();
+        age = in.readShort();
         married = in.readBoolean();
         height = in.readLong();
         weight = in.readFloat();

http://git-wip-us.apache.org/repos/asf/ignite/blob/08f96597/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java
----------------------------------------------------------------------
diff --git 
a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java
 
b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java
index 596ab14..7b6f986 100644
--- 
a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java
+++ 
b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java
@@ -490,7 +490,7 @@ public class TestsHelper {
         for (int i = 0; i < phonesCnt; i++)
             phones.add(randomNumber(4));
 
-        return new SimplePerson(personNum, randomString(4), randomString(4), 
RANDOM.nextInt(100),
+        return new SimplePerson(personNum, randomString(4), randomString(4), 
(short)RANDOM.nextInt(100),
                 RANDOM.nextBoolean(), RANDOM.nextLong(), RANDOM.nextFloat(), 
new Date(), phones);
     }
 
@@ -508,7 +508,7 @@ public class TestsHelper {
         for (int i = 0; i < phonesCnt; i++)
             phones.add(randomNumber(4));
 
-        return new Person(personNum, randomString(4), randomString(4), 
RANDOM.nextInt(100),
+        return new Person(personNum, randomString(4), randomString(4), 
(short)RANDOM.nextInt(100),
             RANDOM.nextBoolean(), RANDOM.nextLong(), RANDOM.nextFloat(), new 
Date(), phones);
     }
 

Reply via email to