deniskuzZ commented on code in PR #6256:
URL: https://github.com/apache/hive/pull/6256#discussion_r2690136437
##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/create/CreateTableAnalyzer.java:
##########
@@ -171,24 +169,7 @@ private boolean hasConstraints(final List<FieldSchema>
partCols, final List<SQLD
}
private String getSortOrderJson(ASTNode ast) {
- List<SortFieldDesc> sortFieldDescList = new ArrayList<>();
- SortFields sortFields = new SortFields(sortFieldDescList);
- for (int i = 0; i < ast.getChildCount(); i++) {
- ASTNode child = (ASTNode) ast.getChild(i);
- SortFieldDesc.SortDirection sortDirection =
- child.getToken().getType() == HiveParser.TOK_TABSORTCOLNAMEDESC ?
SortFieldDesc.SortDirection.DESC
- : SortFieldDesc.SortDirection.ASC;
- child = (ASTNode) child.getChild(0);
- String name =
unescapeIdentifier(child.getChild(0).getText()).toLowerCase();
- NullOrdering nullOrder =
NullOrdering.fromToken(child.getToken().getType());
- sortFieldDescList.add(new SortFieldDesc(name, sortDirection, nullOrder));
- }
- try {
- return JSON_OBJECT_MAPPER.writer().writeValueAsString(sortFields);
- } catch (JsonProcessingException e) {
- LOG.warn("Can not create write order json. ", e);
- return null;
- }
+ return SortOrderUtils.parseSortOrderToJson(ast);
Review Comment:
nice!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]