I am using the Java V1 API to automate my dataset creation using an S3 bucket with a JSON data source. I am able to upload a dataset when I use a PhysicalTableMap only, but when I incorporate data transforms to cast columns from String to Decimal or DateTime via a Logical Table Map, I receive an error on upload. Details:
// Physical Table ID
String physicalTableId = physicalTable.toString();
LogicalTableSource logicalTableSource = new LogicalTableSource().withPhysicalTableId(physicalTableId);
// Create collection of data transforms
ArrayList<TransformOperation> dataTransforms = new ArrayList<>();
// Column 2 to Decimal
CastColumnTypeOperation castColumn2 = new CastColumnTypeOperation().withColumnName("Column.2").withNewColumnType(ColumnDataType.DECIMAL);
TransformOperation column2Transform = new TransformOperation().withCastColumnTypeOperation(castColumn2);
dataTransforms.add(column2Transform);
// Column 4 to DateTime
CastColumnTypeOperation castColumn4 = new CastColumnTypeOperation().withColumnName("Column.4").withNewColumnType(ColumnDataType.DATETIME);
TransformOperation column4Transform = new TransformOperation().withCastColumnTypeOperation(castColumn4);
dataTransforms.add(column4Transform);
// Create logical table with transformations
LogicalTable logicalTable = new LogicalTable().withAlias(tableAlias).withSource(logicalTableSource).withDataTransforms(dataTransforms);
// Create logical table map
Map<String,LogicalTable> logicalTableMap = new HashMap<String,LogicalTable>();
logicalTableMap.put("LogicalTableMap",logicalTable);
// Create data set using column cast transforms
CreateDataSetRequest createDataSetRequest = new CreateDataSetRequest()
.withAwsAccountId(awsAccountId)
.withDataSetId(dataSetId)
.withName(name)
.withPhysicalTableMap(physicalTableMap)
.withLogicalTableMap(logicalTableMap)
.withImportMode(DataSetImportMode.SPICE)
.withPermissions(permissions);
getClient().createDataSet(createDataSetRequest);
I receive the following error: Exception in thread “main” com.amazonaws.AmazonServiceException: Unable to unmarshall exception response with the unmarshallers provided (Service: AmazonQuickSight; Status Code: 400; Error Code: ValidationException; Request ID: ----; Proxy: null)
Again, if I remove “.withLogicalTableMap(logicalTableMap)” from my code, this will upload my data as a String dataset without errors. How can I modify my code for a successful data transform and upload?