Uploaded image for project: 'Apache MetaModel'
  1. Apache MetaModel
  2. METAMODEL-1160

CsvTable does not deserialize since METAMODEL-7 was fixed

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0.0
    • Labels:
      None

      Description

      Deserializing an old instance of CsvTable into the new class with a List<Column> instead of a Column[] does not work. The change was added as part of METAMODEL-7. We should make the legacy deserializer work so that it can convert the old columns array into a list.

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user kaspersorensen opened a pull request:

          https://github.com/apache/metamodel/pull/157

          METAMODEL-1160: Implemented backwards compatible deserializer

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/kaspersorensen/metamodel METAMODEL-1160

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/metamodel/pull/157.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #157


          commit 73dbe1ce47076f94fafa1123a04a9647808d6f7d
          Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com>
          Date: 2017-08-24T04:23:20Z

          METAMODEL-1160: Implemented backwards compatible deserializer


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user kaspersorensen opened a pull request: https://github.com/apache/metamodel/pull/157 METAMODEL-1160 : Implemented backwards compatible deserializer You can merge this pull request into a Git repository by running: $ git pull https://github.com/kaspersorensen/metamodel METAMODEL-1160 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/metamodel/pull/157.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #157 commit 73dbe1ce47076f94fafa1123a04a9647808d6f7d Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com> Date: 2017-08-24T04:23:20Z METAMODEL-1160 : Implemented backwards compatible deserializer
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user kaspersorensen opened a pull request:

          https://github.com/apache/metamodel/pull/159

          METAMODEL-1160 and METAMODEL-1163: Deserialization of legacy schema objects

          Fixes both METAMODEL-1160 and METAMODEL-1163.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/kaspersorensen/metamodel METAMODEL-1163-deserialize-relationship

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/metamodel/pull/159.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #159


          commit 73dbe1ce47076f94fafa1123a04a9647808d6f7d
          Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com>
          Date: 2017-08-24T04:23:20Z

          METAMODEL-1160: Implemented backwards compatible deserializer

          commit cc709019f287653951f4212b4954edfab4925458
          Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com>
          Date: 2017-08-25T03:13:42Z

          METAMODEL-1163: Added test files w. immutable+mutable serialized schemas

          commit 68eb73380bba869235c7308e11d3e90e6ce9615b
          Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com>
          Date: 2017-08-25T03:28:07Z

          Merge branch 'METAMODEL-1160' into METAMODEL-1163-deserialize-relationship

          commit 0a0bae9367e45025a3824876eb4afbb1eb4374bb
          Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com>
          Date: 2017-08-25T03:37:01Z

          METAMODEL-1163: Fixed


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user kaspersorensen opened a pull request: https://github.com/apache/metamodel/pull/159 METAMODEL-1160 and METAMODEL-1163 : Deserialization of legacy schema objects Fixes both METAMODEL-1160 and METAMODEL-1163 . You can merge this pull request into a Git repository by running: $ git pull https://github.com/kaspersorensen/metamodel METAMODEL-1163 -deserialize-relationship Alternatively you can review and apply these changes as the patch at: https://github.com/apache/metamodel/pull/159.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #159 commit 73dbe1ce47076f94fafa1123a04a9647808d6f7d Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com> Date: 2017-08-24T04:23:20Z METAMODEL-1160 : Implemented backwards compatible deserializer commit cc709019f287653951f4212b4954edfab4925458 Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com> Date: 2017-08-25T03:13:42Z METAMODEL-1163 : Added test files w. immutable+mutable serialized schemas commit 68eb73380bba869235c7308e11d3e90e6ce9615b Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com> Date: 2017-08-25T03:28:07Z Merge branch ' METAMODEL-1160 ' into METAMODEL-1163 -deserialize-relationship commit 0a0bae9367e45025a3824876eb4afbb1eb4374bb Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com> Date: 2017-08-25T03:37:01Z METAMODEL-1163 : Fixed
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user kaspersorensen commented on the issue:

          https://github.com/apache/metamodel/pull/157

          Superceeded by #159

          Show
          githubbot ASF GitHub Bot added a comment - Github user kaspersorensen commented on the issue: https://github.com/apache/metamodel/pull/157 Superceeded by #159
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user kaspersorensen closed the pull request at:

          https://github.com/apache/metamodel/pull/157

          Show
          githubbot ASF GitHub Bot added a comment - Github user kaspersorensen closed the pull request at: https://github.com/apache/metamodel/pull/157
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user LosD commented on the issue:

          https://github.com/apache/metamodel/pull/159

          Not really a readable PR, lots of unnecessary reformatting going on.

          Show
          githubbot ASF GitHub Bot added a comment - Github user LosD commented on the issue: https://github.com/apache/metamodel/pull/159 Not really a readable PR, lots of unnecessary reformatting going on.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user kaspersorensen commented on the issue:

          https://github.com/apache/metamodel/pull/159

          Oh damn, that's a tabs vs spaces thing... The old version of those files seems to have tabs, contrary to our guidelines.

          Is it possible to read if you add the w=1 param like this:
          https://github.com/apache/metamodel/pull/159/files?w=1
          ?

          Or should I reproduce the tabs in those files?

          Show
          githubbot ASF GitHub Bot added a comment - Github user kaspersorensen commented on the issue: https://github.com/apache/metamodel/pull/159 Oh damn, that's a tabs vs spaces thing... The old version of those files seems to have tabs, contrary to our guidelines. Is it possible to read if you add the w=1 param like this: https://github.com/apache/metamodel/pull/159/files?w=1 ? Or should I reproduce the tabs in those files?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user LosD commented on the issue:

          https://github.com/apache/metamodel/pull/159

          I know, but you shouldn't be doing whole-file reformats at all. Even with w=1, there's still big reformats.

          Show
          githubbot ASF GitHub Bot added a comment - Github user LosD commented on the issue: https://github.com/apache/metamodel/pull/159 I know, but you shouldn't be doing whole-file reformats at all. Even with w=1, there's still big reformats.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user LosD commented on the issue:

          https://github.com/apache/metamodel/pull/159

          We can do like we did in DataCleaner: Have one whole project commit that does whole-project reformat. It's still a bit annoying history-wise, but since it will be clearly marked as a reformatting commit, it's easy for anyone to see that they just need to go back one more commit to look for functional changes.

          When it's done in commits like this one, it's really, really annoying to hunt through the history for causes of bugs.

          Show
          githubbot ASF GitHub Bot added a comment - Github user LosD commented on the issue: https://github.com/apache/metamodel/pull/159 We can do like we did in DataCleaner: Have one whole project commit that does whole-project reformat. It's still a bit annoying history-wise, but since it will be clearly marked as a reformatting commit, it's easy for anyone to see that they just need to go back one more commit to look for functional changes. When it's done in commits like this one, it's really, really annoying to hunt through the history for causes of bugs.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user kaspersorensen opened a pull request:

          https://github.com/apache/metamodel/pull/160

          METAMODEL-1160 and METAMODEL-1163: Fixed

          Re-did the same changes as in #159 but this time without all the reformatting of complete classes

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/kaspersorensen/metamodel METAMODEL-1160-and-1163

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/metamodel/pull/160.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #160


          commit eb603e80936af64717f8631c6b5a28c60d32002c
          Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com>
          Date: 2017-08-30T04:37:51Z

          METAMODEL-1160 and METAMODEL-1163: Fixed


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user kaspersorensen opened a pull request: https://github.com/apache/metamodel/pull/160 METAMODEL-1160 and METAMODEL-1163 : Fixed Re-did the same changes as in #159 but this time without all the reformatting of complete classes You can merge this pull request into a Git repository by running: $ git pull https://github.com/kaspersorensen/metamodel METAMODEL-1160 -and-1163 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/metamodel/pull/160.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #160 commit eb603e80936af64717f8631c6b5a28c60d32002c Author: Kasper Sørensen <i.am.kasper.sorensen@gmail.com> Date: 2017-08-30T04:37:51Z METAMODEL-1160 and METAMODEL-1163 : Fixed
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user kaspersorensen commented on the issue:

          https://github.com/apache/metamodel/pull/159

          Superceeded by #160

          Show
          githubbot ASF GitHub Bot added a comment - Github user kaspersorensen commented on the issue: https://github.com/apache/metamodel/pull/159 Superceeded by #160
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user kaspersorensen closed the pull request at:

          https://github.com/apache/metamodel/pull/159

          Show
          githubbot ASF GitHub Bot added a comment - Github user kaspersorensen closed the pull request at: https://github.com/apache/metamodel/pull/159
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user LosD commented on a diff in the pull request:

          https://github.com/apache/metamodel/pull/160#discussion_r135997623

          — Diff: core/src/main/java/org/apache/metamodel/schema/MutableRelationship.java —
          @@ -134,4 +139,17 @@ private MutableRelationship(List<Column> primaryColumns, List<Column> foreignCol
          return _foreignColumns;
          }

          + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
          + final GetField getFields = stream.readFields();
          + Object primaryColumns = getFields.get("_primaryColumns", null);
          + Object foreignColumns = getFields.get("_foreignColumns", null);
          + if (primaryColumns instanceof Column[] && foreignColumns instanceof Column[]) {
          — End diff –

          Are these always tied together, or could one be an array and the other not?

          Show
          githubbot ASF GitHub Bot added a comment - Github user LosD commented on a diff in the pull request: https://github.com/apache/metamodel/pull/160#discussion_r135997623 — Diff: core/src/main/java/org/apache/metamodel/schema/MutableRelationship.java — @@ -134,4 +139,17 @@ private MutableRelationship(List<Column> primaryColumns, List<Column> foreignCol return _foreignColumns; } + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { + final GetField getFields = stream.readFields(); + Object primaryColumns = getFields.get("_primaryColumns", null); + Object foreignColumns = getFields.get("_foreignColumns", null); + if (primaryColumns instanceof Column[] && foreignColumns instanceof Column[]) { — End diff – Are these always tied together, or could one be an array and the other not?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user kaspersorensen commented on a diff in the pull request:

          https://github.com/apache/metamodel/pull/160#discussion_r136374486

          — Diff: core/src/main/java/org/apache/metamodel/schema/MutableRelationship.java —
          @@ -134,4 +139,17 @@ private MutableRelationship(List<Column> primaryColumns, List<Column> foreignCol
          return _foreignColumns;
          }

          + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
          + final GetField getFields = stream.readFields();
          + Object primaryColumns = getFields.get("_primaryColumns", null);
          + Object foreignColumns = getFields.get("_foreignColumns", null);
          + if (primaryColumns instanceof Column[] && foreignColumns instanceof Column[]) {
          — End diff –

          In our history it has only been either-or. Of course someone (slightly crazy) could of course change one of them back to an array and then we'd have an interesting new issue to work on But I argue that the only scenario worth worrying about now is that it's the singular "old class format" where they both where arrays.

          Show
          githubbot ASF GitHub Bot added a comment - Github user kaspersorensen commented on a diff in the pull request: https://github.com/apache/metamodel/pull/160#discussion_r136374486 — Diff: core/src/main/java/org/apache/metamodel/schema/MutableRelationship.java — @@ -134,4 +139,17 @@ private MutableRelationship(List<Column> primaryColumns, List<Column> foreignCol return _foreignColumns; } + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { + final GetField getFields = stream.readFields(); + Object primaryColumns = getFields.get("_primaryColumns", null); + Object foreignColumns = getFields.get("_foreignColumns", null); + if (primaryColumns instanceof Column[] && foreignColumns instanceof Column[]) { — End diff – In our history it has only been either-or. Of course someone (slightly crazy) could of course change one of them back to an array and then we'd have an interesting new issue to work on But I argue that the only scenario worth worrying about now is that it's the singular "old class format" where they both where arrays.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user LosD commented on a diff in the pull request:

          https://github.com/apache/metamodel/pull/160#discussion_r136401855

          — Diff: core/src/main/java/org/apache/metamodel/schema/MutableRelationship.java —
          @@ -134,4 +139,17 @@ private MutableRelationship(List<Column> primaryColumns, List<Column> foreignCol
          return _foreignColumns;
          }

          + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
          + final GetField getFields = stream.readFields();
          + Object primaryColumns = getFields.get("_primaryColumns", null);
          + Object foreignColumns = getFields.get("_foreignColumns", null);
          + if (primaryColumns instanceof Column[] && foreignColumns instanceof Column[]) {
          — End diff –

          In that case, LGTM! I'll merge

          Show
          githubbot ASF GitHub Bot added a comment - Github user LosD commented on a diff in the pull request: https://github.com/apache/metamodel/pull/160#discussion_r136401855 — Diff: core/src/main/java/org/apache/metamodel/schema/MutableRelationship.java — @@ -134,4 +139,17 @@ private MutableRelationship(List<Column> primaryColumns, List<Column> foreignCol return _foreignColumns; } + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { + final GetField getFields = stream.readFields(); + Object primaryColumns = getFields.get("_primaryColumns", null); + Object foreignColumns = getFields.get("_foreignColumns", null); + if (primaryColumns instanceof Column[] && foreignColumns instanceof Column[]) { — End diff – In that case, LGTM! I'll merge
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/metamodel/pull/160

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/metamodel/pull/160

            People

            • Assignee:
              Unassigned
              Reporter:
              kaspersor Kasper Sørensen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development