void TestRoundTripLongColumn <T>(IEnumerable <T> testElements, int columnId, IEnumerable <long?> expectedResults)
        {
            var memStream = new MemoryStream();

            using (var writer = new OrcWriter <T>(memStream, new WriterConfiguration()))            //Use the default configuration
            {
                writer.AddRows(testElements);
            }

            memStream.Seek(0, SeekOrigin.Begin);

            var dataFile = new DataFileHelper(memStream);
            var stream   = dataFile.GetStream();
            var fileTail = new FileTail(stream);

            var expectedEnumerator = expectedResults.GetEnumerator();

            foreach (var stripe in fileTail.Stripes)
            {
                var stripeStreamCollection = stripe.GetStripeStreamCollection();
                var longReader             = new LongReader(stripeStreamCollection, (uint)columnId);
                var resultEnumerator       = longReader.Read().GetEnumerator();

                ulong count = 0;
                while (resultEnumerator.MoveNext())
                {
                    Assert.True(expectedEnumerator.MoveNext());
                    Assert.Equal(expectedEnumerator.Current, resultEnumerator.Current);
                    count++;
                }
                Assert.Equal(stripe.NumRows, count);
            }
            Assert.False(expectedEnumerator.MoveNext());                        //We should have used all expected results
        }
Esempio n. 2
0
        StripeStreamReaderCollection GetStripeStreamCollection()
        {
            var dataFile = new DataFileHelper("decimal.orc");
            var stream   = dataFile.GetStream();
            var fileTail = new FileTail(stream);
            var stripes  = fileTail.GetStripeCollection();

            Assert.Equal(1, stripes.Count);
            return(stripes[0].GetStripeStreamCollection());
        }
Esempio n. 3
0
        StripeStreamReaderCollection GetStripeStreamCollection()
        {
            var dataFile = new DataFileHelper("decimal.orc");
            var stream   = dataFile.GetStream();
            var fileTail = new FileTail(stream);
            var stripes  = fileTail.Stripes;

            Assert.Single(stripes);
            return(stripes[0].GetStripeStreamCollection());
        }