Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5713

Doing joins on tables that share column names in a JDBC store returns incorrect results

    XMLWordPrintableJSON

Details

    Description

      If there are two tables in Postgres that share column names, incorrect results are returned when a join is done between the two tables.

      For example if we have two tables: categories and categories2 with the following contents:

      +----------------+--------------------++---------------
      |categoryguid|categoryparentguid|categoryname|
      
      +----------------+--------------------++---------------
      |id1|null|restaurants|
      |null|id1|food&Dining|
      |id2|null|Coffee Shops|
      |null|id2|food&Dining|
      
      +----------------+--------------------++---------------
      

      Then the following join query returns incorrectly names columns and incorrect null values:



      select cat.categoryname, cat2.categoryname from postgres.public.categories cat join postgres.public.categories2 cat2 on (cat.categoryguid = cat2.categoryguid) where cat.categoryguid IS NOT NULL;
      
      +----------------+---------------+
      |categoryname|categoryname0|
      
      +----------------+---------------+
      |restaurants|null|
      |Coffee Shops|null|
      
      +----------------+---------------+
      

      Attachments

        Activity

          People

            timothyfarkas Timothy Farkas
            timothyfarkas Timothy Farkas
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: