Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4087

Hoist, a utility to replace literals in a SQL string with placeholders

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.23.0
    • 1.24.0
    • babel
    • None

    Description

      Add "Hoist", a utility to replace literals in a SQL string with placeholders.

      By default it uses Calcite's parser, but you can configure to use different quoting, casing, and also to use a different parser such as Babel for other dialects of SQL.

      It generates a data structure, Hoisted, that contains a map of where the literals occur within the SQL string. The Hoisted.substitute method generates an alternative SQL string, replacing the literals with a custom string.

      It does not call SqlNode.unparse, and therefore does not lose any of the original formatting.

      For more examples, see tests added to SqlParserTest and BabelParserTest.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            julianhyde Julian Hyde
            julianhyde Julian Hyde
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment