Interface IPhysicalQueryPlanLogger

A physical query plan logger collects operations, which can then be serialized as a query plan to JSON.

interface IPhysicalQueryPlanLogger {
    appendMetadata: (node: any, metadata: any) => void;
    logOperation: (
        logicalOperator: string,
        physicalOperator: undefined | string,
        node: any,
        parentNode: any,
        actor: string,
        metadata: any,
    ) => void;
    stashChildren: (
        node: any,
        filter?: (planNodeFilter: IPlanNode) => boolean,
    ) => void;
    toJson: () => any;
    unstashChild: (node: any, parentNode: any) => void;
}

Implemented by

Properties

appendMetadata: (node: any, metadata: any) => void

Append the given metadata to the given node.

Type declaration

    • (node: any, metadata: any): void
    • Parameters

      • node: any

        The node to add metadata to.

      • metadata: any

        The metadata to add.

      Returns void

logOperation: (
    logicalOperator: string,
    physicalOperator: undefined | string,
    node: any,
    parentNode: any,
    actor: string,
    metadata: any,
) => void

Log an operation.

Important here is that the node and parentNode can be of any type, as long as they properly reference each other in subsequent calls. These node references can be used to build up a hierarchy.

Type declaration

    • (
          logicalOperator: string,
          physicalOperator: undefined | string,
          node: any,
          parentNode: any,
          actor: string,
          metadata: any,
      ): void
    • Parameters

      • logicalOperator: string

        The current logical query operator.

      • physicalOperator: undefined | string

        The current physical query operator. This may be omitted if no physical operator applies.

      • node: any

        The current operation node.

      • parentNode: any

        The parent operation node.

      • actor: string

        The current actor name.

      • metadata: any

        Metadata to include together in the physical query plan output for this node.

      Returns void

stashChildren: (
    node: any,
    filter?: (planNodeFilter: IPlanNode) => boolean,
) => void

Remove all matching children from the given node,

Type declaration

    • (node: any, filter?: (planNodeFilter: IPlanNode) => boolean): void
    • Parameters

      • node: any

        The node to remove children from.

      • Optionalfilter: (planNodeFilter: IPlanNode) => boolean

        The filter to keep children by. If undefined, all children will be removed.

      Returns void

toJson: () => any

Serialize the collected query plan to JSON.

unstashChild: (node: any, parentNode: any) => void

Add the given child to the given parent node.

Type declaration

    • (node: any, parentNode: any): void
    • Parameters

      • node: any

        A node to add to the parent.

      • parentNode: any

        The parent to add to.

      Returns void