|
7 | 7 | commentDeactivatedInlineKeys, |
8 | 8 | removeRedundantTrailingCommaFromStatement, |
9 | 9 | encodeStringLiteral, |
| 10 | + stripParentheses, |
10 | 11 | } = require('./generalHelper'); |
11 | 12 | const { getColumnsStatement, getColumnStatementParts, getColumns } = require('./columnHelper'); |
12 | 13 | const keyHelper = require('./keyHelper'); |
@@ -65,7 +66,7 @@ const getCreateStatement = ({ |
65 | 66 | )(skewedStatement, skewedStatement)(rowFormatStatement, `ROW FORMAT ${rowFormatStatement}`)( |
66 | 67 | storedAsStatement, |
67 | 68 | storedAsStatement, |
68 | | - )(location, `LOCATION "${location}"`)(tableProperties, `TBLPROPERTIES ${tableProperties}`)( |
| 69 | + )(location, `LOCATION "${location}"`)(tableProperties, `TBLPROPERTIES (${tableProperties})`)( |
69 | 70 | selectStatement, |
70 | 71 | `AS ${selectStatement}`, |
71 | 72 | )(true, ';')(); |
@@ -166,13 +167,6 @@ const removePartitions = (columns, partitions) => { |
166 | 167 | ); |
167 | 168 | }; |
168 | 169 |
|
169 | | -const prepareTableProperties = (tableProperties = '') => { |
170 | | - const regex = /^\((?<properties>[\s\S]*)\)$/; |
171 | | - const match = regex.exec(tableProperties); |
172 | | - const properties = match?.groups.properties || ''; |
173 | | - return properties.trim() ? tableProperties : ''; |
174 | | -}; |
175 | | - |
176 | 170 | const getSkewedKeyStatement = (skewedKeys, skewedOn, asDirectories, deactivatedColumnNames, isParentItemActivated) => { |
177 | 171 | const getStatement = keysString => |
178 | 172 | `SKEWED BY (${keysString}) ON ${skewedOn} ${asDirectories ? 'STORED AS DIRECTORIES' : ''}`; |
@@ -289,7 +283,7 @@ const getTableStatement = ( |
289 | 283 | rowFormatStatement: getRowFormat(tableData), |
290 | 284 | storedAsStatement: getStoredAsStatement(tableData), |
291 | 285 | location: tableData.location, |
292 | | - tableProperties: prepareTableProperties(tableData.tableProperties), |
| 286 | + tableProperties: stripParentheses(tableData.tableProperties), |
293 | 287 | selectStatement: '', |
294 | 288 | isActivated: isTableActivated, |
295 | 289 | ifNotExist: tableData.ifNotExist, |
|
0 commit comments