mkou commented on code in PR #3034:
URL: https://github.com/apache/calcite/pull/3034#discussion_r1084652713


##########
core/src/main/java/org/apache/calcite/util/format/FormatModelUtil.java:
##########
@@ -30,44 +32,34 @@ private FormatModelUtil() {}
 
   /**
    * Parses the {@code fmtString} using element identifiers supplied by {@code 
fmtModel}.
-   *
-   * TODO(CALCITE-2980): make this configurable for multiple parse maps. 
Currently this only works
-   * for BigQuery and MySQL style format strings where elements begin with '%'
    */
-  public static List<FormatModelElement> parse(String fmtString,
-      ImmutableMap<String, FormatModelElement> fmtModel) {
-    char ch;
-    int idx = 0;
-    StringBuilder buf = new StringBuilder();
-    Stack elements = new Stack();
-    while (idx < fmtString.length()) {
-      switch (ch = fmtString.charAt(idx)) {
-      case '%':
-        String key = buf.append(fmtString, idx, idx + 2).toString();
-        FormatModelElement element = fmtModel.get(key);
-        if (element == null) {
-          elements.push(new FormatModelElementLiteral(buf.toString()));
-        } else {
-          elements.push(element);
-        }
-        buf.setLength(0);
-        idx += 2;
-        break;
-      default:
-        buf.append(ch);
-        // consume literal elements up to end of string or next '%'
-        while (idx < fmtString.length() - 1) {
-          ch = fmtString.charAt(++idx);
-          if (ch == '%') {
-            --idx;
-            break;
-          }
-          buf.append(ch);
-        }
-        elements.push(new FormatModelElementLiteral(buf.toString()));
-        buf.setLength(0);
-        ++idx;
+  public static List<FormatModelElement> parse(String format,

Review Comment:
   One thing that I realize is missing is the separator that is available in 
some dialects like redshift :/ 



-- 
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: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to