NullPointerEXception

Hello we have a NullPointerException when run query that use ARP custom connector.

For futher reference for others, I think this problem is when wrong mappgin precision in ARP yml

com.dremio.common.exceptions.UserException: NullPointerException

at com.dremio.common.exceptions.UserException$Builder.build(UserException.java:926)

at com.dremio.exec.planner.sql.SqlExceptionHelper.coerceException(SqlExceptionHelper.java:129)

at com.dremio.exec.planner.sql.handlers.query.DataAdditionCmdHandler.getPlan(DataAdditionCmdHandler.java:232)

at com.dremio.exec.planner.sql.handlers.query.CreateTableHandler.doCtas(CreateTableHandler.java:102)

at com.dremio.exec.planner.sql.handlers.query.CreateTableHandler.getPlan(CreateTableHandler.java:70)

at com.dremio.exec.planner.sql.handlers.commands.HandlerToPreparePlanBase.plan(HandlerToPreparePlanBase.java:91)

at com.dremio.exec.work.foreman.AttemptManager.plan(AttemptManager.java:571)

at com.dremio.exec.work.foreman.AttemptManager.lambda$run$4(AttemptManager.java:462)

at com.dremio.service.commandpool.ReleasableBoundCommandPool.lambda$getWrappedCommand$3(ReleasableBoundCommandPool.java:140)

at com.dremio.service.commandpool.CommandWrapper.run(CommandWrapper.java:70)

at com.dremio.context.RequestContext.run(RequestContext.java:96)

at com.dremio.common.concurrent.ContextMigratingExecutorService.lambda$decorate$4(ContextMigratingExecutorService.java:226)

at com.dremio.common.concurrent.ContextMigratingExecutorService$ComparableRunnable.run(ContextMigratingExecutorService.java:206)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

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:750)

Caused by: java.lang.NullPointerException: null

at com.dremio.exec.store.jdbc.dialect.arp.ArpYaml.getCastSpec(ArpYaml.java:140)

at com.dremio.exec.store.jdbc.dialect.arp.ArpDialect.getCastSpec(ArpDialect.java:346)

at com.dremio.exec.store.jdbc.dialect.arp.ArpDialect.supportsFunction(ArpDialect.java:355)

at com.dremio.exec.store.jdbc.rules.JdbcJoinRule.canJoinOnCondition(JdbcJoinRule.java:311)

at com.dremio.exec.store.jdbc.rules.JdbcJoinRule.canJoinOnCondition(JdbcJoinRule.java:278)

at com.dremio.exec.store.jdbc.rules.JdbcJoinRule.canJoinOnCondition(JdbcJoinRule.java:249)

a40f5458-7796-41a2-9718-f82ea4ff27c9.zip (14,0 KB)

Can we see your yaml file? I suspect your mappings are incomplete too.
What template are you working off?

sure, can you show my post please IBM db2 arp connector - #2 by Albert_Vernon
and I think is related too to RuntimeException when planning query

What are the data types for these:
S.NUMERO_TRANSACC
T2.NUM_TRANS_COMISION
S.CUENTA
T2.CUENTA
?

TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE COLUMN_SIZE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_PRECISION_RADIX NUMERIC_SCALE DATETIME_PRECISION INTERVAL_TYPE INTERVAL_PRECISION
DREMIO mupi.MUPI PS_TRANSACCION CUENTA 9 YES INTEGER 32 32 2 0
DREMIO mupi.MUPI PS_TRANSACCION NUM_TRANS_COMISION 31 YES DECIMAL 10 10 10 0
DREMIO mupi.MUPI AH_TRANSACCION CUENTA 1 YES INTEGER 32 32 2 0
DREMIO mupi.MUPI AH_TRANSACCION NUMERO_TRANSACC 2 YES INTEGER 32 32 2 0

PSA: I know very little about APR :slight_smile: however… can you try adding required_cast_args to DECIMAL or add an explicit cast to S.NUMERO_TRANSACC = T2.NUM_TRANS_COMISION?

thank you for your reply.

I’ve already have this.

with explicit cast works well.

But is strange in some cases, in original source we have for example decimal (16,2) but if use CTAs to iceberg using this query, we have DECIMAL(31,2), let me prepare a complete case to share about this case

Why do you have 2 entries for “decimal”?

in the last pic attached is only one entry, If I’m not wrong is how arp maps datatype of “source” and which corresponds to “dremio”

for another example

    - source:
        name: "NUMERIC"
        max_precision: 31
        max_scale: 30
      required_cast_args: "none"
      dremio:
        name: "decimal"