Skip to content

Commit 99e173e

Browse files
Sam Goodwinrix0rrr
Sam Goodwin
authored andcommitted
fix(aws-glue): fix glue tableArn and integer schema name (#2585)
1 parent eb35807 commit 99e173e

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

packages/@aws-cdk/aws-glue/lib/schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class Schema {
7272
*/
7373
public static readonly integer: Type = {
7474
isPrimitive: true,
75-
inputString: 'integer'
75+
inputString: 'int'
7676
};
7777

7878
/**

packages/@aws-cdk/aws-glue/lib/table.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ export class Table extends Resource implements ITable {
179179
*/
180180
public readonly database: IDatabase;
181181

182+
/**
183+
* Indicates whether the table's data is compressed or not.
184+
*/
185+
public readonly compressed: boolean;
186+
182187
/**
183188
* The type of encryption enabled for the table.
184189
*/
@@ -235,6 +240,7 @@ export class Table extends Resource implements ITable {
235240
this.columns = props.columns;
236241
this.partitionKeys = props.partitionKeys;
237242

243+
this.compressed = props.compressed === undefined ? false : props.compressed;
238244
const {bucket, encryption, encryptionKey} = createBucket(this, props);
239245
this.bucket = bucket;
240246
this.encryption = encryption;
@@ -256,7 +262,7 @@ export class Table extends Resource implements ITable {
256262
},
257263
storageDescriptor: {
258264
location: `s3://${this.bucket.bucketName}/${this.s3Prefix}`,
259-
compressed: props.compressed === undefined ? false : props.compressed,
265+
compressed: this.compressed,
260266
storedAsSubDirectories: props.storedAsSubDirectories === undefined ? false : props.storedAsSubDirectories,
261267
columns: renderColumns(props.columns),
262268
inputFormat: props.dataFormat.inputFormat.className,
@@ -271,7 +277,11 @@ export class Table extends Resource implements ITable {
271277
});
272278

273279
this.tableName = tableResource.tableName;
274-
this.tableArn = `${this.database.databaseArn}/${this.tableName}`;
280+
this.tableArn = this.node.stack.formatArn({
281+
service: 'glue',
282+
resource: 'table',
283+
resourceName: `${this.database.databaseName}/${this.tableName}`
284+
});
275285
}
276286

277287
/**

packages/@aws-cdk/aws-glue/test/integ.table.expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@
296296
{
297297
"Ref": "AWS::AccountId"
298298
},
299-
":database/",
299+
":table/",
300300
{
301301
"Ref": "MyDatabase1E2517DB"
302302
},
@@ -373,7 +373,7 @@
373373
{
374374
"Ref": "AWS::AccountId"
375375
},
376-
":database/",
376+
":table/",
377377
{
378378
"Ref": "MyDatabase1E2517DB"
379379
},

packages/@aws-cdk/aws-glue/test/test.schema.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export = {
3434
},
3535

3636
'integer type'(test: Test) {
37-
test.equals(Schema.integer.inputString, 'integer');
37+
test.equals(Schema.integer.inputString, 'int');
3838
test.equals(Schema.integer.isPrimitive, true);
3939
test.done();
4040
},
@@ -167,12 +167,12 @@ export = {
167167
test.done();
168168
},
169169

170-
'map<integer,string>'(test: Test) {
170+
'map<int,string>'(test: Test) {
171171
const type = Schema.map(
172172
Schema.integer,
173173
Schema.string
174174
);
175-
test.equals(type.inputString, 'map<integer,string>');
175+
test.equals(type.inputString, 'map<int,string>');
176176
test.equals(type.isPrimitive, false);
177177
test.done();
178178
},

packages/@aws-cdk/aws-glue/test/test.table.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ export = {
10971097
{
10981098
Ref: "AWS::AccountId"
10991099
},
1100-
":database/",
1100+
":table/",
11011101
{
11021102
Ref: "DatabaseB269D8BB"
11031103
},
@@ -1201,7 +1201,7 @@ export = {
12011201
{
12021202
Ref: "AWS::AccountId"
12031203
},
1204-
":database/",
1204+
":table/",
12051205
{
12061206
Ref: "DatabaseB269D8BB"
12071207
},
@@ -1312,7 +1312,7 @@ export = {
13121312
{
13131313
Ref: "AWS::AccountId"
13141314
},
1315-
":database/",
1315+
":table/",
13161316
{
13171317
Ref: "DatabaseB269D8BB"
13181318
},

0 commit comments

Comments
 (0)