test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/Hive13DdlGeneratorTest.java
test_class.identifier: Hive13DdlGeneratorTest
test_class.superclass: extends AbstractServiceTest
test_case.body: @Test
      public void testGenerateReplaceColumnsStatementErrorValidSchemaColumnPrimitiveDataType()
      {
          BusinessObjectFormatDdlRequest businessObjectFormatDdlRequest = new BusinessObjectFormatDdlRequest();
          businessObjectFormatDdlRequest.setTableName(TABLE_NAME);
          BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper
              .createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION,
                  FORMAT_DOCUMENT_SCHEMA, FORMAT_DOCUMENT_SCHEMA_URL, true, PARTITION_KEY);
          {
              SchemaColumnEntity schemaColumnEntity = new SchemaColumnEntity();
              schemaColumnEntity.setPosition(0);
              schemaColumnEntity.setName("col1");
              schemaColumnEntity.setType("int(25)");
              schemaColumnEntity.setDescription("lorem ipsum");
              businessObjectFormatEntity.getSchemaColumns().add(schemaColumnEntity);
          }
          try
          {
              String actual = hive13DdlGenerator.generateReplaceColumnsStatement(businessObjectFormatDdlRequest, businessObjectFormatEntity);
              Assert.fail("expected IllegalArgumentException, but no exception was thrown");
          }
          catch (Exception e)
          {
              Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass());
              Assert.assertEquals("thrown exception message",
                  "Column \"col1\" has an unsupported data type \"int(25)\" in the schema for business object format {namespace: \"" + NAMESPACE +
                      "\", businessObjectDefinitionName: \"" + BDEF_NAME + "\", businessObjectFormatUsage: \"" + FORMAT_USAGE_CODE +
                      "\", businessObjectFormatFileType: \"" + FORMAT_FILE_TYPE_CODE + "\", businessObjectFormatVersion: " + FORMAT_VERSION +
                      "}. Exception : \"null\"", e.getMessage());
          }
      }
test_case.class_method_signature: Hive13DdlGeneratorTest.testGenerateReplaceColumnsStatementErrorValidSchemaColumnPrimitiveDataType()
test_case.full_signature: @Test public void testGenerateReplaceColumnsStatementErrorValidSchemaColumnPrimitiveDataType()
test_case.identifier: testGenerateReplaceColumnsStatementErrorValidSchemaColumnPrimitiveDataType
test_case.invocations: setTableName createBusinessObjectFormatEntity setPosition setName setType setDescription add getSchemaColumns generateReplaceColumnsStatement fail assertEquals getClass assertEquals getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGenerateReplaceColumnsStatementErrorValidSchemaColumnPrimitiveDataType()
focal_class.declarator: NO_PARTITIONING_PARTITION_KEY = "partition"
focal_class.modifier: public static final
focal_class.original_string: public static final String NO_PARTITIONING_PARTITION_KEY = "partition";
focal_class.type: String
focal_class.var_name: NO_PARTITIONING_PARTITION_KEY
focal_class.declarator: NO_PARTITIONING_PARTITION_VALUE = "none"
focal_class.modifier: public static final
focal_class.original_string: public static final String NO_PARTITIONING_PARTITION_VALUE = "none";
focal_class.type: String
focal_class.var_name: NO_PARTITIONING_PARTITION_VALUE
focal_class.declarator: ORC_HIVE_FILE_FORMAT = "ORC"
focal_class.modifier: public static final
focal_class.original_string: public static final String ORC_HIVE_FILE_FORMAT = "ORC";
focal_class.type: String
focal_class.var_name: ORC_HIVE_FILE_FORMAT
focal_class.declarator: PARQUET_HIVE_FILE_FORMAT = "PARQUET"
focal_class.modifier: public static final
focal_class.original_string: public static final String PARQUET_HIVE_FILE_FORMAT = "PARQUET";
focal_class.type: String
focal_class.var_name: PARQUET_HIVE_FILE_FORMAT
focal_class.declarator: TEXT_HIVE_FILE_FORMAT = "TEXTFILE"
focal_class.modifier: public static final
focal_class.original_string: public static final String TEXT_HIVE_FILE_FORMAT = "TEXTFILE";
focal_class.type: String
focal_class.var_name: TEXT_HIVE_FILE_FORMAT
focal_class.declarator: JSON_HIVE_FILE_FORMAT = "JSONFILE"
focal_class.modifier: public static final
focal_class.original_string: public static final String JSON_HIVE_FILE_FORMAT = "JSONFILE";
focal_class.type: String
focal_class.var_name: JSON_HIVE_FILE_FORMAT
focal_class.declarator: REGEX_S3_EMPTY_PARTITION = "_\\$folder\\$"
focal_class.modifier: public static final
focal_class.original_string: public static final String REGEX_S3_EMPTY_PARTITION = "_\\$folder\\$";
focal_class.type: String
focal_class.var_name: REGEX_S3_EMPTY_PARTITION
focal_class.declarator: HIVE_COMPLEX_DATA_TYPES =
          Arrays.asList(Category.LIST.toString(), Category.MAP.toString(), Category.UNION.toString(), Category.STRUCT.toString())
focal_class.modifier: private static final
focal_class.original_string: private static final List<String> HIVE_COMPLEX_DATA_TYPES =
          Arrays.asList(Category.LIST.toString(), Category.MAP.toString(), Category.UNION.toString(), Category.STRUCT.toString());
focal_class.type: List<String>
focal_class.var_name: HIVE_COMPLEX_DATA_TYPES
focal_class.declarator: businessObjectDataDdlPartitionsHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private BusinessObjectDataDdlPartitionsHelper businessObjectDataDdlPartitionsHelper;
focal_class.type: BusinessObjectDataDdlPartitionsHelper
focal_class.var_name: businessObjectDataDdlPartitionsHelper
focal_class.declarator: businessObjectDataHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private BusinessObjectDataHelper businessObjectDataHelper;
focal_class.type: BusinessObjectDataHelper
focal_class.var_name: businessObjectDataHelper
focal_class.declarator: businessObjectFormatHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private BusinessObjectFormatHelper businessObjectFormatHelper;
focal_class.type: BusinessObjectFormatHelper
focal_class.var_name: businessObjectFormatHelper
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/Hive13DdlGenerator.java
focal_class.identifier: Hive13DdlGenerator
focal_class.class_method_signature: Hive13DdlGenerator.escapeSingleQuotes(String string)
focal_class.full_signature: public String escapeSingleQuotes(String string)
focal_class.identifier: escapeSingleQuotes
focal_class.modifiers: public
focal_class.parameters: (String string)
focal_class.return: String
focal_class.signature: String escapeSingleQuotes(String string)
focal_class.class_method_signature: Hive13DdlGenerator.generateCreateTableDdl(BusinessObjectDataDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity,
          CustomDdlEntity customDdlEntity, List<String> storageNames, List<StorageEntity> requestedStorageEntities,
          Map<String, StorageEntity> cachedStorageEntities, Map<String, String> cachedS3BucketNames)
focal_class.full_signature: @Override public String generateCreateTableDdl(BusinessObjectDataDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity,
          CustomDdlEntity customDdlEntity, List<String> storageNames, List<StorageEntity> requestedStorageEntities,
          Map<String, StorageEntity> cachedStorageEntities, Map<String, String> cachedS3BucketNames)
focal_class.identifier: generateCreateTableDdl
focal_class.modifiers: @Override public
focal_class.parameters: (BusinessObjectDataDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity,
          CustomDdlEntity customDdlEntity, List<String> storageNames, List<StorageEntity> requestedStorageEntities,
          Map<String, StorageEntity> cachedStorageEntities, Map<String, String> cachedS3BucketNames)
focal_class.return: String
focal_class.signature: String generateCreateTableDdl(BusinessObjectDataDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity,
          CustomDdlEntity customDdlEntity, List<String> storageNames, List<StorageEntity> requestedStorageEntities,
          Map<String, StorageEntity> cachedStorageEntities, Map<String, String> cachedS3BucketNames)
focal_class.class_method_signature: Hive13DdlGenerator.generateCreateTableDdl(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity,
          CustomDdlEntity customDdlEntity)
focal_class.full_signature: @Override public String generateCreateTableDdl(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity,
          CustomDdlEntity customDdlEntity)
focal_class.identifier: generateCreateTableDdl
focal_class.modifiers: @Override public
focal_class.parameters: (BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity,
          CustomDdlEntity customDdlEntity)
focal_class.return: String
focal_class.signature: String generateCreateTableDdl(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity,
          CustomDdlEntity customDdlEntity)
focal_class.class_method_signature: Hive13DdlGenerator.generateReplaceColumnsStatement(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.full_signature: @Override public String generateReplaceColumnsStatement(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.identifier: generateReplaceColumnsStatement
focal_class.modifiers: @Override public
focal_class.parameters: (BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.return: String
focal_class.signature: String generateReplaceColumnsStatement(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.class_method_signature: Hive13DdlGenerator.getDdlCharacterValue(String string)
focal_class.full_signature: public String getDdlCharacterValue(String string)
focal_class.identifier: getDdlCharacterValue
focal_class.modifiers: public
focal_class.parameters: (String string)
focal_class.return: String
focal_class.signature: String getDdlCharacterValue(String string)
focal_class.class_method_signature: Hive13DdlGenerator.getDdlCharacterValue(String string, boolean escapeSingleBackslash)
focal_class.full_signature: public String getDdlCharacterValue(String string, boolean escapeSingleBackslash)
focal_class.identifier: getDdlCharacterValue
focal_class.modifiers: public
focal_class.parameters: (String string, boolean escapeSingleBackslash)
focal_class.return: String
focal_class.signature: String getDdlCharacterValue(String string, boolean escapeSingleBackslash)
focal_class.class_method_signature: Hive13DdlGenerator.getDdlOutputFormat()
focal_class.full_signature: @Override public BusinessObjectDataDdlOutputFormatEnum getDdlOutputFormat()
focal_class.identifier: getDdlOutputFormat
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: BusinessObjectDataDdlOutputFormatEnum
focal_class.signature: BusinessObjectDataDdlOutputFormatEnum getDdlOutputFormat()
focal_class.class_method_signature: Hive13DdlGenerator.getHivePartitions(BusinessObjectDataKey businessObjectDataKey, List<SchemaColumn> autoDiscoverableSubPartitionColumns,
          String s3KeyPrefix, Collection<String> storageFiles, String storageName)
focal_class.full_signature: public List<HivePartitionDto> getHivePartitions(BusinessObjectDataKey businessObjectDataKey, List<SchemaColumn> autoDiscoverableSubPartitionColumns,
          String s3KeyPrefix, Collection<String> storageFiles, String storageName)
focal_class.identifier: getHivePartitions
focal_class.modifiers: public
focal_class.parameters: (BusinessObjectDataKey businessObjectDataKey, List<SchemaColumn> autoDiscoverableSubPartitionColumns,
          String s3KeyPrefix, Collection<String> storageFiles, String storageName)
focal_class.return: List<HivePartitionDto>
focal_class.signature: List<HivePartitionDto> getHivePartitions(BusinessObjectDataKey businessObjectDataKey, List<SchemaColumn> autoDiscoverableSubPartitionColumns,
          String s3KeyPrefix, Collection<String> storageFiles, String storageName)
focal_class.class_method_signature: Hive13DdlGenerator.getHivePathPattern(List<SchemaColumn> partitionColumns)
focal_class.full_signature: public Pattern getHivePathPattern(List<SchemaColumn> partitionColumns)
focal_class.identifier: getHivePathPattern
focal_class.modifiers: public
focal_class.parameters: (List<SchemaColumn> partitionColumns)
focal_class.return: Pattern
focal_class.signature: Pattern getHivePathPattern(List<SchemaColumn> partitionColumns)
focal_class.class_method_signature: Hive13DdlGenerator.getHivePathRegex(List<SchemaColumn> partitionColumns)
focal_class.full_signature: public String getHivePathRegex(List<SchemaColumn> partitionColumns)
focal_class.identifier: getHivePathRegex
focal_class.modifiers: public
focal_class.parameters: (List<SchemaColumn> partitionColumns)
focal_class.return: String
focal_class.signature: String getHivePathRegex(List<SchemaColumn> partitionColumns)
focal_class.class_method_signature: Hive13DdlGenerator.assertSchemaColumnsNotEmpty(BusinessObjectFormat businessObjectFormat, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.full_signature: private void assertSchemaColumnsNotEmpty(BusinessObjectFormat businessObjectFormat, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.identifier: assertSchemaColumnsNotEmpty
focal_class.modifiers: private
focal_class.parameters: (BusinessObjectFormat businessObjectFormat, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.return: void
focal_class.signature: void assertSchemaColumnsNotEmpty(BusinessObjectFormat businessObjectFormat, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.class_method_signature: Hive13DdlGenerator.generateCreateTableDdlHelper(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest)
focal_class.full_signature: private String generateCreateTableDdlHelper(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest)
focal_class.identifier: generateCreateTableDdlHelper
focal_class.modifiers: private
focal_class.parameters: (BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest)
focal_class.return: String
focal_class.signature: String generateCreateTableDdlHelper(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest)
focal_class.class_method_signature: Hive13DdlGenerator.generateDdlColumns(BusinessObjectFormatEntity businessObjectFormatEntity, BusinessObjectFormat businessObjectFormat)
focal_class.full_signature: private String generateDdlColumns(BusinessObjectFormatEntity businessObjectFormatEntity, BusinessObjectFormat businessObjectFormat)
focal_class.identifier: generateDdlColumns
focal_class.modifiers: private
focal_class.parameters: (BusinessObjectFormatEntity businessObjectFormatEntity, BusinessObjectFormat businessObjectFormat)
focal_class.return: String
focal_class.signature: String generateDdlColumns(BusinessObjectFormatEntity businessObjectFormatEntity, BusinessObjectFormat businessObjectFormat)
focal_class.class_method_signature: Hive13DdlGenerator.generateStandardBaseDdl(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest, StringBuilder sb,
          BusinessObjectFormat businessObjectFormat, String ifNotExistsOption)
focal_class.full_signature: private void generateStandardBaseDdl(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest, StringBuilder sb,
          BusinessObjectFormat businessObjectFormat, String ifNotExistsOption)
focal_class.identifier: generateStandardBaseDdl
focal_class.modifiers: private
focal_class.parameters: (BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest, StringBuilder sb,
          BusinessObjectFormat businessObjectFormat, String ifNotExistsOption)
focal_class.return: void
focal_class.signature: void generateStandardBaseDdl(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest, StringBuilder sb,
          BusinessObjectFormat businessObjectFormat, String ifNotExistsOption)
focal_class.class_method_signature: Hive13DdlGenerator.getHiveDataType(SchemaColumn schemaColumn, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.full_signature: private String getHiveDataType(SchemaColumn schemaColumn, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.identifier: getHiveDataType
focal_class.modifiers: private
focal_class.parameters: (SchemaColumn schemaColumn, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.return: String
focal_class.signature: String getHiveDataType(SchemaColumn schemaColumn, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.class_method_signature: Hive13DdlGenerator.isHiveComplexDataType(String inputString)
focal_class.full_signature: private boolean isHiveComplexDataType(String inputString)
focal_class.identifier: isHiveComplexDataType
focal_class.modifiers: private
focal_class.parameters: (String inputString)
focal_class.return: boolean
focal_class.signature: boolean isHiveComplexDataType(String inputString)
focal_class.class_method_signature: Hive13DdlGenerator.getHiveFileFormat(BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.full_signature: private String getHiveFileFormat(BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.identifier: getHiveFileFormat
focal_class.modifiers: private
focal_class.parameters: (BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.return: String
focal_class.signature: String getHiveFileFormat(BusinessObjectFormatEntity businessObjectFormatEntity)
focal_class.class_method_signature: Hive13DdlGenerator.processPartitionFiltersForGenerateDdl(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest, StringBuilder sb,
          HashMap<String, String> replacements, BusinessObjectFormat businessObjectFormat, String ifNotExistsOption)
focal_class.full_signature: private void processPartitionFiltersForGenerateDdl(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest, StringBuilder sb,
          HashMap<String, String> replacements, BusinessObjectFormat businessObjectFormat, String ifNotExistsOption)
focal_class.identifier: processPartitionFiltersForGenerateDdl
focal_class.modifiers: private
focal_class.parameters: (BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest, StringBuilder sb,
          HashMap<String, String> replacements, BusinessObjectFormat businessObjectFormat, String ifNotExistsOption)
focal_class.return: void
focal_class.signature: void processPartitionFiltersForGenerateDdl(BusinessObjectDataDdlPartitionsHelper.GenerateDdlRequestWrapper generateDdlRequest, StringBuilder sb,
          HashMap<String, String> replacements, BusinessObjectFormat businessObjectFormat, String ifNotExistsOption)
focal_class.superclass: extends DdlGenerator
focal_method.body: @Override
      public String generateReplaceColumnsStatement(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)
      {
          BusinessObjectFormat businessObjectFormat = businessObjectFormatHelper.createBusinessObjectFormatFromEntity(businessObjectFormatEntity);
  
          assertSchemaColumnsNotEmpty(businessObjectFormat, businessObjectFormatEntity);
  
          StringBuilder builder = new StringBuilder(34);
          builder.append("ALTER TABLE `");
          builder.append(request.getTableName());
          builder.append("` REPLACE COLUMNS (\n");
          builder.append(generateDdlColumns(businessObjectFormatEntity, businessObjectFormat));
          return builder.toString().trim() + ';';
      }
focal_method.class_method_signature: Hive13DdlGenerator.generateReplaceColumnsStatement(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_method.full_signature: @Override public String generateReplaceColumnsStatement(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_method.identifier: generateReplaceColumnsStatement
focal_method.invocations: createBusinessObjectFormatFromEntity assertSchemaColumnsNotEmpty append append getTableName append append generateDdlColumns trim toString
focal_method.modifiers: @Override public
focal_method.parameters: (BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)
focal_method.return: String
focal_method.signature: String generateReplaceColumnsStatement(BusinessObjectFormatDdlRequest request, BusinessObjectFormatEntity businessObjectFormatEntity)