class ZetaSqlUtils {

  public static Value javaObjectToZetaSqlValue(Object object, FieldType fieldType) {
    if (object == null) {
      return Value.createNullValue(beamFieldTypeToZetaSqlType(fieldType));
    }
    switch (fieldType.getTypeName()) {
      case INT64:
        return Value.createInt64Value((Long) object);
        // TODO[BEAM-8630]: Value.createNumericValue() is broken due to a dependency issue
        // case DECIMAL:
        //   return Value.createNumericValue((BigDecimal) object);
      case DOUBLE:
        return Value.createDoubleValue((Double) object);
      case STRING:
        return Value.createStringValue((String) object);
      case DATETIME:
        return jodaInstantToZetaSqlTimestampValue((Instant) object);
      case BOOLEAN:
        return Value.createBoolValue((Boolean) object);
      case BYTES:
        return Value.createBytesValue(ByteString.copyFrom((byte[]) object));
      case ARRAY:
        return javaListToZetaSqlArrayValue(
            (List<Object>) object, fieldType.getCollectionElementType());
      case ROW:
        return beamRowToZetaSqlStructValue((Row) object, fieldType.getRowSchema());
      default:
        throw new UnsupportedOperationException(
            "Unsupported Beam fieldType: " + fieldType.getTypeName());
    }
  }

  private  ZetaSqlUtils();

}