diff --git a/pages/advanced-algorithms/available-algorithms/date.mdx b/pages/advanced-algorithms/available-algorithms/date.mdx index f035f519..26a8c615 100644 --- a/pages/advanced-algorithms/available-algorithms/date.mdx +++ b/pages/advanced-algorithms/available-algorithms/date.mdx @@ -37,7 +37,7 @@ Memgraph for managing time-based data. ### `format()` Returns a string representation of time value using the specified unit, -specified format, and specified timezone. +specified format, and specified time zone. {

Input:

} diff --git a/pages/advanced-algorithms/available-algorithms/temporal.mdx b/pages/advanced-algorithms/available-algorithms/temporal.mdx index 01c9a908..ed57c314 100644 --- a/pages/advanced-algorithms/available-algorithms/temporal.mdx +++ b/pages/advanced-algorithms/available-algorithms/temporal.mdx @@ -37,7 +37,7 @@ The procedure formats a temporal value. {

Input:

} -- `temporal: Any` ➡ A temporal value (date, time, local datetime, duration) that needs to be formatted. +- `temporal: Any` ➡ A temporal value (date, time, datetime, duration) that needs to be formatted. - `format: str` ➡ The wanted format. The parameter supports values defined under [Python strftime format codes](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes). {

Output:

} diff --git a/pages/data-migration/migrate-from-neo4j.mdx b/pages/data-migration/migrate-from-neo4j.mdx index 02df36a9..95a59e0d 100644 --- a/pages/data-migration/migrate-from-neo4j.mdx +++ b/pages/data-migration/migrate-from-neo4j.mdx @@ -101,10 +101,11 @@ MATCH (manager:Employee {employeeID: column.ReportsTo}) MERGE (employee)-[:REPORTS_TO]->(manager); ``` -When migrating a particular dataset, be aware of the differences between Neo4j -and [Memgraph data types](/fundamentals/data-types). For example, Memgraph -doesn’t yet support the `POINT` spatial type, but you can represent it as a -map with the appropriate properties. +If you are going to use different dataset to migrate, be aware of the +differences between Neo4j and [Memgraph data +types](/fundamentals/data-types) (for example, Memgraph doesn't support +`DateTime()` as there is no temporal type in Memgraph that supports timezones yet, +but you can modify data to use `localDateTime()`). ## Exporting data from Neo4j diff --git a/pages/fundamentals/data-types.mdx b/pages/fundamentals/data-types.mdx index cb505f4a..7cd257af 100644 --- a/pages/fundamentals/data-types.mdx +++ b/pages/fundamentals/data-types.mdx @@ -47,9 +47,8 @@ the supported types. Below is a table of supported data types. | [`Map`](#maps) | A mapping of string keys to values of any supported type. | | [`Duration`](#duration) | A period of time. | | [`Date`](#date) | A date with year, month, and day. | -| [`LocalTime`](#localtime) | Time without the timezone. | -| [`LocalDateTime`](#localdatetime) | Date and time without the timezone. | -| [`ZonedDateTime`](#zoneddatetime) | Date and time in a specific timezone. | +| [`LocalTime`](#localtime) | Time without the time zone. | +| [`LocalDateTime`](#localdatetime) | Date and time without the time zone. | @@ -272,8 +271,8 @@ RETURN actor {.*, .dateOfBirth} as bradley ## Temporal types -The following temporal types are available: `Duration`, `Date`, `LocalTime`, -`LocalDateTime` and `ZonedDateTime`. +The following temporal types are available: `Duration`, `Date`, `LocalTime` and +`LocalDateTime`. ### Duration @@ -537,88 +536,10 @@ Example: MATCH (f:Flights) RETURN f.AIR123.year; ``` -### ZonedDateTime +### Temporal types arithmetic -You can create a value of the `ZonedDateTime` type from a string or a map by -calling the `datetime()` function. - -**Strings** - -The `datetime()` function takes strings that follow the ISO 8601 standard. An -ISO 8601-compliant string that stands for a zoned datetime value has two parts: -``. The first part is defined the same way as with -[LocalDateTime](#localdatetime), and the second part follows one of the given -timezone formats: -* `Z` -* `±hh:mm` -* `±hh:mm[ZoneName]` -* `±hhmm` -* `±hhmm[ZoneName]` -* `±hh` -* `±hh[ZoneName]` -* `[ZoneName]`, -where `ZoneName` is a timezone name from the -[IANA timezone database](https://en.wikipedia.org/wiki/Tz_database). - -Examples: - -```cypher -CREATE (:Flight {AIR123: datetime("2024-04-21T14:15:00-08:00[America/Los_Angeles]")}); -CREATE (:Flight {AIR123: datetime("2021-04-21Z")}); -``` - -**Maps** - -Maps for constructing `ZonedDateTime` values may have the following fields: -`year`, `month`, `day`, `hour`, `minute`, `second`, `millisecond`, -`microsecond` and `timezone`. - -There are two options for the `timezone` field: -* string: timezone name from the -[IANA timezone database](https://en.wikipedia.org/wiki/Tz_database) -* int: offset from UTC (in minutes) - -```cypher -CREATE (:Flight {AIR123: datetime({year: 2024, month: 4, day: 21, hour: 14, minute: 15, timezone: "America/Los_Angeles"})}); -CREATE (:Flight {AIR123: datetime({year: 2021, month: 4, day: 21, hour: 14, minute: 15, timezone: -60})}); -``` - -**No arguments** - -Calling `datetime` without passing arguments creates a `ZonedDateTime` value -that reflects the current date and time in UTC. - -Example: - -```cypher -CREATE (:Flights {AIR123: datetime()}); -``` - -You can access the individual fields of ZonedDateTime through its properties: - -| name | description | -| :---------: | :------------------------------: | -| year | Returns the year field | -| month | Returns the month field | -| day | Returns the day field | -| hour | Returns the hour field | -| minute | Returns the minute field | -| second | Returns the second field | -| millisecond | Returns the millisecond field | -| microsecond | Returns the microsecond field | -| timezone | Returns the timezone (as string) | - -Example: - -```cypher -MATCH (f: Flight) RETURN f.AIR123.timezone; -``` - -### Temporal type arithmetic - -The `Duration`, `Date`, `LocalTime`, `LocalDateTime` and `ZonedDateTime` types -support native arithmetic, and the operations are summarized in the following -tables: +Temporal types `Duration`, `Date`, `LocalTime` and `LocalDateTime` support +native arithmetic, and the operations are summarized in the following tables: Duration operations: @@ -651,19 +572,10 @@ LocalDateTime operations: | operation | result | | :---------------------------: | :-----------: | | LocalDateTime + Duration | LocalDateTime | -| Duration + LocalDateTime | LocalDateTime | +| Duration + LocalTateTime | LocalDateTime | | LocalDateTime - Duration | LocalDateTime | | LocalDateTime - LocalDateTime | Duration | -ZonedDateTime operations: - -| operation | result | -| :---------------------------: | :-----------: | -| ZonedDateTime + Duration | ZonedDateTime | -| Duration + ZonedDateTime | ZonedDateTime | -| ZonedDateTime - Duration | ZonedDateTime | -| ZonedDateTime - ZonedDateTime | Duration | - ## Procedures API Data types are also used within query modules. Check out the documentation for diff --git a/pages/fundamentals/storage-memory-usage.mdx b/pages/fundamentals/storage-memory-usage.mdx index ca40c6b6..b6b221d6 100644 --- a/pages/fundamentals/storage-memory-usage.mdx +++ b/pages/fundamentals/storage-memory-usage.mdx @@ -545,18 +545,16 @@ value. So the layout of each property is: $\texttt{propertySize} = \texttt{basicMetadata} + \texttt{propertyID} + [\texttt{additionalMetadata}] + \texttt{value}.$ -| Value type | Size | Note -|-----------------------------|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -|`NULL` | 1B + 1B | The value is written in the first byte of the basic metadata. | -|`BOOL` | 1B + 1B | The value is written in the first byte of the basic metadata. | -|`INT` | 1B + 1B + 1B, 2B, 4B or 8B | Basic metadata, property ID and the value depending on the size of the integer. | -|`DOUBLE` | 1B + 1B + 8B | Basic metadata, property ID and the value | -|`STRING` | 1B + 1B + 1B + min 1B | Basic metadata, property ID, additional metadata and lastly the value depending on the size of the string, where 1 ASCII character in the string takes up 1B. | -|`LIST` | 1B + 1B + 1B + min 1B | Basic metadata, property ID, additional metadata and the total size depends on the number and size of the values in the list. | -|`MAP` | 1B + 1B + 1B + min 1B | Basic metadata, property ID, additional metadata and the total size depends on the number and size of the values in the map. | -|`TEMPORAL_DATA` | 1B + 1B + 1B + min 1B + min 1B | Basic metadata, property ID, additional metadata, seconds, microseconds. Value of the seconds and microseconds is at least 1B, but probably 4B in most cases due to the large values they store. | -|`ZONED_TEMPORAL_DATA` | `TEMPORAL_DATA` + 1B + min 1B | Like `TEMPORAL_DATA`, but followed by timezone name length (1 byte) and string (1 byte per character). | -|`OFFSET_ZONED_TEMPORAL_DATA` | `TEMPORAL_DATA` + 2B | Like `TEMPORAL_DATA`, but followed by the offset from UTC (in minutes; always 2 bytes). | +|Value type |Size |Note +|-----------------|--------------------------------|-----------------------------------------------------------------------------------------------------| +|`NULL` |1B + 1B | The value is written in the first byte of the basic metadata. | +|`BOOL` |1B + 1B | The value is written in the first byte of the basic metadata. +|`INT` |1B + 1B + 1B, 2B, 4B or 8B | Basic metadata, property ID and the value depending on the size of the integer. | +|`DOUBLE` |1B + 1B + 8B | Basic metadata, property ID and the value | +|`STRING` |1B + 1B + 1B + min 1B | Basic metadata, property ID, additional metadata and lastly the value depending on the size of the string, where 1 ASCII character in the string takes up 1B.| +|`LIST` |1B + 1B + 1B + min 1B | Basic metadata, property ID, additional metadata and the total size depends on the number and size of the values in the list.| +|`MAP` |1B + 1B + 1B + min 1B | Basic metadata, property ID, additional metadata and the total size depends on the number and size of the values in the map.| +|`TEMPORAL_DATA` |1B + 1B + 1B + min 1B + min 1B | Basic metadata, property ID, additional metadata, seconds, microseconds. Value od the seconds and microseconds is at least 1B, but probably 4B in most cases due to the large values they store.| ### Marvel dataset use case diff --git a/pages/querying/differences-in-cypher-implementations.mdx b/pages/querying/differences-in-cypher-implementations.mdx index 307ba6fa..7f5d45c9 100644 --- a/pages/querying/differences-in-cypher-implementations.mdx +++ b/pages/querying/differences-in-cypher-implementations.mdx @@ -241,7 +241,7 @@ RETURN val, valueType(val) = "INTEGER" ### Unsupported data types - `POINT` -> Track progress on [GitHub](https://github.com/memgraph/memgraph/issues/1583) and add a comment if you require such a feature. -- `ZONED TIME` -> Open a [GitHub](https://github.com/memgraph/memgraph/) issue if you require such a feature. +- `ZONED DATETIME`, `ZONED TIME` -> Track progress on [GitHub](https://github.com/memgraph/memgraph/issues/612) and add a comment if you require such a feature. ### Unsupported functions @@ -286,6 +286,7 @@ RETURN val, valueType(val) = "INTEGER" **Datetime functions**: +- `datetime()` - `time()` ## Memgraph's Cypher extension diff --git a/pages/querying/functions.mdx b/pages/querying/functions.mdx index e1a4f7f4..226bfb9c 100644 --- a/pages/querying/functions.mdx +++ b/pages/querying/functions.mdx @@ -28,10 +28,9 @@ This section contains the list of supported functions. | Name | Signature | Description | | --------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | `duration` | `duration(value: string\|Duration) -> (Duration)` | Returns the data type that represents a period of time. | - | `date` | `date(value: string\|Date\|LocalDateTime) -> (Date)` | Returns the data type that represents a date with year, month, and day. | - | `localTime` | `localTime(value: string\|LocalTime\|LocalDateTime) -> (LocalTime)` | Returns the data type that represents time within a day without timezone. | + | `date` | `date(value: string\|Date\|LocalDateTime) -> (Date)` | Returns the data type that represents a date with year, month, and day. | + | `localTime` | `localTime(value: string\|LocalTime\|LocalDateTime) -> (LocalTime)` | Returns the data type that represents time within a day without timezone. | | `localDateTime` | `localDateTime(value: string\|LocalDateTime)-> (LocalDateTime)` | Returns the data type that represents a date and local time. | - | `datetime` | `datetime(value: NULL\|string\|map)-> (ZonedDateTime)` | Returns the `ZonedDateTime` value defined by the given parameters. | ### Scalar functions @@ -117,14 +116,14 @@ This section contains the list of supported functions. ### Aggregation functions -| Name | Signature | Description | -|-----------|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------| -| `avg` | `avg(row: int\|float) -> (float)` | Returns an average value of rows with numerical values generated with the `MATCH` or `UNWIND` clause. | -| `collect` | `collect(values: any) -> (List[any])` | Returns a single aggregated list containing returned values. | -| `count` | `count(values: any) -> (integer)` | Counts the number of non-null values returned by the expression. | -| `max` | `max(row: integer\|float\|temporal) -> (integer\|float\|temporal)` | Returns the maximum value in a set of values. Supported temporal types: `Date`, `LocalTime`, `LocalDateTime` and `ZonedDateTime`. | -| `min` | `min(row: integer\|float\|temporal) -> (integer\|float\|temporal)` | Returns the minimum value in a set of values. Supported temporal types: `Date`, `LocalTime`, `LocalDateTime` and `ZonedDateTime`. | -| `sum` | `sum(row: integer\|float) -> (integer\|float)` | Returns a sum value of rows with numerical values generated with the `MATCH` or `UNWIND` clause. | +| Name | Signature | Description | +|-----------|--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------| +| `avg` | `avg(row: int\|float) -> (float)` | Returns an average value of rows with numerical values generated with the `MATCH` or `UNWIND` clause. | +| `collect` | `collect(values: any) -> (List[any])` | Returns a single aggregated list containing returned values. | +| `count` | `count(values: any) -> (integer)` | Counts the number of non-null values returned by the expression. | +| `max` | `max(row: integer\|float\|temporal) -> (integer\|float\|temporal)` | Returns the maximum value in a set of values. Supported temporal types: `Date`, `LocalTime` and `LocalDateTime`. | +| `min` | `min(row: integer\|float\|temporal) -> (integer\|float\|temporal)` | Returns the minimum value in a set of values. Supported temporal types: `Date`, `LocalTime` and `LocalDateTime`. | +| `sum` | `sum(row: integer\|float) -> (integer\|float)` | Returns a sum value of rows with numerical values generated with the `MATCH` or `UNWIND` clause. | All aggregation functions can be used with the `DISTINCT` operator to perform calculations only on unique values. For example, `count(DISTINCT n.prop)` and `collect(DISTINCT n.prop)`.