jiangxt2 commented on code in PR #12016:
URL: https://github.com/apache/gravitino/pull/12016#discussion_r3819514975
##########
catalogs-contrib/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operations/ClickHouseTableOperations.java:
##########
@@ -1376,23 +1376,174 @@ Transform[] parsePartitioning(String partitionKey) {
return ClickHouseTableSqlUtils.parsePartitioning(partitionKey);
}
+ /**
+ * Strips PROJECTION definition blocks from a {@code SHOW CREATE TABLE} DDL
string so that
+ * internal {@code ORDER BY} / {@code PARTITION BY} clauses inside
projection bodies are not
+ * mistaken for the table-level sort key or partitioning expression.
+ *
+ * <p>A projection block has the form {@code PROJECTION name ( SELECT ... )}
and sits inside the
+ * column-definition body of the DDL. This method removes every such block
including the optional
+ * trailing comma, while preserving string literals and respecting nested
parentheses.
+ *
+ * @param createSql raw {@code SHOW CREATE TABLE} output
+ * @return the DDL with all PROJECTION blocks removed, or the original
string if none are found
+ */
+ @VisibleForTesting
+ String stripProjections(String createSql) {
Review Comment:
Implemented in 78e2a1c4f using an exact prepared query for sorting_key and
engine_full, filtered by both database and table name. A missing or invisible
row now throws NoSuchTableException. I kept this separate from
getTableProperties() because that existing method filters only by table name;
broader metadata consolidation is tracked separately.
--
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]