private void copyTableSdToPartitionInfoSd(final PartitionInfo partitionInfo, final Table table) { StorageInfo sd = partitionInfo.getSerde(); // // Partitions can be provided in the request without the storage information. // if (sd == null) { sd = new StorageInfo(); partitionInfo.setSerde(sd); } final StorageDescriptor tableSd = table.getSd(); if (StringUtils.isBlank(sd.getInputFormat())) { sd.setInputFormat(tableSd.getInputFormat()); } if (StringUtils.isBlank(sd.getOutputFormat())) { sd.setOutputFormat(tableSd.getOutputFormat()); } if (sd.getParameters() == null || sd.getParameters().isEmpty()) { sd.setParameters(tableSd.getParameters()); } final SerDeInfo tableSerde = tableSd.getSerdeInfo(); if (tableSerde != null) { if (StringUtils.isBlank(sd.getSerializationLib())) { sd.setSerializationLib(tableSerde.getSerializationLib()); } if (sd.getSerdeInfoParameters() == null || sd.getSerdeInfoParameters().isEmpty()) { sd.setSerdeInfoParameters(tableSerde.getParameters()); } } }
/** * Converts from s3 table info to storage info. * @param table table info * @return table info */ StorageInfo toStorageInfo(final Table table) { StorageInfo result = null; final Location location = table.getLocation(); if (location != null) { final Map<String, String> infoParameters = Maps.newHashMap(); result = new StorageInfo(); result.setUri(location.getUri()); final Info info = location.getInfo(); if (info != null) { result.setOwner(info.getOwner()); result.setInputFormat(info.getInputFormat()); result.setOutputFormat(info.getOutputFormat()); result.setSerializationLib(info.getSerializationLib()); if (info.getParameters() != null) { infoParameters.putAll(info.getParameters()); } } result.setSerdeInfoParameters(infoParameters); result.setParameters(Maps.newHashMap()); } return result; }
partitionHolder.getPartitionInfo().setMetadata(partitionParams.get(partitionHolder.getId())); partitionHolder.getPartitionInfo().getSerde() .setParameters(sdParams.get(partitionHolder.getSdId())); partitionHolder.getPartitionInfo().getSerde() .setSerdeInfoParameters(serdeParams.get(partitionHolder.getSerdeId()));
private void copyTableSdToPartitionInfoSd(final PartitionInfo partitionInfo, final Table table) { StorageInfo sd = partitionInfo.getSerde(); // // Partitions can be provided in the request without the storage information. // if (sd == null) { sd = new StorageInfo(); partitionInfo.setSerde(sd); } final StorageDescriptor tableSd = table.getSd(); if (StringUtils.isBlank(sd.getInputFormat())) { sd.setInputFormat(tableSd.getInputFormat()); } if (StringUtils.isBlank(sd.getOutputFormat())) { sd.setOutputFormat(tableSd.getOutputFormat()); } if (sd.getParameters() == null || sd.getParameters().isEmpty()) { sd.setParameters(tableSd.getParameters()); } final SerDeInfo tableSerde = tableSd.getSerdeInfo(); if (tableSerde != null) { if (StringUtils.isBlank(sd.getSerializationLib())) { sd.setSerializationLib(tableSerde.getSerializationLib()); } if (sd.getSerdeInfoParameters() == null || sd.getSerdeInfoParameters().isEmpty()) { sd.setSerdeInfoParameters(tableSerde.getParameters()); } } }
partitionHolder.getPartitionInfo().setMetadata(partitionParams.get(partitionHolder.getId())); partitionHolder.getPartitionInfo().getSerde() .setParameters(sdParams.get(partitionHolder.getSdId())); partitionHolder.getPartitionInfo().getSerde() .setSerdeInfoParameters(serdeParams.get(partitionHolder.getSerdeId()));
if (existingPartitionHolder.getPartition() != null) { final Partition existingPartition = existingPartitionHolder.getPartition(); partitionInfo.getSerde().setParameters(existingPartition.getParameters()); partitionInfo.getAudit().setCreatedDate( HiveConnectorInfoConverter.epochSecondsToDate(existingPartition.getCreateTime())); if (existingPartitionInfo.getSerde() != null) { partitionInfo.getSerde() .setParameters(existingPartitionInfo.getSerde().getParameters());
if (existingPartitionHolder.getPartition() != null) { final Partition existingPartition = existingPartitionHolder.getPartition(); partitionInfo.getSerde().setParameters(existingPartition.getParameters()); partitionInfo.getAudit().setCreatedDate( HiveConnectorInfoConverter.epochSecondsToDate(existingPartition.getCreateTime())); if (existingPartitionInfo.getSerde() != null) { partitionInfo.getSerde() .setParameters(existingPartitionInfo.getSerde().getParameters());