Skip to content

Conversation

@AyeshaFirdausTG
Copy link
Contributor

No description provided.

.NULL Value Ingestion
+
The `INSERT INTO` statement supports inserting `NULL` values for attributes defined as `NULLABLE` in the schema.
* `NULL` or `null` can be used in the `VALUES` clause to insert a NULL value.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `NULL` or `null` can be used in the `VALUES` clause to insert a NULL value.
* Either `NULL` or `null` can be used in the `VALUES` clause to represent a NULL value.

The optional _name_ which follows the first two (id) values is to specify the source vertex type and target vertex type, if the edge type had been defined with wildcard vertex types.
+
.NULL Value Ingestion
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section does not seem to be in the right place on this page.
You have it as a continuation of the section on " two options for specifying the attributes of the vertex or edge type for the values provided:" But NULLABLE is about the command in general, not about these two options.

I have more to say on this, which I will write in a separate note.

----
ADD VERTEX Vertex_Type_Name ( PRIMARY_ID id_name id_type
[, attribute_name type [DEFAULT default_value] ]* )
[, attribute_name type [NULLABLE][DEFAULT default_value] ]* )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax detail is correct, but there is another section on the page that needs to same treatment.
Besides the ADD VERTEX/EDGE section, there is an analogous
ADD VERTEX/EDGE (global) section.
https://docs.tigergraph.com/gsql-ref/4.2/ddl-and-loading/modifying-a-graph-schema#_add_vertex_edge_global

]
----

==== Loading NULL during creation of loading job
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would modify and reduce the scope of this section.
There are basically 3 ways to end up with NULL in the loaded data:

  1. Because NULL (including empty fields) was in the input data.

That is already covered in the section above.

  1. Because the loading job has an explicit value (NULL) instead of making a reference (e.g. $1) to a source file.

This can happen with any data type (explicit INT, explicit BOOLEAN, ...), so there does not seem to be a reason to make an exception for NULL.

  1. Because the loading job uses an underscore "_" to skip an attribute.

This is discussed but not that clearly, and NULL changes the odd behavior, so we should write about this.

We might want a section called "Omitted Fields and Default Values".
Here we would:

  • Talk about omitted fields in CSV, JSON, and loading job "destination clauses": if they are legal and how they are interpreted. If legal, then the default value is used.
  • Explain the rules for default values.
    ** Depends if the particular vertex or edge type defined a custom default value for that attribute
    ** Depends on whether the attribute is NULLABLE or not

Comment on lines +123 to +126
[NOTE]
====
Primitive data types used as attributes of a vertex or edge, can be set to `NULL`.
====
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this a new (brief) section on Null Values, not a Note.

  • If an attribute is defined as NULLABLE, then its value can be NULL, in addition to its characteristic values
  • explain what it means if an attribute is null
  • explain how to format null in as an input

** Keys and Values cannot be `NULL`.
====

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all of this belongs in a special note:

  • LIST, SET, MAP can be assigned NULL as an attribute

This is just following the standard rule that any attribute that is NULLABLE can have null. No special treatment.

** Elements inside LIST or SET cannot be NULL.

This does deserve being in a NOTE because this is where TigerGraph's support is not as complete as it is in some other products.

  • For MAP:
    ** Keys and Values cannot be NULL

I would just lump this together with LIST and SET.

** NULL is different from [NULL, NULL] or {NULL}.

From a technical standpoint, this is not saying anything that isn't already said in the preceding rules. It's usefulness is as an example, not an additional rule.

MyList = NULL // This is setting the entire list to null. Supported.
MyList = [NULL] // This is creating a list with one element whose value is null. Not supported.

<1> File path specified at compile time.
<2> Run-time specification will override path specified at compile time.

=== Loading NULL Values
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have sections that talk about how to load each type of data. It is called "Attributes and attribute expressions", with a subsection for each data type.
I would move this section there, and follow the format used there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants