[ 
https://issues.apache.org/jira/browse/DERBY-6211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-6211:
---------------------------------

    Attachment: derby-6211-07-aa-useSchemaQualifiedNamesInSummaries.diff

Attaching derby-6211-07-aa-useSchemaQualifiedNamesInSummaries.diff. This patch 
makes a couple changes to how object names are presented in xml-based optimizer 
traces.

This patch makes these significant changes:

1) Uses fully qualified (schema + object) names to identify conglomerates and 
table functions in plan summaries.

2) Prefixes table function names with the [ character in order to distinguish 
them from the names of indexes.

3) Fixes some NPEs when tracing queries which involve table functions.

The idea is to produce plan summaries which are complete enough that they can 
be used to specify complete plans via the work to be done on DERBY-6267.

The extra [ character used to distinguish table functions from indexes is 
cryptic, idiosyncratic, and maybe overkill. Moreover, there's only a low risk 
that the name spaces would conflict. But I thought it was better to be cautious 
here. Please let me know if you have another idea for how to distinguish the 
name spaces.

Here are sample plan summaries involving tables, views, and table functions. 
Note that views are replaced with base tables before Derby gets to the 
optimizer.

This query...

  select tablename from v, sys.syscolumns where tablename = columnname

...produces a summary plan like this:

   "SYS"."SYSCOLUMNS_HEAP" # "SYS"."SYSTABLES_INDEX1"

This query...

  select columnname from sys.syscolumns c, table( integerList() ) i where 
c.columnNumber = i.a and i.a < 0 

...produces a summary plan like this:

  "SYS"."SYSCOLUMNS_HEAP" # ["APP"."INTEGERLIST"



Touches the following files:

-------------

M       java/engine/org/apache/derby/impl/sql/compile/TableName.java

Adds a new method which prints a TableName as a schema-qualified, quoted, and 
escaped SQL name.

-------------

M       java/engine/org/apache/derby/impl/sql/compile/XMLOptTrace.java

Makes the changes described above.

                
> Make Optimizer trace logic pluggable.
> -------------------------------------
>
>                 Key: DERBY-6211
>                 URL: https://issues.apache.org/jira/browse/DERBY-6211
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.11.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-6211-01-aa-createPlugin.diff, 
> derby-6211-02-aa-cleanup.diff, derby-6211-02-ab-cleanup.diff, 
> derby-6211-03-aa-customTracer.diff, 
> derby-6211-04-aa-moveOptimizerTracerToEngineJar.diff, 
> derby-6211-05-aa-xmlOptimizerTracer.diff, 
> derby-6211-06-ab-packageProtect-XMLOptTrace.diff, 
> derby-6211-07-aa-useSchemaQualifiedNamesInSummaries.diff
>
>
> Right now the trace logic in the optimizer is hard-coded to produce a stream 
> of diagnostics. It would be good to be able to plug alternative trace logic 
> into the optimizer. This would make the following possible:
> 1) Plug in trace logic which produces formats which are easier to study and 
> which can be analyzed mechanically. E.g., xml formatted output.
> 2) Plug in trace logic which can be used during unit testing to verify that 
> the optimizer has picked the right plan. Over time this might make it easier 
> to migrate canon-based tests to assertion-based tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to