public AddPartitionResponse handleRequest()

in hms-lambda-handler/src/main/java/com/amazonaws/athena/hms/handler/AddPartitionHandler.java [41:64]


  public AddPartitionResponse handleRequest(AddPartitionRequest request, Context context)
  {
    HiveMetaStoreConf conf = getConf();
    try {
      context.getLogger().log("Connecting to embedded HMS client");
      HiveMetaStoreClient client = getClient();
      context.getLogger().log("Creating partition with desc: " + request.getPartitionDesc());
      TDeserializer deserializer = new TDeserializer(getTProtocolFactory());
      Partition partition = new Partition();
      deserializer.fromString(partition, request.getPartitionDesc());
      Partition resultingPartition = client.add_partition(partition);
      context.getLogger().log("Created partition: " + resultingPartition);
      AddPartitionResponse response = new AddPartitionResponse();
      if (resultingPartition != null) {
        TSerializer serializer = new TSerializer(getTProtocolFactory());
        response.setPartitionDesc(serializer.toString(resultingPartition, StandardCharsets.UTF_8.name()));
      }
      return response;
    }
    catch (Exception e) {
      context.getLogger().log("Exception: " + e.getMessage());
      throw new RuntimeException(e);
    }
  }