Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-2529

DIH update trouble with sql field name "pk"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 3.1, 3.2
    • 4.0-ALPHA
    • None
    • Debian Lenny, JRE 6

    Description

      We are unable to use the DIH when database columnName primary key is named "pk".

      The reported solr error is :
      "deltaQuery has no column to resolve to declared primary key pk='pk'"

      We have made some investigations and found that the DIH have a mistake when it's looking for the primary key between row's columns list.

      private String findMatchingPkColumn(String pk, Map row) {
      if (row.containsKey(pk))
      throw new IllegalArgumentException(
      String.format("deltaQuery returned a row with null for primary key %s", pk));
      String resolvedPk = null;
      for (String columnName : row.keySet()) {
      if (columnName.endsWith("." + pk) || pk.endsWith("." + columnName))

      { if (resolvedPk != null) throw new IllegalArgumentException( String.format( "deltaQuery has more than one column (%s and %s) that might resolve to declared primary key pk='%s'", resolvedPk, columnName, pk)); resolvedPk = columnName; }

      }
      if (resolvedPk == null)
      throw new IllegalArgumentException(
      String.format("deltaQuery has no column to resolve to declared primary key pk='%s'", pk));
      LOG.info(String.format("Resolving deltaQuery column '%s' to match entity's declared pk '%s'", resolvedPk, pk));
      return resolvedPk;
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            calitom Thomas Gambier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: