Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade from 429 to 443 introduced java.lang.IllegalArgumentException: Unknown java type class io.trino.spi.block.SqlMap #23632

Open
gw-vastdata opened this issue Oct 1, 2024 · 4 comments
Assignees

Comments

@gw-vastdata
Copy link

gw-vastdata commented Oct 1, 2024

Hi,

TL;DR:

Attempts to insert into a map(map(int, int), int) succeed in Trino 429, but after an upgrade to Trino 443 fail with TrinoQueryError(type=INTERNAL_ERROR, name=GENERIC_INTERNAL_ERROR, message="java.lang.RuntimeException: java.lang.IllegalArgumentException: Unknown java type class io.trino.spi.block.SqlMap", query_id=20240925_153220_01185_qmcms).

Context:

We're developing a vastdb connector and every once in a while we upgrade the supported Trino versions.

After adding support for 443 our tests started failing (only on 443) and the issue seems to originate outside the connector, so we'd be happy to collaborate and fix the issue.

Full trace:

After creating a map(map(int, int), int) table successfully as

CREATE TABLE mytable (
    a MAP(
        MAP(
            INT,
            INT
        ),
        INT
    )
);

the following insertion fails:

INSERT INTO mytable VALUES (
    map(
        array[map(
            array[],
            array[]
        )],
        array[1]
    )
);

with

ERROR:Failed: TrinoQueryError(type=INTERNAL_ERROR, name=GENERIC_INTERNAL_ERROR, message="java.lang.RuntimeException: java.lang.IllegalArgumentException: Unknown java type class io.trino.spi.block.SqlMap", query_id=20240925_153220_01185_qmcms) -> {
    "type": "java.lang.RuntimeException",
    "message": "java.lang.RuntimeException: java.lang.IllegalArgumentException: Unknown java type class io.trino.spi.block.SqlMap",
    "cause": {
        "type": "java.lang.RuntimeException",
        "message": "java.lang.IllegalArgumentException: Unknown java type class io.trino.spi.block.SqlMap",
        "cause": {
            "type": "java.lang.IllegalArgumentException",
            "message": "Unknown java type class io.trino.spi.block.SqlMap",
            "suppressed": [],
            "stack": [
                "io.trino.operator.scalar.MapToMapCast.nullChecker(MapToMapCast.java:193)",
                "io.trino.operator.scalar.MapToMapCast.buildProcessor(MapToMapCast.java:150)",
                "io.trino.operator.scalar.MapToMapCast.specialize(MapToMapCast.java:123)",
                "io.trino.metadata.InternalFunctionBundle.specializeScalarFunction(InternalFunctionBundle.java:143)",
                "io.trino.metadata.InternalFunctionBundle.lambda$getScalarFunctionImplementation$1(InternalFunctionBundle.java:130)",
                "com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4938)",
                "com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3576)",
                "com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2318)",
                "com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2191)",
                "com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2081)",
                "com.google.common.cache.LocalCache.get(LocalCache.java:4019)",
                "com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4933)",
                "com.google.common.cache.ForwardingCache.get(ForwardingCache.java:55)",
                "io.trino.cache.CacheUtils.uncheckedCacheGet(CacheUtils.java:37)",
                "io.trino.metadata.InternalFunctionBundle.getScalarFunctionImplementation(InternalFunctionBundle.java:127)",
                "io.trino.metadata.GlobalFunctionCatalog.getScalarFunctionImplementation(GlobalFunctionCatalog.java:196)",
                "io.trino.metadata.FunctionManager.getScalarFunctionImplementationInternal(FunctionManager.java:110)",
                "io.trino.metadata.FunctionManager.lambda$getScalarFunctionImplementation$0(FunctionManager.java:93)",
                "com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4938)",
                "com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3576)",
                "com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2318)",
                "com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2191)",
                "com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2081)",
                "com.google.common.cache.LocalCache.get(LocalCache.java:4019)",
                "com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4933)",
                "com.google.common.cache.ForwardingCache.get(ForwardingCache.java:55)",
                "io.trino.cache.CacheUtils.uncheckedCacheGet(CacheUtils.java:37)",
                "io.trino.metadata.FunctionManager.getScalarFunctionImplementation(FunctionManager.java:93)",
                "io.trino.sql.InterpretedFunctionInvoker.invoke(InterpretedFunctionInvoker.java:63)",
                "io.trino.sql.planner.IrExpressionInterpreter$Visitor.visitCast(IrExpressionInterpreter.java:853)",
                "io.trino.sql.ir.Cast.accept(Cast.java:66)",
                "io.trino.sql.ir.IrVisitor.process(IrVisitor.java:27)",
                "io.trino.sql.planner.IrExpressionInterpreter$Visitor.processWithExceptionHandling(IrExpressionInterpreter.java:166)",
                "io.trino.sql.planner.IrExpressionInterpreter.optimize(IrExpressionInterpreter.java:146)",
                "io.trino.sql.planner.iterative.rule.SimplifyExpressions.rewrite(SimplifyExpressions.java:46)",
                "io.trino.sql.planner.iterative.rule.SimplifyExpressions.lambda$createRewrite$0(SimplifyExpressions.java:73)",
                "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.lambda$apply$0(ExpressionRewriteRuleSet.java:308)",
                "java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)",
                "java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)",
                "java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)",
                "java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)",
                "java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)",
                "java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)",
                "java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)",
                "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.apply(ExpressionRewriteRuleSet.java:309)",
                "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.apply(ExpressionRewriteRuleSet.java:278)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.transform(IterativeOptimizer.java:216)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.exploreNode(IterativeOptimizer.java:181)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:144)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
                "io.trino.sql.planner.iterative.IterativeOptimizer.optimizeAndMarkPlanChanges(IterativeOptimizer.java:129)",
                "io.trino.sql.planner.optimizations.AdaptivePlanOptimizer.optimize(AdaptivePlanOptimizer.java:33)",
                "io.trino.sql.planner.LogicalPlanner.runOptimizer(LogicalPlanner.java:301)",
                "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:264)",
                "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:236)",
                "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:231)",
                "io.trino.execution.SqlQueryExecution.doPlanQuery(SqlQueryExecution.java:494)",
                "io.trino.execution.SqlQueryExecution.planQuery(SqlQueryExecution.java:474)",
                "io.trino.execution.SqlQueryExecution.start(SqlQueryExecution.java:412)",
                "io.trino.execution.SqlQueryManager.createQuery(SqlQueryManager.java:272)",
                "io.trino.dispatcher.LocalDispatchQuery.startExecution(LocalDispatchQuery.java:145)",
                "io.trino.dispatcher.LocalDispatchQuery.lambda$waitForMinimumWorkers$2(LocalDispatchQuery.java:129)",
                "io.airlift.concurrent.MoreFutures.lambda$addSuccessCallback$12(MoreFutures.java:570)",
                "io.airlift.concurrent.MoreFutures$3.onSuccess(MoreFutures.java:545)",
                "com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1137)",
                "io.trino.$gen.Trino_443____20240925_151856_2.run(Unknown Source)",
                "java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)",
                "java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)",
                "java.base/java.lang.Thread.run(Thread.java:1583)"
            ],
            "errorInfo": {
                "code": 65536,
                "name": "GENERIC_INTERNAL_ERROR",
                "type": "INTERNAL_ERROR"
            }
        },
        "suppressed": [],
        "stack": [
            "io.trino.metadata.InternalFunctionBundle.getScalarFunctionImplementation(InternalFunctionBundle.java:134)",
            "io.trino.metadata.GlobalFunctionCatalog.getScalarFunctionImplementation(GlobalFunctionCatalog.java:196)",
            "io.trino.metadata.FunctionManager.getScalarFunctionImplementationInternal(FunctionManager.java:110)",
            "io.trino.metadata.FunctionManager.lambda$getScalarFunctionImplementation$0(FunctionManager.java:93)",
            "com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4938)",
            "com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3576)",
            "com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2318)",
            "com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2191)",
            "com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2081)",
            "com.google.common.cache.LocalCache.get(LocalCache.java:4019)",
            "com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4933)",
            "com.google.common.cache.ForwardingCache.get(ForwardingCache.java:55)",
            "io.trino.cache.CacheUtils.uncheckedCacheGet(CacheUtils.java:37)",
            "io.trino.metadata.FunctionManager.getScalarFunctionImplementation(FunctionManager.java:93)",
            "io.trino.sql.InterpretedFunctionInvoker.invoke(InterpretedFunctionInvoker.java:63)",
            "io.trino.sql.planner.IrExpressionInterpreter$Visitor.visitCast(IrExpressionInterpreter.java:853)",
            "io.trino.sql.ir.Cast.accept(Cast.java:66)",
            "io.trino.sql.ir.IrVisitor.process(IrVisitor.java:27)",
            "io.trino.sql.planner.IrExpressionInterpreter$Visitor.processWithExceptionHandling(IrExpressionInterpreter.java:166)",
            "io.trino.sql.planner.IrExpressionInterpreter.optimize(IrExpressionInterpreter.java:146)",
            "io.trino.sql.planner.iterative.rule.SimplifyExpressions.rewrite(SimplifyExpressions.java:46)",
            "io.trino.sql.planner.iterative.rule.SimplifyExpressions.lambda$createRewrite$0(SimplifyExpressions.java:73)",
            "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.lambda$apply$0(ExpressionRewriteRuleSet.java:308)",
            "java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)",
            "java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)",
            "java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)",
            "java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)",
            "java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)",
            "java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)",
            "java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)",
            "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.apply(ExpressionRewriteRuleSet.java:309)",
            "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.apply(ExpressionRewriteRuleSet.java:278)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.transform(IterativeOptimizer.java:216)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.exploreNode(IterativeOptimizer.java:181)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:144)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
            "io.trino.sql.planner.iterative.IterativeOptimizer.optimizeAndMarkPlanChanges(IterativeOptimizer.java:129)",
            "io.trino.sql.planner.optimizations.AdaptivePlanOptimizer.optimize(AdaptivePlanOptimizer.java:33)",
            "io.trino.sql.planner.LogicalPlanner.runOptimizer(LogicalPlanner.java:301)",
            "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:264)",
            "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:236)",
            "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:231)",
            "io.trino.execution.SqlQueryExecution.doPlanQuery(SqlQueryExecution.java:494)",
            "io.trino.execution.SqlQueryExecution.planQuery(SqlQueryExecution.java:474)",
            "io.trino.execution.SqlQueryExecution.start(SqlQueryExecution.java:412)",
            "io.trino.execution.SqlQueryManager.createQuery(SqlQueryManager.java:272)",
            "io.trino.dispatcher.LocalDispatchQuery.startExecution(LocalDispatchQuery.java:145)",
            "io.trino.dispatcher.LocalDispatchQuery.lambda$waitForMinimumWorkers$2(LocalDispatchQuery.java:129)",
            "io.airlift.concurrent.MoreFutures.lambda$addSuccessCallback$12(MoreFutures.java:570)",
            "io.airlift.concurrent.MoreFutures$3.onSuccess(MoreFutures.java:545)",
            "com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1137)",
            "io.trino.$gen.Trino_443____20240925_151856_2.run(Unknown Source)",
            "java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)",
            "java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)",
            "java.base/java.lang.Thread.run(Thread.java:1583)"
        ],
        "errorInfo": {
            "code": 65536,
            "name": "GENERIC_INTERNAL_ERROR",
            "type": "INTERNAL_ERROR"
        }
    },
    "suppressed": [],
    "stack": [
        "io.trino.metadata.FunctionManager.getScalarFunctionImplementation(FunctionManager.java:97)",
        "io.trino.sql.InterpretedFunctionInvoker.invoke(InterpretedFunctionInvoker.java:63)",
        "io.trino.sql.planner.IrExpressionInterpreter$Visitor.visitCast(IrExpressionInterpreter.java:853)",
        "io.trino.sql.ir.Cast.accept(Cast.java:66)",
        "io.trino.sql.ir.IrVisitor.process(IrVisitor.java:27)",
        "io.trino.sql.planner.IrExpressionInterpreter$Visitor.processWithExceptionHandling(IrExpressionInterpreter.java:166)",
        "io.trino.sql.planner.IrExpressionInterpreter.optimize(IrExpressionInterpreter.java:146)",
        "io.trino.sql.planner.iterative.rule.SimplifyExpressions.rewrite(SimplifyExpressions.java:46)",
        "io.trino.sql.planner.iterative.rule.SimplifyExpressions.lambda$createRewrite$0(SimplifyExpressions.java:73)",
        "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.lambda$apply$0(ExpressionRewriteRuleSet.java:308)",
        "java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)",
        "java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)",
        "java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)",
        "java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)",
        "java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)",
        "java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)",
        "java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)",
        "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.apply(ExpressionRewriteRuleSet.java:309)",
        "io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet$ValuesExpressionRewrite.apply(ExpressionRewriteRuleSet.java:278)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.transform(IterativeOptimizer.java:216)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.exploreNode(IterativeOptimizer.java:181)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:144)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)",
        "io.trino.sql.planner.iterative.IterativeOptimizer.optimizeAndMarkPlanChanges(IterativeOptimizer.java:129)",
        "io.trino.sql.planner.optimizations.AdaptivePlanOptimizer.optimize(AdaptivePlanOptimizer.java:33)",
        "io.trino.sql.planner.LogicalPlanner.runOptimizer(LogicalPlanner.java:301)",
        "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:264)",
        "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:236)",
        "io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:231)",
        "io.trino.execution.SqlQueryExecution.doPlanQuery(SqlQueryExecution.java:494)",
        "io.trino.execution.SqlQueryExecution.planQuery(SqlQueryExecution.java:474)",
        "io.trino.execution.SqlQueryExecution.start(SqlQueryExecution.java:412)",
        "io.trino.execution.SqlQueryManager.createQuery(SqlQueryManager.java:272)",
        "io.trino.dispatcher.LocalDispatchQuery.startExecution(LocalDispatchQuery.java:145)",
        "io.trino.dispatcher.LocalDispatchQuery.lambda$waitForMinimumWorkers$2(LocalDispatchQuery.java:129)",
        "io.airlift.concurrent.MoreFutures.lambda$addSuccessCallback$12(MoreFutures.java:570)",
        "io.airlift.concurrent.MoreFutures$3.onSuccess(MoreFutures.java:545)",
        "com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1137)",
        "io.trino.$gen.Trino_443____20240925_151856_2.run(Unknown Source)",
        "java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)",
        "java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)",
        "java.base/java.lang.Thread.run(Thread.java:1583)"
    ],
    "errorInfo": {
        "code": 65536,
        "name": "GENERIC_INTERNAL_ERROR",
        "type": "INTERNAL_ERROR"
    }
}
INFO:Killing Trino server

Thanks in advance,
Gilad

@wendigo
Copy link
Contributor

wendigo commented Oct 1, 2024

@gw-vastdata thanks for the report, I can reproduce it locally and I've managed to fix this but I'd like for @martint to chime in. Please note that right now the CLI/JDBC doesn't support maps with maps as keys so this won't work either way.

@gw-vastdata
Copy link
Author

@wendigo Thanks for the incredibly quick reply!

I suspected maps as keys aren't officially supported, but on the other hand it does seem to work in previous versions.

@wendigo
Copy link
Contributor

wendigo commented Oct 1, 2024

yeah, insert will work but the client will fail upon retrieval. This is something that I want to fix with the new JSON v2 serialization (part of #22271)

@gw-vastdata
Copy link
Author

Ahh I see, thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants