Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 26 additions & 6 deletions forward_engineering/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,23 @@
"exist": false
},
{
"key": "description",
"exist": true
"type": "or",
"values": [
{
"key": "description",
"exist": true
},
{
"key": "refDescription",
"exist": true
}
]
}
]
},
"defaultValue": {
"description": ""
"description": "",
"refDescription": ""
},
"applyToValue": "ignore"
},
Expand All @@ -593,8 +603,17 @@
"exist": false
},
{
"key": "description",
"exist": true
"type": "or",
"values": [
{
"key": "description",
"exist": true
},
{
"key": "refDescription",
"exist": true
}
]
},
{
"type": "not",
Expand All @@ -609,7 +628,8 @@
]
},
"defaultValue": {
"description": ""
"description": "",
"refDescription": ""
},
"applyToValue": "separate"
}
Expand Down
2 changes: 1 addition & 1 deletion forward_engineering/helpers/viewHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function getDefaultColumnList(properties) {
.reduce((columnList, [name, property]) => {
columnList.push({
name: `${prepareName(name)}`,
comment: property.description,
comment: property.refDescription || property.description,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't we consider only refDescription when the column is a reference? For example If you have a table column with some comment, but in your view column (that references table column) you don't want to have a comment. It won't be possible to achieve with this code, because it will assign the description of definition as comment of view column.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's a valid use case.
We took a safe way for this change for now.
We may discuss it separately. It may indeed be better to use only refDescription for references.

isActivated: property.isActivated,
});

Expand Down
5 changes: 1 addition & 4 deletions reverse_engineering/hqlToCollectionsVisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,6 @@ class Visitor extends HiveParserVisitor {
const { table } = this.visitWhenExists(ctx, 'selectStatementWithCTE', {});
const columns = this.visitWhenExists(ctx, 'columnNameCommentList', []);
const jsonSchema = convertColumnsToJsonSchema(columns);
const columnList = columns
.map(column => column.name + (column.comment ? ` COMMENT '${column.comment}'` : ''))
.join(', ');
const columnNames = columns.map(column => column.name).join(', ');
const tableProperties = this.visitWhenExists(ctx, 'tablePropertiesPrefixed');

Expand All @@ -413,7 +410,7 @@ class Visitor extends HiveParserVisitor {
data: {
description,
tableProperties,
columnList,
columnList: '',
},
};
}
Expand Down
Loading