deniskuzZ commented on code in PR #6256:
URL: https://github.com/apache/hive/pull/6256#discussion_r2660917922


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/order/AlterTableSetWriteOrderAnalyzer.java:
##########
@@ -56,32 +63,99 @@ protected void analyzeCommand(TableName tableName, 
Map<String, String> partition
     ASTNode orderNode = (ASTNode) command.getChild(0);
     if (orderNode.getType() == HiveParser.TOK_WRITE_LOCALLY_ORDERED_BY_ZORDER) 
{
       // Handle Z-ORDER
-      ASTNode columnListNode = (ASTNode) orderNode.getChild(0);
-      List<String> columnNames = new ArrayList<>();
-      for (int i = 0; i < columnListNode.getChildCount(); i++) {
-        ASTNode child = (ASTNode) columnListNode.getChild(i);
-        columnNames.add(unescapeIdentifier(child.getText()).toLowerCase());
-      }
-
-      if (columnNames.isEmpty()) {
-        throw new SemanticException("Z-order requires at least one column");
-      }
-
-      // Set Z-order properties in table props sort.order=ZORDER and 
sort.columns=col1,col2,...
-      Map<String, String> props = Map.of(
-          "sort.order", "ZORDER",
-          "sort.columns", String.join(",", columnNames)
-      );
-
-      AlterTableSetWriteOrderDesc desc = new 
AlterTableSetWriteOrderDesc(tableName, partitionSpec, props);
-      addInputsOutputsAlterTable(tableName, partitionSpec, desc, 
desc.getType(), false);
-      
-      rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), 
desc)));
+      handleZOrder(tableName, partitionSpec, orderNode);
     } else if (orderNode.getType() == HiveParser.TOK_WRITE_LOCALLY_ORDERED) {
-      // Regular ORDERED BY - to be implemented in future commit
-      throw new SemanticException("Regular ORDERED BY is not yet supported. 
Only ZORDER is supported.");
+      // Handle regular ORDERED BY
+      handleRegularOrder(tableName, partitionSpec, orderNode);

Review Comment:
   `handleNaturalOrder` ?



-- 
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]

Reply via email to