shardingsphere
shardingsphere copied to clipboard
Using Sharding-Proxy to create year data type, log throws NPE
Using Sharding-Proxy to create year data type, log throws NPE
Which version of ShardingSphere did you use?
master branch MySQL 5.6,5.7
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
Expected behavior
No exception
Actual behavior
Log throws NPE
Reason analyze (If you can)
Use DataSourceMetaData.getTypeInfo() to return content without year data type
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
-- use proxy
mysql>create table table_date
(
id bigint
primary key,
shard_id bigint not null,
t_date date null,
t_time time null,
t_datetime datetime null,
t_timestamp timestamp null,
t_year year null
);
log throw exception
[ERROR] 2022-01-06 10:12:44.804 [ShardingSphere-Scaling-execute-5] o.a.s.i.m.s.b.l.TableMetaDataLoaderEngine - Dialect load table meta data error
org.apache.shardingsphere.infra.exception.ShardingSphereException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.apache.shardingsphere.infra.metadata.schema.builder.loader.TableMetaDataLoaderEngine.loadByDialect(TableMetaDataLoaderEngine.java:99)
at org.apache.shardingsphere.infra.metadata.schema.builder.loader.TableMetaDataLoaderEngine.load(TableMetaDataLoaderEngine.java:66)
at org.apache.shardingsphere.sharding.metadata.ShardingTableMetaDataBuilder.load(ShardingTableMetaDataBuilder.java:64)
at org.apache.shardingsphere.sharding.metadata.ShardingTableMetaDataBuilder.load(ShardingTableMetaDataBuilder.java:51)
at org.apache.shardingsphere.infra.metadata.schema.builder.TableMetaDataBuilder.load(TableMetaDataBuilder.java:64)
at org.apache.shardingsphere.infra.metadata.schema.loader.SchemaLoader.load(SchemaLoader.java:71)
at org.apache.shardingsphere.mode.manager.memory.MemoryContextManagerBuilder.build(MemoryContextManagerBuilder.java:50)
at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:75)
at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:61)
at org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:77)
at org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:138)
at org.apache.shardingsphere.driver.config.datasource.ShardingSpherePipelineDataSourceCreator.createPipelineDataSource(ShardingSpherePipelineDataSourceCreator.java:43)
at org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSourceFactory.newInstance(PipelineDataSourceFactory.java:42)
at org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSourceManager.getDataSource(PipelineDataSourceManager.java:83)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.write(AbstractImporter.java:97)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.start(AbstractImporter.java:86)
at org.apache.shardingsphere.data.pipeline.api.executor.AbstractLifecycleExecutor.run(AbstractLifecycleExecutor.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.shardingsphere.infra.metadata.schema.builder.loader.TableMetaDataLoaderEngine.loadByDialect(TableMetaDataLoaderEngine.java:93)
... 23 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.MySQLTableMetaDataLoader.loadColumnMetaData(MySQLTableMetaDataLoader.java:102)
at org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.MySQLTableMetaDataLoader.loadColumnMetaDataMap(MySQLTableMetaDataLoader.java:79)
at org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.MySQLTableMetaDataLoader.load(MySQLTableMetaDataLoader.java:60)
at org.apache.shardingsphere.infra.metadata.schema.builder.loader.TableMetaDataLoaderEngine.lambda$loadByDialect$0(TableMetaDataLoaderEngine.java:89)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
... 3 common frames omitted
Example codes for reproduce this issue (such as a github link).
Can I do it;
Can I do it;
Hi @LeeGuoPing , welcome!