Skip to content

CANNOT_PARSE_INPUT_ASSERTION_FAILED when attempting to add non-scalar data #81

Description

@jedmonds-tiplu

We are wanting to do some testing for an application where Analytical performance is critical. Given we are using EFCore already, we wanted to do some testing with ClickHouse, and your library to benchmark the performance difference between Postgres (current DB), and ClickHouse.

However, I am unable to get a working example running when using non-scalar (multidimensional) classes. We are not doing anything fancy in this test project, other than attempting to save some data, and query it back.

Painting you a picture:

I have a simple class tree Patient that looks like this:

public class Patient {
    public Guid Id { get; set; }
    public PatientData Data { get; set; } = new();
}

public class PatientData {
    public string Name { get; set; } = string.Empty;
    public Medication List<Medication> Medications { get; set; } = new List<Medication>();
}

public class Medication {
    public string Name { get; set; } = string.Empty;
}

My OnModelCreating looks like this:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    var builder = modelBuilder.Entity<Patient>();

    builder
        .OwnsOne(
            p => p.Data,
            builder =>
            {
                builder.OwnsMany(p => p.Medications);
            }
        )
        .HasKey(p => p.Id);

    builder.ToTable(table => table.HasMergeTreeEngine().WithPrimaryKey(nameof(Patient.Id)));
}

The problem:

If I add Patients that do not contain any Medications (Empty List), and call SaveChangesAsync on the context, then all works as expected, and I can query the Patients.

However if I do add Patients containing Medications, then I recieve the following error on SaveChangesAsync:
ClickHouseServerException: Code: 27. DB::Exception: Cannot parse input: expected '(' before: 'RETURNING "Id";\r\n': at row 1: While executing ValuesBlockInputFormat. (CANNOT_PARSE_INPUT_ASSERTION_FAILED) (version 25.2.2.39 (official build))

Important Information:

  • I am running clickhouse:latest in Docker
  • I have created an initial migration, and run dotnet ef database update

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions