Ejemplo n.º 1
0
        public static void CompareBatches(RecordBatch expectedBatch, RecordBatch actualBatch)
        {
            Assert.True(SchemaComparer.Equals(expectedBatch.Schema, actualBatch.Schema));
            Assert.Equal(expectedBatch.Length, actualBatch.Length);
            Assert.Equal(expectedBatch.ColumnCount, actualBatch.ColumnCount);

            for (int i = 0; i < expectedBatch.ColumnCount; i++)
            {
                IArrowArray expectedArray = expectedBatch.Arrays.ElementAt(i);
                IArrowArray actualArray   = actualBatch.Arrays.ElementAt(i);

                actualArray.Accept(new ArrayComparer(expectedArray));
            }
        }
Ejemplo n.º 2
0
            public void MetadataConstruction()
            {
                var metadata0 = new Dictionary <string, string> {
                    { "foo", "bar" }, { "bizz", "buzz" }
                };
                var metadata1 = new Dictionary <string, string> {
                    { "foo", "bar" }
                };
                var   metadata0Copy = new Dictionary <string, string>(metadata0);
                var   metadata1Copy = new Dictionary <string, string>(metadata1);
                Field f0            = new Field.Builder().Name("f0").DataType(Int32Type.Default).Build();
                Field f1            = new Field.Builder().Name("f1").DataType(UInt8Type.Default).Nullable(false).Build();
                Field f2            = new Field.Builder().Name("f2").DataType(StringType.Default).Build();
                Field f3            = new Field.Builder().Name("f2").DataType(StringType.Default).Metadata(metadata1Copy).Build();

                var schema0 = new Schema.Builder()
                              .Field(f0)
                              .Field(f1)
                              .Field(f2)
                              .Metadata(metadata0)
                              .Build();
                var schema1 = new Schema.Builder()
                              .Field(f0)
                              .Field(f1)
                              .Field(f2)
                              .Metadata(metadata1)
                              .Build();
                var schema2 = new Schema.Builder()
                              .Field(f0)
                              .Field(f1)
                              .Field(f2)
                              .Metadata(metadata0Copy)
                              .Build();
                var schema3 = new Schema.Builder()
                              .Field(f0)
                              .Field(f1)
                              .Field(f3)
                              .Metadata(metadata0Copy)
                              .Build();

                Assert.True(metadata0.Keys.SequenceEqual(schema0.Metadata.Keys) && metadata0.Values.SequenceEqual(schema0.Metadata.Values));
                Assert.True(metadata1.Keys.SequenceEqual(schema1.Metadata.Keys) && metadata1.Values.SequenceEqual(schema1.Metadata.Values));
                Assert.True(metadata0.Keys.SequenceEqual(schema2.Metadata.Keys) && metadata0.Values.SequenceEqual(schema2.Metadata.Values));
                Assert.True(SchemaComparer.Equals(schema0, schema2));
                Assert.False(SchemaComparer.Equals(schema0, schema1));
                Assert.False(SchemaComparer.Equals(schema2, schema1));
                Assert.False(SchemaComparer.Equals(schema2, schema3));
            }
Ejemplo n.º 3
0
 private void CompareSchemas(Schema expectedSchema, Schema actualSchema)
 {
     Assert.True(SchemaComparer.Equals(expectedSchema, actualSchema));
 }