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

Hck 7898 quick win deltalake support new runtime 15 #235

Merged
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"Runtime 11",
"Runtime 12",
"Runtime 13",
"Runtime 14"
"Runtime 14",
"Runtime 15"
]
},
"features": {
Expand Down
2 changes: 1 addition & 1 deletion properties_pane/defaultData.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"model": {
"modelName": "New model",
"dbVersion": "Runtime 14",
"dbVersion": "Runtime 15",
"dbVendor": "Delta Lake"
},
"container": {
Expand Down
295 changes: 295 additions & 0 deletions properties_pane/field_level/fieldLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2930,6 +2930,301 @@ making sure that you maintain a proper JSON format.
]
}
}
],
"variant": [
"name",
"code",
"sampleName",
"schemaId",
"refPath",
{
"propertyName": "Synonym",
"propertyKeyword": "mode",
"propertyType": "select",
"options": ["var"],
"hidden": true
},
{
"propertyName": "Comments",
"propertyKeyword": "description",
"propertyTooltip": "comments",
"addTimestampButton": false,
"propertyType": "details",
"template": "textarea"
},
"type",
{
"propertyName": "Variant type",
"propertyKeyword": "variantType",
"shouldValidate": false,
"propertyTooltip": "Select from list of options",
"propertyType": "select",
"options": ["JSON"],
"dependency": {
"key": "childType",
"value": "variant"
}
},
{
"propertyName": "Subtype",
"propertyKeyword": "subtype",
"propertyType": "select",
"options": [
{ "name": "object", "value": "object" },
{ "name": "array", "value": "array" },
{ "name": "string", "value": "string" },
{ "name": "number", "value": "number" },
{ "name": "boolean", "value": "boolean" },
{ "name": "null", "value": "null" }
],
"dependency": {
"key": "childType",
"value": "variant"
}
},
{
"propertyName": "Not null",
"propertyKeyword": "required",
"enableForReference": true,
"propertyType": "checkbox"
},
{
"propertyName": "Primary key",
"propertyKeyword": "compositePrimaryKey",
"propertyType": "checkbox",
"propertyTooltip": {
"disabled": [
{
"tooltip": "This column is part of the table composite primary key definition. Please refer to this definition if you want more information or to update the Primary Key definition",
"dependency": {
"key": "compositePrimaryKey",
"value": true
}
},
{
"tooltip": "Remove the existing composite primary key definition prior to unlock the possibility to mark this single column as the new primary key for this table",
"dependency": {
"level": "siblings",
"key": "compositePrimaryKey",
"value": true
}
},
{
"tooltip": "Another column has already been selected as primary key. You must unselect it prior to either selecting this column, or creating a compound primary key.",
"dependency": {
"level": "siblings",
"key": "primaryKey",
"value": true
}
}
]
},
"dependency": {
"type": "or",
"values": [
{
"key": "compositePrimaryKey",
"value": true
},
{
"level": "siblings",
"key": "primaryKey",
"value": true
}
]
},
"disabled": true
},
{
"propertyName": "Primary key",
"propertyKeyword": "primaryKey",
"preserveOnCleanDependencies": true,
"enableForReference": true,
"propertyType": "checkbox",
"dependency": {
"type": "and",
"values": [
{
"type": "not",
"values": {
"level": "siblings",
"key": "primaryKey",
"value": true
}
},
{
"type": "or",
"values": [
{
"key": "compositePrimaryKey",
"value": false
},
{
"key": "compositePrimaryKey",
"exist": false
}
]
}
]
}
},
{
"propertyName": "Unique",
"propertyKeyword": "compositeUniqueKey",
"propertyType": "checkbox",
"dependency": {
"key": "compositeUniqueKey",
"value": true
},
"disabled": true
},
{
"propertyName": "Unique",
"propertyKeyword": "unique",
"enableForReference": true,
"propertyType": "checkbox",
"dependency": {
"type": "and",
"values": [
{
"type": "or",
"values": [
{
"key": "compositePrimaryKey",
"value": false
},
{
"key": "compositePrimaryKey",
"exist": false
}
]
},
{
"type": "or",
"values": [
{
"key": "compositeUniqueKey",
"value": false
},
{
"key": "compositeUniqueKey",
"exist": false
}
]
}
]
}
},
{
"propertyName": "Check constraint",
"propertyKeyword": "check",
"propertyType": "details",
"template": "textarea",
"markdown": false
},
{
"propertyName": "Check constraint name",
"propertyKeyword": "checkConstraintName",
"propertyType": "text"
},
{
"propertyName": "Generated as",
"propertyTooltip": "",
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["always", "by default"],
"defaultValue": "always"
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
"propertyType": "details",
"template": "textarea",
"markdown": false
}
]
},
"additionalProperties",
{
"propertyName": "Remarks",
"propertyKeyword": "comments",
"shouldValidate": false,
"propertyTooltip": "remarks",
"addTimestampButton": true,
"propertyType": "details",
"template": "textarea"
},
{
"propertyName": "Column Tags",
"propertyKeyword": "unityColumnTags",
"propertyTooltip": "Contains all the tags that have been applied to the column. Available only in Unity Catalog",
"propertyType": "group",
"groupItemLimit": 20,
"structure": [
{
"propertyName": "Key",
"propertyKeyword": "unityTagKey",
"propertyTooltip": "The key of the tag must be between 1 and 255 UTF-8 characters inclusive, special characters cannot be used in tag names",
"propertyType": "text",
"validation": {
"regex": "^(?=.*?\\d)?(?=.*?[a-zA-Z])?[a-zA-Z\\d]{1,255}$"
}
},
{
"propertyName": "Value",
"propertyKeyword": "unityTagValue",
"propertyTooltip": "The value of the tag.",
"propertyType": "details",
"template": "textarea",
"markdown": false
}
],
"dependency": {
"type": "not",
"values": [
{
"level": "model",
"key": "dbVersion",
"value": "Runtime 6"
},
{
"level": "model",
"key": "dbVersion",
"value": "Runtime 7"
},
{
"level": "model",
"key": "dbVersion",
"value": "Runtime 8"
},
{
"level": "model",
"key": "dbVersion",
"value": "Runtime 9"
},
{
"level": "model",
"key": "dbVersion",
"value": "Runtime 10"
},
{
"level": "model",
"key": "dbVersion",
"value": "Runtime 11"
},
{
"level": "model",
"key": "dbVersion",
"value": "Runtime 12"
}
]
}
}
]
}
}
3 changes: 2 additions & 1 deletion properties_pane/model_level/modelLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ making sure that you maintain a proper JSON format.
"Runtime 11",
"Runtime 12",
"Runtime 13",
"Runtime 14"
"Runtime 14",
"Runtime 15"
]
},
{
Expand Down
17 changes: 12 additions & 5 deletions reverse_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const { parseDDLStatements } = require('./parseDDLStatements');
const { isSupportUnityCatalog } = require('./helpers/databricksHelper');
const unityTagsHelper = require('./helpers/unityTagsHelper');
const { adaptJsonSchema } = require('./adaptJsonSchema');
const { getVariantColumnsWithResolvedSubtype } = require('./helpers/variantPropertiesSubtypeResolveHelper');
const { getPropertiesPotentiallyContainingJSON } = require('./helpers/columnsREHelper');

const DEFAULT_DATABRICKS_CATALOG_NAME = 'hive_metastore';

Expand Down Expand Up @@ -265,12 +267,12 @@ module.exports = {
logger,
);

const columnsOfTypeString = (tableData.properties || []).filter(
property => property.mode === 'string',
const columnsPotentiallyContainingJSON = getPropertiesPotentiallyContainingJSON(
tableData.properties,
);
const hasColumnsOfTypeString = !dependencies.lodash.isEmpty(columnsOfTypeString);
const hasPotentiallyContainingJSONColumns = columnsPotentiallyContainingJSON.length > 0;
let documents = [];
if (hasColumnsOfTypeString) {
if (hasPotentiallyContainingJSONColumns) {
progress({
message: 'Start getting documents from table',
containerName: 'databases',
Expand All @@ -280,10 +282,15 @@ module.exports = {
connectionInfo: connectionData,
dbName,
tableName: table.name,
fields: columnsOfTypeString,
fields: columnsPotentiallyContainingJSON,
recordSamplingSettings: data.recordSamplingSettings,
logger,
});
tableData.schema = getVariantColumnsWithResolvedSubtype({
propertiesSchema: tableData.schema,
documents,
logger,
});
progress({
message: 'Documents retrieved successfully',
containerName: 'databases',
Expand Down
1 change: 1 addition & 0 deletions reverse_engineering/grammars/HiveLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ KW_VARCHAR: V A R C H A R;
KW_ARRAY: A R R A Y;
KW_STRUCT: S T R U C T;
KW_MAP: M A P;
KW_VARIANT: V A R I A N T;
KW_UNIONTYPE: U N I O N T Y P E;
KW_REDUCE: R E D U C E;
KW_PARTITIONED: P A R T I T I O N E D;
Expand Down
1 change: 1 addition & 0 deletions reverse_engineering/grammars/HiveParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,7 @@ primitiveType
| KW_DECIMAL (LPAREN Number (COMMA Number)? RPAREN)?
| KW_VARCHAR LPAREN Number RPAREN
| KW_CHAR LPAREN Number RPAREN
| KW_VARIANT
;

listType
Expand Down
Loading