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

SqlSimpleParser inner Tokenizer should not recognize the sql of TokenType.ID or some keywords in some case

    XMLWordPrintableJSON

Details

    Description

      in SqlSimpleParser.Tokenizer#nextToken() lines 401 - 423, is used to recognize the sql of TokenType.ID or some keywords. 

      If a certain segment of characters is continuously composed of Token,the function of this code may be wrong.

       

      E.g :
      (1)select * from a where price> 10.0-–comment

      【10.0-–comment】should be recognize as TokenType.ID("10.0") and TokenType.COMMENT, but it recognize as TokenType.ID("10.0--comment")
      (2)select * from a where column_b='/* this is not comment */'

      【/* this is not comment */】should be recognize as TokenType.SQID("/* this is not comment */"), but it was not

        

      you can see reproduce-demo in https://github.com/wangjie-fourth/calcite-reproduce

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              wangjie_fourth wangjie
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 50m
                  3h 50m