geoffreytran opened a new issue, #25998:
URL: https://github.com/apache/doris/issues/25998

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   2.0.1
   
   ### What's Wrong?
   
   2023-10-27 03:07:10,305 WARN (mysql-nio-pool-4|471) 
[StmtExecutor.analyze():982] Analyze failed. stmt[3507, 
b9875ecf9b91472f-8effe66615b3ef21]
   com.google.common.util.concurrent.UncheckedExecutionException: 
java.lang.ArrayIndexOutOfBoundsException: 0
           at 
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2086) 
~[guava-32.1.2-jre.jar:?]
           at com.google.common.cache.LocalCache.get(LocalCache.java:4012) 
~[guava-32.1.2-jre.jar:?]
           at 
com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4035) 
~[guava-32.1.2-jre.jar:?]
           at 
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5013) 
~[guava-32.1.2-jre.jar:?]
           at 
org.apache.doris.datasource.ExternalSchemaCache.getSchema(ExternalSchemaCache.java:90)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.catalog.external.ExternalTable.getFullSchema(ExternalTable.java:232)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.catalog.external.ExternalTable.getBaseSchema(ExternalTable.java:237)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.analysis.SelectStmt.expandStar(SelectStmt.java:1190) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.analysis.SelectStmt.expandStar(SelectStmt.java:1159) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.analysis.SelectStmt.analyze(SelectStmt.java:530) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.StmtExecutor.analyzeAndGenerateQueryPlan(StmtExecutor.java:1056)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.qe.StmtExecutor.analyze(StmtExecutor.java:965) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.StmtExecutor.executeByLegacy(StmtExecutor.java:667) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:453) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:424) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:441) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.ConnectProcessor.dispatch(ConnectProcessor.java:589) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.ConnectProcessor.processOnce(ConnectProcessor.java:829) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.mysql.ReadListener.lambda$handleEvent$0(ReadListener.java:52) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
~[?:1.8.0_342]
           at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
~[?:1.8.0_342]
           at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_342]
   Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
           at 
org.apache.doris.datasource.jdbc.client.JdbcMySQLClient.getColumnsFromJdbc(JdbcMySQLClient.java:181)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.catalog.external.JdbcExternalTable.initSchema(JdbcExternalTable.java:77)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.catalog.external.ExternalTable.initSchemaAndUpdateTime(ExternalTable.java:349)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.datasource.ExternalCatalog.getSchema(ExternalCatalog.java:287) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.datasource.ExternalSchemaCache.loadSchema(ExternalSchemaCache.java:80)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.datasource.ExternalSchemaCache.access$000(ExternalSchemaCache.java:43)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.datasource.ExternalSchemaCache$1.load(ExternalSchemaCache.java:61)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.datasource.ExternalSchemaCache$1.load(ExternalSchemaCache.java:58)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3571)
 ~[guava-32.1.2-jre.jar:?]
           at 
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2313) 
~[guava-32.1.2-jre.jar:?]
           at 
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2190)
 ~[guava-32.1.2-jre.jar:?]
           at 
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2080) 
~[guava-32.1.2-jre.jar:?]
           ... 21 more
   2023-10-27 03:07:10,306 WARN (mysql-nio-pool-4|471) 
[StmtExecutor.executeByLegacy():770] execute Exception. stmt[3507, 
b9875ecf9b91472f-8effe66615b3ef21]
   org.apache.doris.common.AnalysisException: errCode = 2, detailMessage = 
Unexpected exception: java.lang.ArrayIndexOutOfBoundsException: 0
           at org.apache.doris.qe.StmtExecutor.analyze(StmtExecutor.java:983) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.StmtExecutor.executeByLegacy(StmtExecutor.java:667) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:453) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:424) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:441) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.ConnectProcessor.dispatch(ConnectProcessor.java:589) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.ConnectProcessor.processOnce(ConnectProcessor.java:829) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.mysql.ReadListener.lambda$handleEvent$0(ReadListener.java:52) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
~[?:1.8.0_342]
           at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
~[?:1.8.0_342]
           at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_342]
   
   ### What You Expected?
   
   Query should not throw error when a table has a default column value.
   
   For instance, a table with the following default value for created_at will 
throw an exception.
   
   ```sql
   create table if not exists profiles (
       created_at datetime not null default current_timestamp;
   );
   ```
   
   ### How to Reproduce?
   
   On the external mysql catalog db:
   ```
   create database if not exists test;
   use test;
   create table if not exists test_table (
       created_at datetime not null default current_timestamp comment "Created 
at",
       updated_at datetime comment "Updated at"
   );
   
   ```
   
   ```sql
   create catalog `jdbc_mysql` properties (
     "user" = "root",
     "type" = "jdbc",
     "password" = "",
     "jdbc_url" = 
"jdbc:mysql://mysql:3306/test?yearIsDateType=false&tinyInt1isBit=false&transformedBitIsBoolean=true&useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8",
     "driver_url" = 
"https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/jdbc_driver/mysql-connector-java-8.0.25.jar";,
     "driver_class" = "com.mysql.cj.jdbc.Driver"
   );
   
   select * from jdbc_mysql.test.test_table;
   ```
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to