presto icon indicating copy to clipboard operation
presto copied to clipboard

Fix GroupReferences resolution

Open SergeySmirnov opened this issue 2 years ago • 1 comments

Currently nested group references don't get resolved - this fix addresses this.

Test plan

Tested manually by running tests via QueryRunner and printing out Node Json Plan:

Before the change:
{
  "id" : "155",
  "name" : "LocalExchange",
  "identifier" : "[HASH] (ds)",
  "details" : "",
  "children" : [ {
    "id" : "133",
    "name" : "RemoteStreamingExchange",
    "identifier" : "[REPARTITION]",
    "details" : "",
    "children" : [ {
      "id" : "160",
      "name" : "GroupReference",
      "identifier" : "[6]",
      "details" : "",
      "children" : [ ],
      "remoteSources" : [ ]
    } ],
    "remoteSources" : [ ]
  } ],
  "remoteSources" : [ ]
}

After the change:
{
  "id" : "155",
  "name" : "LocalExchange",
  "identifier" : "[HASH] (ds)",
  "details" : "",
  "children" : [ {
    "id" : "133",
    "name" : "RemoteStreamingExchange",
    "identifier" : "[REPARTITION]",
    "details" : "",
    "children" : [ {
      "id" : "0",
      "name" : "TableScan",
      "identifier" : "[TableHandle {connectorId='prism', connectorHandle='HiveTableHandle{schemaName=tpch, tableName=test_table_rtml_1, analyzePartitionValues=Optional.empty}', layout='Optional[tpch.test_table_rtml_1{}]'}]",
      "details" : "LAYOUT: tpch.test_table_rtml_1{}\nval := val:bigint:0:REGULAR (1:26)\nds := ds:string:-13:PARTITION_KEY (1:26)\n    :: [[\"2022-01-01\"], [\"2022-01-02\"]]\n",
      "children" : [ ],
      "remoteSources" : [ ]
    } ],
    "remoteSources" : [ ]
  } ],
  "remoteSources" : [ ]
}
== NO RELEASE NOTE ==

SergeySmirnov avatar Jun 23 '22 23:06 SergeySmirnov

Can you add a SQL query that produces the issue?

kaikalur avatar Jun 24 '22 17:06 kaikalur