Baoqi opened a new issue #956:
URL: https://github.com/apache/incubator-kyuubi/issues/956


   ### 1. Describe the bug
   
   I used "kyuubi-tpcds" tool to generate test data.  And the result schema is: 
tpcds_sf1
   
   Then, I use datagrip to connect to kyuubi. Datagrip will not find any tables 
under tpcds_sf1.
   
   This is because a bug in 
src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkOperation.scala , 
function toJavaRegex().
   
   
   The input is:     tpcds\_sf1
   
   and in function
   
   ```
    def toJavaRegex(input: String): String = {
       val res = if (StringUtils.isEmpty(input) || input == "*") {
         "%"
       } else {
         input
       }
       val in = res.toIterator
       val out = new StringBuilder()
   
       while (in.hasNext) {
         in.next match {
           case c if c == '\\' && in.hasNext => 
Pattern.quote(Character.toString(in.next()))
           case c if c == '\\' && !in.hasNext => 
Pattern.quote(Character.toString(c))
           case '_' => out ++= "."
           case '%' => out ++= ".*"
           case c => out ++= Character.toString(c)
         }
       }
       out.result()
     }
   ```
   
   the " case c if c == '\\' && in.hasNext => 
Pattern.quote(Character.toString(in.next()))" line,    the Pattern.quote result 
is just ignored.   So, later, we are querying "tpcdssf1"  as the schema, which 
definitely don't have any tables (which don't exist)
   
   
   
   ### 2. Environments
   
   #### 2.1 Versions
   
   - Kyuubi
     - [ x] 1.1.0
     - [ ] 1.0.3
     - [ ] 0.8.x and earlier <!-- Please update Kyuubi, versions of 0.x are no 
longer supported by the community -->
   
   - Spark
     - [ x] 3.1.x
     - [ ] 3.0.x
     - [ ] 2.4.x and earlier <!-- Please update Spark, versions of 2.x are no 
longer supported by the community -->
   
   #### 2.2 Kyuubi Configurations
   
   #### 2.3 Spark Configurations
   
   
   ### 3. Steps to reproduce
   
   #### 3.1 Operations
   
   #### 3.2 Expected behavior
   
   <!-- A clear and concise description of what you expected to happen. -->
   
   #### 3.3 Actual behavior
   
   ### 4. Additional context
   
   #### 4.1 Log of the server
   
   #### 4.2 Log of the corresponding engine


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


Reply via email to