TypeStringEncoder.encode
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.apache.tajo.type.TypeStringEncoder.encode(Showing top 9 results out of 315)

origin: apache/tajo

 @Override
 public String apply(@Nullable Type type) {
  return TypeStringEncoder.encode(type);
 }
}));
origin: apache/tajo

/**
 * Make a string from a field
 * @param field A field
 * @return String representation for a field
 */
static String serializeField(Field field) {
 return field.name().raw(DefaultPolicy()) + " " + encode(field.type());
}
origin: apache/tajo

 @Override
 public JsonElement serialize(org.apache.tajo.type.Type src, Type typeOfSrc, JsonSerializationContext context) {
  JsonObject json = new JsonObject();
  json.addProperty("type", TypeStringEncoder.encode(src));
  return json;
 }
}
origin: apache/tajo

public static String getHiveFieldType(Type type) throws LMDNoMatchedDatatypeException {
 Preconditions.checkNotNull(type);
 switch (type.kind()) {
 case CHAR: return serdeConstants.CHAR_TYPE_NAME;
 case BOOLEAN: return serdeConstants.BOOLEAN_TYPE_NAME;
 case INT1: return serdeConstants.TINYINT_TYPE_NAME;
 case INT2: return serdeConstants.SMALLINT_TYPE_NAME;
 case INT4: return serdeConstants.INT_TYPE_NAME;
 case INT8: return serdeConstants.BIGINT_TYPE_NAME;
 case FLOAT4: return serdeConstants.FLOAT_TYPE_NAME;
 case FLOAT8: return serdeConstants.DOUBLE_TYPE_NAME;
 case TEXT: return serdeConstants.STRING_TYPE_NAME;
 case VARCHAR: return serdeConstants.VARCHAR_TYPE_NAME;
 case NCHAR: return serdeConstants.VARCHAR_TYPE_NAME;
 case NVARCHAR: return serdeConstants.VARCHAR_TYPE_NAME;
 case BINARY: return serdeConstants.BINARY_TYPE_NAME;
 case VARBINARY: return serdeConstants.BINARY_TYPE_NAME;
 case BLOB: return serdeConstants.BINARY_TYPE_NAME;
 case DATE: return serdeConstants.DATE_TYPE_NAME;
 case TIMESTAMP: return serdeConstants.TIMESTAMP_TYPE_NAME;
 default:
  throw new LMDNoMatchedDatatypeException(TypeStringEncoder.encode(type));
 }
}
origin: apache/tajo

  @Override
  public JsonElement serialize(Datum src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject jsonObj = new JsonObject();
    jsonObj.addProperty("type", TypeStringEncoder.encode(src.type()));
  switch (src.kind()) {
  case DATE:
   jsonObj.addProperty("value", src.asInt4());
   break;
  case TIME:
   jsonObj.addProperty("value", src.asInt8());
   break;
  case TIMESTAMP:
   jsonObj.addProperty("value", src.asInt8());
   break;
  case INTERVAL:
   IntervalDatum interval = (IntervalDatum)src;
   jsonObj.addProperty("value", interval.getMonths() + "," + interval.getMilliSeconds());
   break;
  case ANY:
   jsonObj.add("actual", serialize(((AnyDatum) src).getActual(), typeOfSrc, context));
   break;
  default:
   jsonObj.add("body", context.serialize(src));
  }

    return jsonObj;
  }
}
origin: apache/tajo

public static Writable convertDatum2Writable(Datum value) {
 switch(value.kind()) {
  case INT1: return new ByteWritable(value.asByte());
  case INT2: return new ShortWritable(value.asInt2());
  case INT4: return new IntWritable(value.asInt4());
  case INT8: return new LongWritable(value.asInt8());
  case FLOAT4: return new FloatWritable(value.asFloat4());
  case FLOAT8: return new DoubleWritable(value.asFloat8());
  // NOTE: value should be DateDatum
  case DATE: return new DateWritable(value.asInt4() - DateTimeConstants.UNIX_EPOCH_JDATE);
  // NOTE: value should be TimestampDatum
  case TIMESTAMP:
   TimestampWritable result = new TimestampWritable();
   result.setTime(DateTimeUtil.julianTimeToJavaTime(value.asInt8()));
   return result;
  case CHAR: {
   String str = value.asChars();
   return new HiveCharWritable(new HiveChar(str, str.length()));
  }
  case TEXT: return new Text(value.asChars());
  case VARBINARY: return new BytesWritable(value.asByteArray());
  case NULL_TYPE: return null;
 }
 throw new TajoRuntimeException(new NotImplementedException(TypeStringEncoder.encode(value.type())));
}
origin: apache/tajo

pstmt.setString(2, extractSimpleName(columnProto.getName()));
pstmt.setInt(3, position + 1);
pstmt.setString(4, TypeStringEncoder.encode(type));
pstmt.executeUpdate();
origin: apache/tajo

 typeStr = TypeStringEncoder.encode(TypeProtobufEncoder.decode(columnProto.getType()));
} else {
 throw new UndefinedColumnException(alterColumnProto.getOldColumnName());
origin: apache/tajo

pstmt.setString(2, extractSimpleName(col.getName()));
pstmt.setInt(3, i);
pstmt.setString(4, TypeStringEncoder.encode(type));
pstmt.addBatch();
pstmt.clearParameters();
org.apache.tajo.typeTypeStringEncoderencode

Javadoc

Encode a type into a string representation

Popular methods of TypeStringEncoder

  • decode
    Decode a string representation to a Type.
  • createType
  • parseField
    Make a field from a string representation
  • parseList
    Parse a string delimited by comma into a list of object instances depending on itemParser .
  • parseValue
  • serializeField
    Make a string from a field

Popular classes and methods

  • compareTo (BigDecimal)
    Compares this BigDecimal with val. Returns one of the three values 1, 0, or -1. The method behaves a
  • setRequestProperty (URLConnection)
    Sets the value of the specified request header field. The value will only be used by the current URL
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Font (java.awt)
  • Menu (java.awt)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)