其他分享
首页 > 其他分享> > dremio udf 参考调用处理

dremio udf 参考调用处理

作者:互联网

以下是基于arthas 生成的调用,可以参考学习使用

参考调用

[arthas@1]$ stack  com.dremio.exec.planner.sql.handlers.direct.CreateFunctionHandler toResult
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 451 ms, listenerId: 1
ts=2022-07-16 04:20:32;thread_name=1d2dc36e-ae2d-f425-5c22-0de4ae1afd00/0:foreman-planning;id=ea;is_daemon=true;priority=10;TCCL=jdk.internal.loader.ClassLoaders$AppClassLoader@42110406
    @com.dremio.exec.planner.sql.handlers.direct.CreateFunctionHandler.toResult()
        at com.dremio.exec.planner.sql.handlers.commands.DirectCommand.plan(DirectCommand.java:61)
        at com.dremio.exec.work.foreman.AttemptManager.plan(AttemptManager.java:500)
        at com.dremio.exec.work.foreman.AttemptManager.lambda$run$4(AttemptManager.java:392)
        at com.dremio.service.commandpool.ReleasableBoundCommandPool.lambda$getWrappedCommand$3(ReleasableBoundCommandPool.java:138)
        at com.dremio.service.commandpool.CommandWrapper.run(CommandWrapper.java:62)
        at com.jprofiler.agent.callee.RunnableTracking.run(ejt:19)
        at com.dremio.context.RequestContext.run(RequestContext.java:95)
        at com.dremio.common.concurrent.ContextMigratingExecutorService.lambda$decorate$3(ContextMigratingExecutorService.java:199)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(null:1128)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.lang.Thread.run(null:829)
   

参数

watch com.dremio.exec.planner.sql.handlers.direct.CreateFunctionHandler toResult  '{params, target, returnObj, throwExp}' -x 3 -v
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 265 ms, listenerId: 3
Condition express: null , result: true
method=com.dremio.exec.planner.sql.handlers.direct.CreateFunctionHandler.toResult location=AtExit
ts=2022-07-16 04:23:08; [cost=8.931868ms] result=@ArrayList[
    @Object[][
        @String[CREATE FUNCTION multiply4 (x INT, y INT) RETURNS INT RETURN SELECT x * y\n],
        @SqlCreateFunction[
            name=@SqlIdentifier[multiply4],
            fieldList=@SqlNodeList[(`x`, INTEGER), (`y`, INTEGER)],
            expression=@SqlSelect[SELECT `x` * `y`],
            returnType=@SqlComplexDataTypeSpec[INTEGER],
            shouldReplace=@Boolean[false],
            ifNotExists=@Boolean[false],
            OPERATOR=@[CREATE_FUNCTION],
            EMPTY_ARRAY=@SqlNode[][isEmpty=true;size=0],
            pos=@SqlParserPos[line 1, column 1],
        ],
    ],
    @CreateFunctionHandler[
        logger=@Logger[
            serialVersionUID=@Long[5454405123156820674],
            FQCN=@String[ch.qos.logback.classic.Logger],
            name=@String[com.dremio.exec.planner.sql.handlers.direct.CreateFunctionHandler],
            level=null,
            effectiveLevelInt=@Integer[20000],
            parent=@Logger[Logger[com.dremio.exec.planner.sql.handlers.direct]],
            childrenList=null,
            aai=null,
            additive=@Boolean[true],
            loggerContext=@LoggerContext[ch.qos.logback.classic.LoggerContext[default]],
        ],
        TYPE_FACTORY=@SqlTypeFactoryImpl[
            INSTANCE=@SqlTypeFactoryImpl[com.dremio.exec.planner.types.SqlTypeFactoryImpl@9bd31c5],
            $assertionsDisabled=@Boolean[true],
            CACHE=@LocalLoadingCache[com.google.common.cache.LocalCache$LocalLoadingCache@347010f2],
            CLASS_FAMILIES=@RegularImmutableMap[isEmpty=false;size=19],
            typeSystem=@RelDataTypeSystemImpl[com.dremio.exec.planner.types.RelDataTypeSystemImpl@4abf290c],
            $assertionsDisabled=@Boolean[true],
        ],
        REX_BUILDER=@DremioRexBuilder[
            Utf8SqlCollation=@SqlCollation[COLLATE UTF-8$en_US$primary],
            GET_OPERATOR=@SqlSpecialOperator[_get],
            TO_INPUT_REF=@[org.apache.calcite.rex.RexBuilder$1@6058b5a4],
            typeFactory=@SqlTypeFactoryImpl[com.dremio.exec.planner.types.SqlTypeFactoryImpl@9bd31c5],
            booleanTrue=@RexLiteral[true],
            booleanFalse=@RexLiteral[false],
            charEmpty=@RexLiteral[''],
            constantNull=@RexLiteral[null],
            opTab=@SqlStdOperatorTable[org.apache.calcite.sql.fun.SqlStdOperatorTable@17c598a2],
            $assertionsDisabled=@Boolean[true],
        ],
        DUPLICATE_PARAMETER_ERROR_MSG=@String[Parameter name %s appears more than once],
        context=@QueryContext[
            sabotContext=@SabotContext[com.dremio.exec.server.SabotContext@57bdf517],
            session=@UserSession[com.dremio.sabot.rpc.user.UserSession@5daba2a],
            queryId=@QueryId[part1: 2102550813345871732
part2: 7096703444235905536
],
            optionManager=@OptionManagerWrapper[com.dremio.exec.server.options.OptionManagerWrapper@5de7b32a],
            queryOptionManager=@QueryOptionManager[com.dremio.exec.server.options.QueryOptionManager@78b7d8a7],
            executionControls=@ExecutionControls[com.dremio.exec.testing.ExecutionControls@401a9feb],
            plannerSettings=@PlannerSettings[com.dremio.exec.planner.physical.PlannerSettings@10417628],
            table=@OperatorTable[com.dremio.exec.planner.sql.OperatorTable@705fe9e9],
            queryContextInfo=@QueryContextInformation[query_start_time: 1657945388307
time_zone: 569
default_schema_name: ""
priority {
  workload_class: GENERAL
}
query_max_allocation: 9223372036854775807
last_query_id {
  part1: 2102551179292064433
  part2: 3807247139625131264
}
],
            contextInformation=@ContextInformationImpl[com.dremio.sabot.exec.context.ContextInformationImpl@366b75a5],
            allocator=@ChildAllocator[Allocator(query-planning:1d2dc2d3-2fb0-7774-627c-8e2ebdf8ea00) 0/0/0/268435456 (res/actual/peak/limit)
],
            bufferManager=@BufferManagerImpl[com.dremio.sabot.exec.context.BufferManagerImpl@221a5144],
            catalog=@CachingCatalog[com.dremio.exec.catalog.CachingCatalog@39f18319],
            substitutionProviderFactory=@DremioSubstitutionProviderFactory[com.dremio.exec.planner.acceleration.substitution.DremioSubstitutionProviderFactory@366e256f],
            functionImplementationRegistry=@DecimalFunctionImplementationRegistry[com.dremio.exec.expr.fn.DecimalFunctionImplementationRegistry@7e3e77c2],
            groupResourceInformation=@ClusterResourceInformation[com.dremio.resource.ClusterResourceInformation@1a37ddc6],
            constantValueHolderCache=@HashMap[isEmpty=true;size=0],
            survivingRowCountsWithPruneFilter=@HashMap[isEmpty=true;size=0],
            survivingFileCountsWithPruneFilter=@HashMap[isEmpty=true;size=0],
            nextErrorContextId=@Integer[0],
            errorContexts=@ArrayList[isEmpty=true;size=0],
            queryPriority=@QueryPriority[workload_class: GENERAL
],
            datasetValidityChecker=@[Predicates.alwaysTrue()],
            workloadType=@WorkloadType[JDBC],
            relMetadataQuerySupplier=@DremioRelMetadataQuery$$Lambda$385/0x00000008007cf440[com.dremio.exec.planner.cost.DremioRelMetadataQuery$$Lambda$385/0x00000008007cf440@5bc5b85a],
            closed=@Boolean[false],
            planCache=@PlanCache[com.dremio.exec.planner.PlanCache@2b255217],
            queryRequiresGroupsInfo=@Boolean[false],
            $assertionsDisabled=@Boolean[true],
        ],
    ],
    @SingletonList[
        @SimpleCommandResult[
            ok=@Boolean[true],
            summary=@String[Function, multiply4, is created.],
        ],
    ],
    null,
]

参考资料

https://docs.dremio.com/software/security/rbac/row-column-policies-udf/
https://docs.dremio.com/software/sql-reference/sql-commands/functions/
sabot/kernel/src/main/java/com/dremio/exec/planner/sql/parser/SqlAlterTableAddRowAccessPolicy.java

标签:dremio,调用,java,exec,true,planner,udf,com
来源: https://www.cnblogs.com/rongfengliang/p/16483897.html