GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Unreadable & misleading results when comparing nested objects · Issue #1083 · utPLSQL/utPLSQL

Unreadable & misleading results when comparing nested objects #1083

New issue
Copy link
New issue
Copy link
Closed
#1179
Closed
Unreadable & misleading results when comparing nested objects#1083
#1179
Copy link
Assignees
lwasylow
Labels
bug
Milestone
v3.1.12

Description

@jgebal
jgebal
opened on Jun 21, 2020
Issue body actions

Describe the bug
When comparing nested objects, the report produced is confusing and unreadable.

Provide version info
Information about utPLSQL and Database version,

DB version 18.0.0
utPLSQL v3.1.11.3392-develop

Information about client software
not relevant

To Reproduce
Execute the below script

create or replace type obj as object(
  value varchar2(200)
);
create or replace type obj_lst as table of obj;

create or replace type test_obj as object (
  id number,
  lst obj_lst
);

declare
  l_expected test_obj;
  l_actual   test_obj;
begin
  l_expected := test_obj(1, obj_lst(obj('1'),obj('2'),obj('3'),obj('2')));
  l_actual   := test_obj(1, obj_lst(obj('1'),obj('3'),obj('3'),obj('2')));
  ut.expect(anydata.convertObject(l_actual)).to_equal(anydata.convertObject(l_expected));
end;
/

The output is:

FAILURE
  Actual: ut3_develop.test_obj was expected to equal: ut3_develop.test_obj
  Diff:
  Rows: [ 1 differences ]
    Row No. 1 - Actual:   <LST><OBJ><VALUE>1</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ></LST><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>1</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>1</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ><OBJ><VALUE>1</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ>
    Row No. 1 - Expected: <LST><OBJ><VALUE>1</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ></LST><OBJ><VALUE>1</VALUE></OBJ><OBJ><VALUE>1</VALUE></OBJ><OBJ><VALUE>1</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>3</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ><OBJ><VALUE>2</VALUE></OBJ>
  at "anonymous block", line 7

From looking at the results, it is clear that data is duplicated in the failure report making it impossible to figure out which data element is wrong.
After a bit of formatting on the data we get:

Actual:
      <LST>
        <OBJ><VALUE>1</VALUE></OBJ>
        <OBJ><VALUE>3</VALUE></OBJ>
        <OBJ><VALUE>3</VALUE> </OBJ>
        <OBJ><VALUE>2</VALUE></OBJ>
      </LST>
        <OBJ><VALUE>3</VALUE></OBJ>
        <OBJ><VALUE>2</VALUE></OBJ>
        <OBJ><VALUE>3</VALUE></OBJ>
        <OBJ><VALUE>1</VALUE></OBJ>
        <OBJ><VALUE>3</VALUE></OBJ>
        <OBJ><VALUE>3</VALUE></OBJ>
        <OBJ><VALUE>1</VALUE></OBJ>
        <OBJ><VALUE>2</VALUE></OBJ>
        <OBJ><VALUE>1</VALUE></OBJ>
        <OBJ><VALUE>3</VALUE></OBJ>
        <OBJ><VALUE>3</VALUE></OBJ>

Expected:
    <LST>
      <OBJ><VALUE>1</VALUE></OBJ>
      <OBJ><VALUE>2</VALUE></OBJ>
      <OBJ><VALUE>3</VALUE></OBJ>
      <OBJ><VALUE>2</VALUE></OBJ>
    </LST>
      <OBJ><VALUE>1</VALUE></OBJ>
      <OBJ><VALUE>1</VALUE></OBJ>
      <OBJ><VALUE>1</VALUE></OBJ>
      <OBJ><VALUE>2</VALUE></OBJ>
      <OBJ><VALUE>2</VALUE></OBJ>
      <OBJ><VALUE>2</VALUE></OBJ>
      <OBJ><VALUE>3</VALUE></OBJ>
      <OBJ><VALUE>3</VALUE></OBJ>
      <OBJ><VALUE>2</VALUE></OBJ>
      <OBJ><VALUE>2</VALUE></OBJ>
      <OBJ><VALUE>2</VALUE></OBJ>

It seems like there is a cartesian join of sorts between actual and expected list elements.

Expected behavior

  • Duplicates are not present in the list.
  • Instead of listing the whole list and individual items, only list the individual items that are wrong with full path

So given the above example, we could have results as follows:

FAILURE
  Actual: ut3_develop.test_obj was expected to equal: ut3_develop.test_obj
  Diff:
      Extra:   <LST><OBJ><VALUE>3</VALUE></OBJ></LST>
      Missing: <LST><OBJ><VALUE>2</VALUE></OBJ></LST>
  at "anonymous block", line 7

Reporting DIFF on a complex structure is a challenge, as it is really hard to figure out how much context is needed to make the report useful and when there is too much context, that makes the report unreadable.

In the above case however, the report is definitely not correct as there are duplicated values in the outcomes.

Activity

  1. jgebal
    added
    bug
    on Jun 21, 2020
  2. lwasylow
    self-assigned this
    on Jan 26, 2022
  3. lwasylow
    linked a pull request that will close this issueFeature/1082 failure when comparing nested objects #1179on Jan 26, 2022
  4. lwasylow
    closed this as completedin #1179on Jan 29, 2022
  5. jgebal
    added this to the 3.1.12 milestone on Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lwasylow
    lwasylow

Labels

bug

Type

No type

Projects

No projects

    Milestone

    • v3.1.12

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.