-
Notifications
You must be signed in to change notification settings - Fork 29
DOC-2200 supporting null val #308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.3.0-dev
Are you sure you want to change the base?
Conversation
| .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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * `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 |
There was a problem hiding this comment.
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] ]* ) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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:
- Because NULL (including empty fields) was in the input data.
That is already covered in the section above.
- 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.
- 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
| [NOTE] | ||
| ==== | ||
| Primitive data types used as attributes of a vertex or edge, can be set to `NULL`. | ||
| ==== |
There was a problem hiding this comment.
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`. | ||
| ==== | ||
|
|
There was a problem hiding this comment.
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,MAPcan be assignedNULLas an attribute
This is just following the standard rule that any attribute that is NULLABLE can have null. No special treatment.
** Elements inside
LISTorSETcannot beNULL.
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 beNULL
I would just lump this together with LIST and SET.
**
NULLis 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 |
There was a problem hiding this comment.
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.
No description provided.