import logging


def update_hdfs_prefix_for_libhdfs(model_base_path):
  """
  Update the hdfs path with Java prefix into Libhdfs prefix.
  
  Args:
    model_base_path: The model path which is in local or HDFS.

  Return:
    The new path with Libhdfs prefix.
  """

  if model_base_path.startswith("hdfs:///"):
    # Change "hdfs:///..." to "hdfs://default/..."
    new_model_base_path = model_base_path[:7] + "default" + model_base_path[7:]
    logging.info("Update hdfs prefix from {} to {}".format(
        model_base_path, new_model_base_path))
    return new_model_base_path
  else:
    return model_base_path