Tan-chenx opened a new issue, #8220:
URL: https://github.com/apache/seatunnel/issues/8220

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   场景1:
   jdbc url 信息指定了currentSchema,非public
   识别出来的字段类型为:"public"."geometry"
   我希望他能正确识别为geometry字段
   `source {
     Jdbc {
        driver = "org.postgresql.Driver"
        url = "jdbc:postgresql://127.0.0.1:5432/seatunnel?currentSchema=test"
        user = "postgres"
        password = "****"
        result_table_name = "t_test_geo_pg"
        query = "select id ,name,geo from t_test_geo"
     }
   }`
   ddl:
   `CREATE TABLE "test"."t_test_geo" (
     "id" int4 NOT NULL,
     "name" varchar(255) COLLATE "pg_catalog"."default",
     "geo" geometry(GEOMETRY),
     CONSTRAINT "t_test_geo_pkey" PRIMARY KEY ("id")
   )
   ;
   
   ALTER TABLE "test"."t_test_geo" 
     OWNER TO "postgres";`
   
   场景2:
   如果jdbc url信息不指定currentSchema,即使用默认的,为public
   我的sql指定schema,能正确解析出geometry类型的字段
   
   ### SeaTunnel Version
   
   2.3.8
   
   ### SeaTunnel Config
   
   ```conf
   env {
     parallelism = 1
     job.mode = "BATCH"
   
   }
   source {
     Jdbc {
        driver = "org.postgresql.Driver"
        url = "jdbc:postgresql://127.0.0.1:5432/seatunnel?currentSchema=test"
        user = "postgres"
        password = "***"
        result_table_name = "t_test_geo_pg"
        query = "select id ,name,geo from t_test_geo"
     }
   }
   
   transform {
   
   }
   
   sink {
     console {
        
     }
   }
   ```
   
   
   ### Running Command
   
   ```shell
   public class SeaTunnelEngineExample {
   
       public static void main(String[] args)
               throws FileNotFoundException, URISyntaxException, 
CommandException {
           String configurePath = args.length > 0 ? args[0] : 
"/examples/test_copy.conf";
           String configFile = getTestConfigFile(configurePath);
           ClientCommandArgs clientCommandArgs = new ClientCommandArgs();
           clientCommandArgs.setConfigFile(configFile);
           clientCommandArgs.setCheckConfig(false);
           
clientCommandArgs.setJobName(Paths.get(configFile).getFileName().toString());
           // Change Execution Mode to CLUSTER to use client mode, before do 
this, you should start
           // SeaTunnelEngineServerExample
           clientCommandArgs.setMasterType(MasterType.LOCAL);
           SeaTunnel.run(clientCommandArgs.buildCommand());
       }
   
       public static String getTestConfigFile(String configFile)
               throws FileNotFoundException, URISyntaxException {
           URL resource = SeaTunnelEngineExample.class.getResource(configFile);
           if (resource == null) {
               throw new FileNotFoundException("Can't find config file: " + 
configFile);
           }
           return Paths.get(resource.toURI()).toString();
       }
   }
   ```
   
   
   ### Error Exception
   
   ```log
   Exception in thread "main" 
org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel 
job executed failed
        at 
org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:213)
        at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
        at 
org.apache.seatunnel.example.engine.SeaTunnelEngineExample.main(SeaTunnelEngineExample.java:48)
   Caused by: org.apache.seatunnel.api.table.factory.FactoryException: 
ErrorCode:[API-06], ErrorDescription:[Factory initialize failed] - Unable to 
create a source for identifier 'Jdbc'.
        at 
org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:101)
        at 
org.apache.seatunnel.engine.core.parse.MultipleTableJobConfigParser.parseSource(MultipleTableJobConfigParser.java:375)
        at 
org.apache.seatunnel.engine.core.parse.MultipleTableJobConfigParser.parse(MultipleTableJobConfigParser.java:209)
        at 
org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment.getLogicalDag(ClientJobExecutionEnvironment.java:114)
        at 
org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment.execute(ClientJobExecutionEnvironment.java:182)
        at 
org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:160)
        ... 2 more
   Caused by: org.apache.seatunnel.common.exception.SeaTunnelRuntimeException: 
ErrorCode:[COMMON-21], ErrorDescription:['Postgres' tables unsupported get 
catalog table,the corresponding field types in the following tables are not 
supported: '{"select id ,name,geo from 
t_test_geo":{"geo":"\"public\".\"geometry\""}}']
        at 
org.apache.seatunnel.common.exception.CommonError.getCatalogTablesWithUnsupportedType(CommonError.java:188)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.utils.JdbcCatalogUtils.getTables(JdbcCatalogUtils.java:116)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.source.JdbcSource.<init>(JdbcSource.java:57)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.source.JdbcSourceFactory.lambda$createSource$0(JdbcSourceFactory.java:80)
        at 
org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:113)
        at 
org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:74)
        ... 7 more
   ```
   
   
   ### Zeta or Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _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: commits-unsubscr...@seatunnel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to