Skip to main content

Module df_expr

Module df_expr 

Source
Expand description

Translation layer from Cypher expressions to DataFusion expressions.

This module provides cypher_expr_to_df which converts Cypher AST expressions into DataFusion physical expressions suitable for use in DataFusion execution plans.

§Property Naming Convention

Properties are materialized as columns with the naming convention {variable}.{property}. For example, n.age becomes column "n.age".

§Supported Expressions

  • Identifiers and property access
  • Literal values (numbers, strings, booleans, null)
  • Binary operators (comparison, arithmetic, boolean)
  • Unary operators (NOT, negation)
  • IS NULL / IS NOT NULL
  • String operations (CONTAINS, STARTS WITH, ENDS WITH)
  • IN list checks
  • CASE expressions

§Unsupported Expressions

Some Cypher expressions require custom handling and are not yet supported:

  • List comprehensions
  • Reduce expressions
  • Subqueries (EXISTS, scalar subqueries)
  • Approximate equality (~=) for vectors

Structs§

TranslationContext
Context for expression translation.

Enums§

VariableKind
Entity kind of a variable in the physical query context.

Functions§

apply_type_coercion
Apply type coercion to a DataFusion expression.
cast_expr
Create a cast expression to the specified data type.
collect_properties
Collect all property accesses from an expression tree.
comparison_udf_name
Map a comparison operator to its _cypher_* UDF name.
cypher_expr_to_df
Convert a Cypher expression to a DataFusion expression.
dummy_udf_expr
Helper to create a DummyUdf wrapped in a ScalarFunction expression.
extract_datetime_nanos
Extract the nanos_since_epoch field from a DateTime struct expression.
extract_time_nanos
Extract the UTC-normalized time in nanoseconds from a Time struct expression.
list_to_large_binary_expr
Wrap a List<T> or LargeList<T> expression as a LargeBinary CypherValue.
normalize_datetime_str
Insert :00 seconds into a datetime string like 2021-06-01T00:00Z that has only HH:MM after the T separator (no seconds component).
scalar_to_large_binary_expr
Wrap a native scalar expression (Int64, Float64, Utf8, Boolean, etc.) in the _cypher_scalar_to_cv UDF so it becomes CypherValue-encoded LargeBinary. Used to normalize mixed-type coalesce arguments.
struct_getfield
Extract a named field from a struct expression using DataFusion’s get_field function.
wider_numeric_type
Returns the wider of two numeric DataTypes for type coercion.