コード例 #1
0
ファイル: ComparableVector.java プロジェクト: combineads/tajo
 public boolean equals(Tuple tuple) {
   for (int i = 0; i < keys.length; i++) {
     final int field = keyIndex[i];
     final boolean n1 = keys[i] == null;
     final boolean n2 = tuple.isBlankOrNull(field);
     if (n1 && n2) {
       continue;
     }
     if (n1 ^ n2) {
       return false;
     }
     switch (keyTypes[i]) {
       case BOOLEAN:
         if ((Boolean) keys[i] != tuple.getBool(field)) return false;
         continue;
       case BIT:
         if ((Byte) keys[i] != tuple.getByte(field)) return false;
         continue;
       case INT1:
       case INT2:
         if ((Short) keys[i] != tuple.getInt2(field)) return false;
         continue;
       case INT4:
       case DATE:
         if ((Integer) keys[i] != tuple.getInt4(field)) return false;
         continue;
       case INT8:
       case TIME:
       case TIMESTAMP:
         if ((Long) keys[i] != tuple.getInt8(field)) return false;
         continue;
       case FLOAT4:
         if ((Float) keys[i] != tuple.getFloat4(field)) return false;
         continue;
       case FLOAT8:
         if ((Double) keys[i] != tuple.getFloat8(field)) return false;
         continue;
       case TEXT:
       case CHAR:
       case BLOB:
         if (!Arrays.equals((byte[]) keys[i], tuple.getBytes(field))) return false;
         continue;
       case DATUM:
         if (!keys[i].equals(tuple.asDatum(field))) return false;
         continue;
     }
   }
   return true;
 }
コード例 #2
0
ファイル: ComparableVector.java プロジェクト: combineads/tajo
 public void set(Tuple tuple) {
   for (int i = 0; i < keyTypes.length; i++) {
     final int field = keyIndex[i];
     if (tuple.isBlankOrNull(field)) {
       keys[i] = null;
       continue;
     }
     switch (keyTypes[i]) {
       case BOOLEAN:
         keys[i] = tuple.getBool(field);
         break;
       case BIT:
         keys[i] = tuple.getByte(field);
         break;
       case INT1:
       case INT2:
         keys[i] = tuple.getInt2(field);
         break;
       case INT4:
       case DATE:
         keys[i] = tuple.getInt4(field);
         break;
       case INT8:
       case TIME:
       case TIMESTAMP:
         keys[i] = tuple.getInt8(field);
         break;
       case FLOAT4:
         keys[i] = tuple.getFloat4(field);
         break;
       case FLOAT8:
         keys[i] = tuple.getFloat8(field);
         break;
       case TEXT:
       case CHAR:
       case BLOB:
         keys[i] = tuple.getBytes(field);
         break;
       case DATUM:
         keys[i] = tuple.asDatum(field);
         break;
       default:
         throw new IllegalArgumentException();
     }
   }
 }
コード例 #3
0
ファイル: ComparableVector.java プロジェクト: combineads/tajo
 protected final void set(int index, Tuple tuple, int field) {
   if (tuple.isBlankOrNull(field)) {
     nulls.set(index);
     return;
   }
   nulls.clear(index);
   switch (type) {
     case 0:
       booleans[index] = tuple.getBool(field);
       break;
     case 1:
       bits[index] = tuple.getByte(field);
       break;
     case 2:
       shorts[index] = tuple.getInt2(field);
       break;
     case 3:
       ints[index] = tuple.getInt4(field);
       break;
     case 4:
       longs[index] = tuple.getInt8(field);
       break;
     case 5:
       floats[index] = tuple.getFloat4(field);
       break;
     case 6:
       doubles[index] = tuple.getFloat8(field);
       break;
     case 7:
       bytes[index] = tuple.getBytes(field);
       break;
     case 8:
       ints[index] = tuple.getInt4(field);
       break;
     default:
       throw new IllegalArgumentException();
   }
 }