Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aws-glue): fix glue tableArn and integer schema name #2585

Merged
merged 4 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-glue/lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class Schema {
*/
public static readonly integer: Type = {
isPrimitive: true,
inputString: 'integer'
inputString: 'int'
};

/**
Expand Down
6 changes: 5 additions & 1 deletion packages/@aws-cdk/aws-glue/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ export class Table extends Resource implements ITable {
});

this.tableName = tableResource.tableName;
this.tableArn = `${this.database.databaseArn}/${this.tableName}`;
this.tableArn = this.node.stack.formatArn({
service: 'glue',
resource: 'table',
resourceName: Fn.join('', [this.database.databaseName, '/', this.tableName])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a string interpolation (what was previously in tableArn). Why the explicit Fn.Join? Does something break if we do it the other way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't think to use string interpolation. Fixed now.

});
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-glue/test/integ.table.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
{
"Ref": "AWS::AccountId"
},
":database/",
":table/",
{
"Ref": "MyDatabase1E2517DB"
},
Expand Down Expand Up @@ -373,7 +373,7 @@
{
"Ref": "AWS::AccountId"
},
":database/",
":table/",
{
"Ref": "MyDatabase1E2517DB"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-glue/test/test.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export = {
},

'integer type'(test: Test) {
test.equals(Schema.integer.inputString, 'integer');
test.equals(Schema.integer.inputString, 'int');
test.equals(Schema.integer.isPrimitive, true);
test.done();
},
Expand Down Expand Up @@ -167,12 +167,12 @@ export = {
test.done();
},

'map<integer,string>'(test: Test) {
'map<int,string>'(test: Test) {
const type = Schema.map(
Schema.integer,
Schema.string
);
test.equals(type.inputString, 'map<integer,string>');
test.equals(type.inputString, 'map<int,string>');
test.equals(type.isPrimitive, false);
test.done();
},
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-glue/test/test.table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ export = {
{
Ref: "AWS::AccountId"
},
":database/",
":table/",
{
Ref: "DatabaseB269D8BB"
},
Expand Down Expand Up @@ -1201,7 +1201,7 @@ export = {
{
Ref: "AWS::AccountId"
},
":database/",
":table/",
{
Ref: "DatabaseB269D8BB"
},
Expand Down Expand Up @@ -1312,7 +1312,7 @@ export = {
{
Ref: "AWS::AccountId"
},
":database/",
":table/",
{
Ref: "DatabaseB269D8BB"
},
Expand Down