Exemple #1
0
        public async Task <int> create_time_series_async(string ts_path, TSDataType data_type, TSEncoding encoding, Compressor compressor)
        {
            TSStatus status;
            var      client = client_lst.Take();
            var      req    = new TSCreateTimeseriesReq(client.sessionId, ts_path, (int)data_type, (int)encoding, (int)compressor);

            try{
                status = await client.client.createTimeseriesAsync(req);
            }
            catch (TException e) {
                client_lst.Add(client);
                var err_msg = String.Format("create time series {0} failed", ts_path);
                throw new TException(err_msg, e);
            }
            if (debug_mode)
            {
                _logger.Info("creating time series {0} successfully, server message is {1}", ts_path, status.Message);
            }
            client_lst.Add(client);

            return(util_functions.verify_success(status, SUCCESS_CODE));
        }
Exemple #2
0
        public void construct_one_row()
        {
            List <object> field_lst = new List <Object> {
            };

            for (int i = 0; i < this.column_size; i++)
            {
                if (duplicate_location.ContainsKey(i))
                {
                    var field = field_lst[duplicate_location[i]];
                    field_lst.Add(field);
                }
                else
                {
                    ByteBuffer column_value_buffer  = value_buffer_lst[i];
                    ByteBuffer column_bitmap_buffer = bitmap_buffer_lst[i];
                    if (row_index % 8 == 0)
                    {
                        current_bitmap[i] = column_bitmap_buffer.get_byte();
                    }
                    object local_field;
                    if (!is_null(i, row_index))
                    {
                        TSDataType column_data_type = get_data_type_from_str(column_type_lst[i]);



                        switch (column_data_type)
                        {
                        case TSDataType.BOOLEAN:
                            local_field = column_value_buffer.get_bool();
                            break;

                        case TSDataType.INT32:
                            local_field = column_value_buffer.get_int();
                            break;

                        case TSDataType.INT64:
                            local_field = column_value_buffer.get_long();
                            break;

                        case TSDataType.FLOAT:
                            local_field = column_value_buffer.get_float();
                            break;

                        case TSDataType.DOUBLE:
                            local_field = column_value_buffer.get_double();
                            break;

                        case TSDataType.TEXT:
                            local_field = column_value_buffer.get_str();
                            break;

                        default:
                            string err_msg = string.Format("value format not supported");
                            throw new TException(err_msg, null);
                        }
                        field_lst.Add(local_field);
                    }
                    else
                    {
                        local_field = null;
                        field_lst.Add("NULL");
                    }
                }
            }
            long timestamp = time_buffer.get_long();

            row_index += 1;
            this.cached_row_record = new RowRecord(timestamp, field_lst, column_name_lst);
        }