示例#1
0
        private static void writeSchema(JsonWriter writer, IList<OrcProto.Type> types)
        {
            int i = 0;
            foreach (OrcProto.Type type in types)
            {
                writer.newObject();
                writer.key("columnId").value(i++);
                writer.key("columnType").value(type.Kind.ToString());
                if (type.FieldNamesCount > 0)
                {
                    writer.key("childColumnNames").array();
                    foreach (string field in type.FieldNamesList)
                    {
                        writer.value(field);
                    }
                    writer.endArray();
                    writer.key("childColumnIds").array();
                    foreach (int colId in type.SubtypesList)
                    {
                        writer.value(colId);
                    }
                    writer.endArray();
                }
                if (type.HasPrecision)
                {
                    writer.key("precision").value(type.Precision);
                }

                if (type.HasScale)
                {
                    writer.key("scale").value(type.Scale);
                }

                if (type.HasMaximumLength)
                {
                    writer.key("maxLength").value(type.MaximumLength);
                }
                writer.endObject();
            }
        }
示例#2
0
        private static void writeRowGroupIndexes(JsonWriter writer, int col,
            OrcProto.RowIndex[] rowGroupIndex)
        {
            OrcProto.RowIndex index;
            if (rowGroupIndex == null || (col >= rowGroupIndex.Length) ||
                ((index = rowGroupIndex[col]) == null))
            {
                return;
            }

            writer.key("rowGroupIndexes").array();
            for (int entryIx = 0; entryIx < index.EntryCount; ++entryIx)
            {
                writer.newObject();
                writer.key("entryId").value(entryIx);
                OrcProto.RowIndexEntry entry = index.EntryList[entryIx];
                if (entry == null)
                {
                    continue;
                }
                OrcProto.ColumnStatistics colStats = entry.Statistics;
                writeColumnStatistics(writer, ColumnStatisticsImpl.deserialize(colStats));
                writer.key("positions").array();
                for (int posIx = 0; posIx < entry.PositionsCount; ++posIx)
                {
                    writer.value(entry.PositionsList[posIx]);
                }
                writer.endArray();
                writer.endObject();
            }
            writer.endArray();
        }