apoc icon indicating copy to clipboard operation
apoc copied to clipboard

apoc.meta.data() reports wrong property type information

Open neo-technology-build-agent opened this issue 2 years ago • 3 comments

Issue by moxious Thursday Oct 17, 2019 at 18:50 GMT Originally opened as https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/1319


Replication that worked for me:

create (:A { x: 1 }), (:A { x: 'Foo' });
create (:B { x: 'Foo' }), (:B { x: 'Foo' }), (:B { x: 1 });
CALL apoc.meta.data();

This setup is intentionally to confuse APOC. For both labels A and B, the property X is typed both string and long.

The APOC call:

Screen Shot 2019-10-17 at 2 48 47 PM

This procedure uses a sampling configuration as specified by the config parameters, which is a MetaConfig object. The sampling appears respected, but the property type information stored in the MetaResult class is "last type in wins".

I would say this behavior is incorrect. There are two possible correct behaviors:

  1. Return an array of different types the property could have, as observed in the sample ["Long", "String"]
  2. Perform some type-coercion, and always report "String" as a single property type, because it is the widest of all observed types.