Kinetica C# API  Version 7.0.19.0
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
Test.cs
Go to the documentation of this file.
1 
7 using System;
8 using System.Collections.Generic;
9 using System.Linq;
10 using System.Text.RegularExpressions;
11 
12 using kinetica;
13 
14 namespace Test
15 {
19  public static class StringExt
20  {
21  public static string Truncate( this string value, int maxLength )
22  {
23  if ( string.IsNullOrEmpty( value ) )
24  return value;
25 
26  return ( value.Length <= maxLength ) ? value : value.Substring( 0, maxLength );
27  }
28  }
29 
30 
36  class Test
37  {
38  static void Main( string[] args )
39  {
40  Console.WriteLine( "Testing C# Project - Running" );
41  Console.WriteLine();
42 
43  if ( args.Length < 1 )
44  {
45  Console.WriteLine( "Missing URL as command-line parameter." );
46  Console.WriteLine( "E.g., http://kinetica:9191" );
47  return;
48  }
49 
50  try
51  {
52  string server_url = args[0];
53  Console.WriteLine( "URL: {0}", server_url );
54  Console.WriteLine();
55 
56  // Run various multihead ingest tests
57  // ----------------------------------
58  test_authentication( server_url );
59  test_all_types_allshard( server_url );
60  test_all_types_3pk_3shard( server_url );
61  test_all_types_ip_regex_3shard_0pk( server_url );
62  test_all_types_3pk_0shard( server_url );
63  test_record_retrieval_by_key( server_url );
64  }
65  catch ( kinetica.KineticaIngestor<record_type_all>.InsertException<record_type_all> ex )
66  {
67  Console.WriteLine( "Caught InsertException: {0}", ex.Message );
68  }
69  catch ( KineticaException ex )
70  {
71  Console.WriteLine( "Caught KineticaException: {0}", ex.Message );
72  }
73  catch ( Exception ex )
74  {
75  Console.WriteLine( "Caught Exception: {0}", ex.Message );
76  }
77 
78  // We're done
79  Console.WriteLine();
80  Console.WriteLine( "Testing C# Project - Done" );
81  Console.WriteLine();
82  Console.WriteLine( "Enter any 7-digit prime number to continue: " );
83  Console.ReadLine();
84  } // end Main
85 
86 
87  private class record_type_short
88  {
89  public int i { get; set; }
90  public int i8 { get; set; }
91 
92  public override string ToString()
93  {
94  return $"{{ i={i}, i8={i8} }}";
95  }
96  } // end class record_type_short
97 
98 
99  private static void test_authentication( string server_url )
100  {
101  Console.WriteLine( "\n\n" );
102  Console.WriteLine( "Test Authentication" );
103  Console.WriteLine( "===================" );
104  Console.WriteLine();
105 
106  Console.WriteLine( "This test is done dynamically:" );
107  Console.WriteLine( "------------------------------" );
108  Console.WriteLine( "* First run--create the user with the 'correct' username" );
109  Console.WriteLine( "* Second run--comment out user creation; run with 'correct'" );
110  Console.WriteLine( " username and make sure that the endpoints go through" );
111  Console.WriteLine( "* Third run--comment out user creation; run with 'wrong'" );
112  Console.WriteLine( " username and make sure that we get an 'insufficient credentials'" );
113  Console.WriteLine( " error thrown from the server." );
114  Console.WriteLine();
115 
116  string username = "abcdef"; // correct
117  //string username = "abcdefg"; // wrong
118  string password = "ghijkl123_";
119 
120  // Establish a connection with Kinetica
121  // Create a user
122  Kinetica kdb_ = new Kinetica( server_url );
123  Console.WriteLine( $"Creating a user {username}" );
124  Console.WriteLine();
125  IDictionary <string, string> options = new Dictionary<string, string>();
126  try
127  {
128  kdb_.createUserInternal( username, password, options );
129  }
130  catch ( KineticaException ex )
131  {
132  Console.WriteLine( "Caught exception: " + ex.Message );
133  }
134 
135  // Establish another connection with Kinetica with authentication information
136  Console.WriteLine( "Creating a DB handle with the proper username and password" );
137  Kinetica.Options db_options = new Kinetica.Options();
138  db_options.Username = username;
139  db_options.Password = password;
140  Kinetica kdb = new Kinetica( server_url, db_options );
141 
142  // Create the KineticaType object which facilitates creating types in the database
143  KineticaType type1 = KineticaType.fromClass( typeof( record_type_short ) );
144 
145  // Create the type in the database
146  string type_id = type1.create( kdb );
147 
148  string table_name = "csharp_example_table_01_auth";
149  // Clear any previously made table with the same name
150  Console.WriteLine( "Clearing any existing table named '{0}'", table_name );
151  try { kdb.clearTable( table_name, null ); } catch ( Exception ex ) { /* I don't care if the table doesn't already exists! */ }
152  Console.WriteLine();
153 
154  // Create a table of the given type
155  Console.WriteLine( $"Creating table named '{table_name}'" );
156  kdb.createTable( table_name, type_id );
157  Console.WriteLine();
158 
159 
160  int num_records = 5000;
161  kdb.insertRecordsRandom( table_name, num_records );
162  Console.WriteLine( $"Generated {num_records} records." );
163  } // end test_authentication()
164 
165 
166  private class record_type_all
167  {
168  public int? i { get; set; }
169  public int? i8 { get; set; }
170  public int? i16 { get; set; }
171  public long l { get; set; } // not making nullable here so that can be used as a primary key
172  public float? f { get; set; }
173  public double? d { get; set; } // nullable
174  public string s { get; set; }
175  public string c1 { get; set; }
176  public string c2 { get; set; }
177  public string c4 { get; set; }
178  public string c8 { get; set; }
179  public string c16 { get; set; }
180  public string c32 { get; set; }
181  public string c64 { get; set; }
182  public string c128 { get; set; }
183  public string c256 { get; set; }
184  public string date { get; set; }
185  public string datetime { get; set; }
186  public string decimal_ { get; set; }
187  public string ipv4 { get; set; }
188  public string time { get; set; }
189  public long? timestamp { get; set; }
190 
191  public override string ToString()
192  {
193  string d_;
194  if ( d != null )
195  d_ = $"{d}";
196  else
197  d_ = "<null>";
198  return $"{{ i={i}, i8={i8}, i16={i16}, l={l}, f={f}, d={d_}, s={s}, c1={c1}, c2={c2}, c4={c4}, c8={c8}, c16={c16}, c32={c32}, c64={c64}, c128={c128}, c256={c256}, date={date}, datetime={datetime}, decimal_={decimal_}, ipv4={ipv4}, time={time}, timestamp={timestamp} }}";
199  }
200  } // end class record_type_all
201 
202 
203  private static void test_all_types_allshard( string server_url )
204  {
205  // Establish a connection with Kinetica
206  Kinetica kdb = new Kinetica( server_url );
207 
208  Console.WriteLine( "\n\n" );
209  Console.WriteLine( "Test Multihead Ingest: One column per Type; All are Shard Keys, 0 Primary Keys" );
210  Console.WriteLine( "==============================================================================" );
211  Console.WriteLine();
212 
213  Console.WriteLine( "Creating a type with all column types (all are nullable and shard columns).\n" );
214 
215  // Create a type for our record_type_1 class
216  // Add some interesting properties for some of the data types
217  IDictionary<string, IList<string>> column_properties = new Dictionary<string, IList<string>>();
218 
219  // Integer shard key
220  List<string> i_props = new List<string>();
221  i_props.Add( ColumnProperty.SHARD_KEY );
222  column_properties.Add( "i", i_props );
223 
224  // Integer8 shard key
225  List<string> i8_props = new List<string>();
226  i8_props.Add( ColumnProperty.SHARD_KEY );
227  i8_props.Add( ColumnProperty.INT8 );
228  column_properties.Add( "i8", i8_props );
229  // Integer16 shard key
230  List<string> i16_props = new List<string>();
231  i16_props.Add( ColumnProperty.SHARD_KEY );
232  i16_props.Add( ColumnProperty.INT16 );
233  column_properties.Add( "i16", i16_props );
234 
235  // Double shard key
236  List<string> d_props = new List<string>();
237  d_props.Add( ColumnProperty.SHARD_KEY );
238  column_properties.Add( "d", d_props );
239 
240  // Float shard key
241  List<string> f_props = new List<string>();
242  f_props.Add( ColumnProperty.SHARD_KEY );
243  column_properties.Add( "f", f_props );
244 
245  // Long shard key
246  List<string> l_props = new List<string>();
247  l_props.Add( ColumnProperty.SHARD_KEY );
248  l_props.Add( ColumnProperty.NULLABLE );
249  column_properties.Add( "l", l_props );
250 
251  // string nullable shard key
252  List<string> s_props = new List<string>();
253  s_props.Add( ColumnProperty.SHARD_KEY );
254  s_props.Add( ColumnProperty.NULLABLE );
255  column_properties.Add( "s", s_props );
256 
257  // char1 shard key, nullable
258  List<string> c1_props = new List<string>();
259  c1_props.Add( ColumnProperty.SHARD_KEY );
260  c1_props.Add( ColumnProperty.NULLABLE );
261  c1_props.Add( ColumnProperty.CHAR1 );
262  column_properties.Add( "c1", c1_props );
263 
264  // char2 shard key, nullable
265  List<string> c2_props = new List<string>();
266  c2_props.Add( ColumnProperty.SHARD_KEY );
267  c2_props.Add( ColumnProperty.NULLABLE );
268  c2_props.Add( ColumnProperty.CHAR2 );
269  column_properties.Add( "c2", c2_props );
270 
271  // char4 shard key, nullable
272  List<string> c4_props = new List<string>();
273  c4_props.Add( ColumnProperty.SHARD_KEY );
274  c4_props.Add( ColumnProperty.NULLABLE );
275  c4_props.Add( ColumnProperty.CHAR4 );
276  column_properties.Add( "c4", c4_props );
277 
278  // char8 shard key, nullable
279  List<string> c8_props = new List<string>();
280  c8_props.Add( ColumnProperty.SHARD_KEY );
281  c8_props.Add( ColumnProperty.NULLABLE );
282  c8_props.Add( ColumnProperty.CHAR8 );
283  column_properties.Add( "c8", c8_props );
284 
285  // char16 shard key, nullable
286  List<string> c16_props = new List<string>();
287  c16_props.Add( ColumnProperty.SHARD_KEY );
288  c16_props.Add( ColumnProperty.NULLABLE );
289  c16_props.Add( ColumnProperty.CHAR16 );
290  column_properties.Add( "c16", c16_props );
291 
292  // char32 shard key, nullable
293  List<string> c32_props = new List<string>();
294  c32_props.Add( ColumnProperty.SHARD_KEY );
295  c32_props.Add( ColumnProperty.NULLABLE );
296  c32_props.Add( ColumnProperty.CHAR32 );
297  column_properties.Add( "c32", c32_props );
298 
299  // char64 shard key, nullable
300  List<string> c64_props = new List<string>();
301  c64_props.Add( ColumnProperty.SHARD_KEY );
302  c64_props.Add( ColumnProperty.NULLABLE );
303  c64_props.Add( ColumnProperty.CHAR64 );
304  column_properties.Add( "c64", c64_props );
305 
306  // char128 shard key, nullable
307  List<string> c128_props = new List<string>();
308  c128_props.Add( ColumnProperty.SHARD_KEY );
309  c128_props.Add( ColumnProperty.NULLABLE );
310  c128_props.Add( ColumnProperty.CHAR128 );
311  column_properties.Add( "c128", c128_props );
312 
313  // char256 shard key, nullable
314  List<string> c256_props = new List<string>();
315  c256_props.Add( ColumnProperty.SHARD_KEY );
316  c256_props.Add( ColumnProperty.NULLABLE );
317  c256_props.Add( ColumnProperty.CHAR256 );
318  column_properties.Add( "c256", c256_props );
319 
320  // date shard key, nullable
321  List<string> date_props = new List<string>();
322  date_props.Add( ColumnProperty.DATE );
323  date_props.Add( ColumnProperty.SHARD_KEY );
324  date_props.Add( ColumnProperty.NULLABLE );
325  column_properties.Add( "date", date_props );
326 
327  // datetime shard key, nullable
328  List<string> datetime_props = new List<string>();
329  datetime_props.Add( ColumnProperty.DATETIME );
330  datetime_props.Add( ColumnProperty.SHARD_KEY );
331  datetime_props.Add( ColumnProperty.NULLABLE );
332  column_properties.Add( "datetime", datetime_props );
333 
334  // decimal shard key, nullable
335  List<string> decimal_props = new List<string>();
336  decimal_props.Add(ColumnProperty.DECIMAL);
337  decimal_props.Add(ColumnProperty.SHARD_KEY);
338  decimal_props.Add( ColumnProperty.NULLABLE );
339  column_properties.Add( "decimal_", decimal_props );
340 
341  // IPv4 shard key, nullable
342  List<string> ipv4_props = new List<string>();
343  ipv4_props.Add( ColumnProperty.IPV4 );
344  ipv4_props.Add( ColumnProperty.SHARD_KEY );
345  ipv4_props.Add( ColumnProperty.NULLABLE );
346  column_properties.Add( "ipv4", ipv4_props );
347 
348  // time shard key, nullable
349  List<string> time_props = new List<string>();
350  time_props.Add( ColumnProperty.TIME );
351  time_props.Add( ColumnProperty.SHARD_KEY );
352  time_props.Add( ColumnProperty.NULLABLE );
353  column_properties.Add( "time", time_props );
354 
355  // timestamp shard key, already nullable
356  List<string> timestamp_props = new List<string>();
357  timestamp_props.Add( ColumnProperty.TIMESTAMP );
358  timestamp_props.Add( ColumnProperty.SHARD_KEY );
359  column_properties.Add( "timestamp", timestamp_props );
360 
361  // Create the KineticaType object which facilitates creating types in the database
362  KineticaType type1 = KineticaType.fromClass( typeof( record_type_all ), column_properties );
363 
364  // Create the type in the database
365  string type_id = type1.create( kdb );
366  //Console.WriteLine( "ID of the created type: " + type_id );
367  //Console.WriteLine();
368  Console.WriteLine( "Created type.\n" );
369 
370  string table_name = "csharp_example_table_all_shards";
371  // Clear any previously made table with the same name
372  Console.WriteLine( "Clearing any existing table named '{0}'\n", table_name );
373  try { kdb.clearTable( table_name, null ); } catch ( Exception ex ) { /* I don't care if the table doesn't already exists! */ }
374  Console.WriteLine();
375 
376  // Create a table of the given type
377  Console.WriteLine( $"Creating table named '{table_name}'\n" );
378  kdb.createTable( table_name, type_id );
379  Console.WriteLine();
380 
381  // Create the ingestor
382  int batch_size = 1000;
383  KineticaIngestor<record_type_all> ingestor = new KineticaIngestor<record_type_all>( kdb, table_name, batch_size, type1 );
384 
385 
386  // Generate data to be inserted
387  int num_records = batch_size * 10;
388  Console.WriteLine( $"Starting to generate {num_records} records.\n" );
389  List<record_type_all> records = new List<record_type_all>();
390  Random rng = new Random();
391  double null_probability = 0.15; // 15% chance of creating nulls
392  for ( int i = 0; i < num_records; ++i )
393  {
394  // Restricting string length to 256
395  int max_str_len = rng.Next( 0, 256 );
396  record_type_all record = new record_type_all()
397  {
398  i = ( rng.NextDouble() < null_probability ) ? null : (int?) rng.Next(),
399  i8 = ( rng.NextDouble() < null_probability ) ? null : (int?) rng.Next( -128, 128 ), // upper exclusive
400  i16 = ( rng.NextDouble() < null_probability ) ? null : (int?) rng.Next( -32768, 32768), // upper exclusive
401  l = (long)rng.Next(),
402  //l = ( rng.NextDouble() < null_probability ) ? null : (long)rng.Next(), // can't be made nullable if not declared as long?
403  f = ( rng.NextDouble() < null_probability ) ? null : (float?)(rng.NextDouble() * rng.Next()),
404  d = ( rng.NextDouble() < null_probability ) ? null : ( double? ) ( rng.NextDouble() * rng.Next() ),
405  s = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( max_str_len ),
406  c1 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( 1 ),
407  c2 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( 2 ),
408  c4 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 0, 5) ), // any size between empty string to 4 length
409  c8 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 0, 9) ), // any size between empty string to 8 length
410  c16 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 0, 17) ), // any size between empty string to 16 length
411  c32 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 5, 33) ), // any size between [5, 32] in length
412  c64 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 10, 65) ), // any size between [10, 64] in length
413  c128 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 10, 129) ), // any size between [10, 128] in length
414  c256 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 25, 257) ), // any size between [25, 256] in length
415  date = ( rng.NextDouble() < null_probability ) ? null : Test.generate_date( rng ),
416  datetime = (rng.NextDouble() < null_probability) ? null : Test.generate_datetime(rng),
417  decimal_ = (rng.NextDouble() < null_probability) ? null : Test.generate_decimal(rng),
418  ipv4 = ( rng.NextDouble() < null_probability ) ? null : Test.generate_IPv4( rng ),
419  time = (rng.NextDouble() < null_probability) ? null : Test.generate_time(rng),
420  timestamp = ( rng.NextDouble() < null_probability ) ? null : ((long?)rng.Next( -306102240, 293795424 ) * rng.Next( 100000 ))
421  };
422 
423  //Console.WriteLine( "#" + i + ": " + record.ToString() + "\n" ); // debug~~~~~~~~
424  //records.Add( record );
425  ingestor.insert( record );
426  } // end for loop
427 
428  Console.WriteLine( $"Generated {num_records} records." );
429 
431  //Console.WriteLine( $"Inserting {num_records} records..." );
432  //ingestor.insert( records );
433 
434  // Flush the ingestor (which actually inserts the records)
435  Console.WriteLine( "\nFlushing any remaining records." );
436  ingestor.flush();
437  } // end test_all_types_allshard()
438 
439 
440 
441  private static void test_record_retrieval_by_key( string server_url )
442  {
443  // Establish a connection with Kinetica
444  Kinetica kdb = new Kinetica( server_url );
445 
446  Console.WriteLine( "\n\n" );
447  Console.WriteLine( "Test Multihead Key Lookup: One column per Type; one numeric and one string" );
448  Console.WriteLine( "shard key (no primary key)" );
449  Console.WriteLine( "==========================================================================" );
450  Console.WriteLine();
451 
452  Console.WriteLine( "Creating a type with all column types (all are nullable; one numeric and one string shard columns).\n" );
453 
454  // Create a type for our record_type_1 class
455  // Add some interesting properties for some of the data types
456  IDictionary<string, IList<string>> column_properties = new Dictionary<string, IList<string>>();
457 
458  // Integer shard key
459  List<string> i_props = new List<string>();
460  column_properties.Add( "i", i_props );
461 
462  // Integer8 shard key
463  List<string> i8_props = new List<string>();
464  i8_props.Add( ColumnProperty.SHARD_KEY );
465  i8_props.Add( ColumnProperty.INT8 );
466  column_properties.Add( "i8", i8_props );
467  // Integer16 shard key
468  List<string> i16_props = new List<string>();
469  i16_props.Add( ColumnProperty.INT16 );
470  column_properties.Add( "i16", i16_props );
471 
472  // Double shard key
473  List<string> d_props = new List<string>();
474  column_properties.Add( "d", d_props );
475 
476  // Float shard key
477  List<string> f_props = new List<string>();
478  column_properties.Add( "f", f_props );
479 
480  // Long shard key
481  List<string> l_props = new List<string>();
482  l_props.Add( ColumnProperty.NULLABLE );
483  column_properties.Add( "l", l_props );
484 
485  // string nullable shard key
486  List<string> s_props = new List<string>();
487  s_props.Add( ColumnProperty.NULLABLE );
488  column_properties.Add( "s", s_props );
489 
490  // char1 shard key, nullable
491  List<string> c1_props = new List<string>();
492  c1_props.Add( ColumnProperty.SHARD_KEY );
493  c1_props.Add( ColumnProperty.NULLABLE );
494  c1_props.Add( ColumnProperty.CHAR1 );
495  column_properties.Add( "c1", c1_props );
496 
497  // char2 shard key, nullable
498  List<string> c2_props = new List<string>();
499  c2_props.Add( ColumnProperty.NULLABLE );
500  c2_props.Add( ColumnProperty.CHAR2 );
501  column_properties.Add( "c2", c2_props );
502 
503  // char4 shard key, nullable
504  List<string> c4_props = new List<string>();
505  c4_props.Add( ColumnProperty.NULLABLE );
506  c4_props.Add( ColumnProperty.CHAR4 );
507  column_properties.Add( "c4", c4_props );
508 
509  // char8 shard key, nullable
510  List<string> c8_props = new List<string>();
511  c8_props.Add( ColumnProperty.NULLABLE );
512  c8_props.Add( ColumnProperty.CHAR8 );
513  column_properties.Add( "c8", c8_props );
514 
515  // char16 shard key, nullable
516  List<string> c16_props = new List<string>();
517  c16_props.Add( ColumnProperty.NULLABLE );
518  c16_props.Add( ColumnProperty.CHAR16 );
519  column_properties.Add( "c16", c16_props );
520 
521  // char32 shard key, nullable
522  List<string> c32_props = new List<string>();
523  c32_props.Add( ColumnProperty.NULLABLE );
524  c32_props.Add( ColumnProperty.CHAR32 );
525  column_properties.Add( "c32", c32_props );
526 
527  // char64 shard key, nullable
528  List<string> c64_props = new List<string>();
529  c64_props.Add( ColumnProperty.NULLABLE );
530  c64_props.Add( ColumnProperty.CHAR64 );
531  column_properties.Add( "c64", c64_props );
532 
533  // char128 shard key, nullable
534  List<string> c128_props = new List<string>();
535  c128_props.Add( ColumnProperty.NULLABLE );
536  c128_props.Add( ColumnProperty.CHAR128 );
537  column_properties.Add( "c128", c128_props );
538 
539  // char256 shard key, nullable
540  List<string> c256_props = new List<string>();
541  c256_props.Add( ColumnProperty.NULLABLE );
542  c256_props.Add( ColumnProperty.CHAR256 );
543  column_properties.Add( "c256", c256_props );
544 
545  // date shard key, nullable
546  List<string> date_props = new List<string>();
547  date_props.Add( ColumnProperty.DATE );
548  date_props.Add( ColumnProperty.NULLABLE );
549  column_properties.Add( "date", date_props );
550 
551  // datetime shard key, nullable
552  List<string> datetime_props = new List<string>();
553  datetime_props.Add( ColumnProperty.DATETIME );
554  datetime_props.Add( ColumnProperty.NULLABLE );
555  column_properties.Add( "datetime", datetime_props );
556 
557  // decimal shard key, nullable
558  List<string> decimal_props = new List<string>();
559  decimal_props.Add( ColumnProperty.DECIMAL );
560  decimal_props.Add( ColumnProperty.NULLABLE );
561  column_properties.Add( "decimal_", decimal_props );
562 
563  // IPv4 shard key, nullable
564  List<string> ipv4_props = new List<string>();
565  ipv4_props.Add( ColumnProperty.IPV4 );
566  ipv4_props.Add( ColumnProperty.NULLABLE );
567  column_properties.Add( "ipv4", ipv4_props );
568 
569  // time shard key, nullable
570  List<string> time_props = new List<string>();
571  time_props.Add( ColumnProperty.TIME );
572  time_props.Add( ColumnProperty.NULLABLE );
573  column_properties.Add( "time", time_props );
574 
575  // timestamp shard key, already nullable
576  List<string> timestamp_props = new List<string>();
577  timestamp_props.Add( ColumnProperty.TIMESTAMP );
578  column_properties.Add( "timestamp", timestamp_props );
579 
580  // Create the KineticaType object which facilitates creating types in the database
581  KineticaType type1 = KineticaType.fromClass( typeof( record_type_all ), column_properties );
582 
583  // Create the type in the database
584  string type_id = type1.create( kdb );
585  //Console.WriteLine( "ID of the created type: " + type_id );
586  //Console.WriteLine();
587  Console.WriteLine( "Created type.\n" );
588 
589  string table_name = "csharp_example_table_all_shards";
590  // Clear any previously made table with the same name
591  Console.WriteLine( "Clearing any existing table named '{0}'\n", table_name );
592  try { kdb.clearTable( table_name, null ); } catch ( Exception ex ) { /* I don't care if the table doesn't already exists! */ }
593  Console.WriteLine();
594 
595  // Create a table of the given type
596  Console.WriteLine( $"Creating table named '{table_name}'\n" );
597  kdb.createTable( table_name, type_id );
598  Console.WriteLine();
599 
600  // Create indices on the shard columns (6.2 limitation for key lookup)
601  kdb.alterTable( table_name, "create_index", "i8" );
602  kdb.alterTable( table_name, "create_index", "c1" );
603 
604  // Create the ingestor
605  int batch_size = 1000;
606  KineticaIngestor<record_type_all> ingestor = new KineticaIngestor<record_type_all>( kdb, table_name, batch_size, type1 );
607 
608 
609  // Generate data to be inserted
610  // Note that the current sharded columns (i8 and c1) will not
611  // get nulls since in 6.2, Kinetica does not support nulls for
612  // key lookup
613  int num_records = batch_size * 10;
614  Console.WriteLine( $"Starting to generate {num_records} records.\n" );
615  List<record_type_all> records = new List<record_type_all>();
616  Random rng = new Random();
617  double null_probability = 0.15; // 15% chance of creating nulls
618  double shard_null_probability = 0; // in 6.2, key lookup can't handle nulls
619  for ( int i = 0; i < num_records; ++i )
620  {
621  // Restricting string length to 256
622  int max_str_len = rng.Next( 0, 256 );
623  record_type_all record = new record_type_all()
624  {
625  i = ( rng.NextDouble() < null_probability ) ? null : (int?) rng.Next(),
626  i8 = ( rng.NextDouble() < shard_null_probability ) ? null : (int?) rng.Next( 110, 128 ), // Limiting the range in order to get multiple records per shard key
627  //i8 = ( rng.NextDouble() < shard_null_probability ) ? null : (int?) rng.Next( -128, 128 ), // upper exclusive
628  i16 = ( rng.NextDouble() < null_probability ) ? null : (int?) rng.Next( -32768, 32768), // upper exclusive
629  l = (long)rng.Next(),
630  //l = ( rng.NextDouble() < null_probability ) ? null : (long)rng.Next(), // can't be made nullable if not declared as long?
631  f = ( rng.NextDouble() < null_probability ) ? null : (float?)(rng.NextDouble() * rng.Next()),
632  d = ( rng.NextDouble() < null_probability ) ? null : ( double? ) ( rng.NextDouble() * rng.Next() ),
633  s = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( max_str_len ),
634  c1 = ( rng.NextDouble() < shard_null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( 1 ),
635  c2 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( 2 ),
636  c4 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 0, 5) ), // any size between empty string to 4 length
637  c8 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 0, 9) ), // any size between empty string to 8 length
638  c16 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 0, 17) ), // any size between empty string to 16 length
639  c32 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 5, 33) ), // any size between [5, 32] in length
640  c64 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 10, 65) ), // any size between [10, 64] in length
641  c128 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 10, 129) ), // any size between [10, 128] in length
642  c256 = ( rng.NextDouble() < null_probability ) ? null : System.IO.Path.GetRandomFileName().Truncate( rng.Next( 25, 257) ), // any size between [25, 256] in length
643  date = ( rng.NextDouble() < null_probability ) ? null : Test.generate_date( rng ),
644  datetime = (rng.NextDouble() < null_probability) ? null : Test.generate_datetime(rng),
645  decimal_ = (rng.NextDouble() < null_probability) ? null : Test.generate_decimal(rng),
646  ipv4 = ( rng.NextDouble() < null_probability ) ? null : Test.generate_IPv4( rng ),
647  time = (rng.NextDouble() < null_probability) ? null : Test.generate_time(rng),
648  timestamp = ( rng.NextDouble() < null_probability ) ? null : ((long?)rng.Next( -306102240, 293795424 ) * rng.Next( 100000 ))
649  };
650 
651  //Console.WriteLine( "#" + i + ": " + record.ToString() + "\n" ); // debug~~~~~~~~
652  records.Add( record );
653  ingestor.insert( record );
654  } // end for loop
655 
656  Console.WriteLine( $"Generated {num_records} records." );
657 
658  // Flush the ingestor (which actually inserts the records)
659  Console.WriteLine( "\nFlushing any remaining records." );
660  ingestor.flush();
661 
662  // Look up records by any key
663  Console.WriteLine("Creating the record retriever...");
664  RecordRetriever<record_type_all> retriever = new RecordRetriever<record_type_all>( kdb, table_name, type1 );
665  Console.WriteLine("Attempting record retrieval...");
666  // Perform the key lookup operations
667  GetRecordsResponse<record_type_all> response = retriever.getRecordsByKey( records[ 0 ] );
668  Console.WriteLine( "Number of records fetched: {0}", response.total_number_of_records );
669  Console.WriteLine( "Records fetched: ");
670  foreach ( var record in response.data )
671  Console.WriteLine( record.ToString() );
672 
673  Console.WriteLine( "Are there more records to fetch?: {0}", response.has_more_records);
674 
675  } // end test_record_retrieval_by_key()
676 
677 
678  private static void test_all_types_ip_regex_3shard_0pk( string server_url )
679  {
680  // Establish a connection with Kinetica
681  Kinetica kdb = new Kinetica( server_url );
682 
683  Console.WriteLine( "\n\n" );
684  Console.WriteLine( "Test Multihead Ingest with a Regex Given for Worker IP Addresses (3 shard keys, no PKs)" );
685  Console.WriteLine( "=======================================================================================" );
686  Console.WriteLine();
687 
688  // Create a type for our record_type_1 class
689  // Add some interesting properties for some of the data types
690  IDictionary<string, IList<string>> column_properties = new Dictionary<string, IList<string>>();
691  // Integer shard key
692  List<string> i_props = new List<string>();
693  i_props.Add( ColumnProperty.SHARD_KEY );
694  column_properties.Add( "i", i_props );
695  // Double shard key
696  List<string> d_props = new List<string>();
697  d_props.Add( ColumnProperty.SHARD_KEY );
698  column_properties.Add( "d", d_props );
699  // Short shard key
700  List<string> i16_props = new List<string>();
701  i16_props.Add( ColumnProperty.SHARD_KEY );
702  column_properties.Add( "i16", i16_props );
703 
704  // Create the KineticaType object which facilitates creating types in the database
705  KineticaType type1 = KineticaType.fromClass( typeof( record_type_all ), column_properties );
706 
707  // Create the type in the database
708  string type_id = type1.create( kdb );
709 
710  string table_name = "csharp_example_table_3s0pk";
711  // Clear any previously made table with the same name
712  Console.WriteLine( "Clearing any existing table named '{0}'", table_name );
713  try { kdb.clearTable( table_name, null ); } catch ( Exception ex ) { /* I don't care if the table doesn't already exists! */ }
714  Console.WriteLine();
715 
716  // Create a table of the given type
717  Console.WriteLine( $"Creating table named '{table_name}'" );
718  kdb.createTable( table_name, type_id );
719  Console.WriteLine();
720 
721  // Create the ingestor
722  int batch_size = 100;
723  // Note: May need to adjust the regex for this test to pass
724  Regex ip_regex = new Regex( "192.168.*" );
725  kinetica.Utils.WorkerList worker_list = new kinetica.Utils.WorkerList( kdb, ip_regex );
726  KineticaIngestor<record_type_all> ingestor = new KineticaIngestor<record_type_all>( kdb, table_name, batch_size, type1, null, worker_list );
727 
728  // Generate data to be inserted
729  int num_records = batch_size * 5;
730  List<record_type_all> records = new List<record_type_all>();
731  Random rng = new Random();
732  double null_probability = 0.2;
733  for ( int i = 0; i < num_records; ++i )
734  {
735  // Restricting string length to 256
736  int max_str_len = rng.Next( 0, 256 );
737  record_type_all record = new record_type_all()
738  {
739  i = rng.Next(),
740  i8 = rng.Next(),
741  i16 = rng.Next(),
742  l = (long)rng.Next(),
743  f = (float)(rng.NextDouble() * rng.Next()),
744  d = ( rng.NextDouble() < null_probability ) ? null : ( double? ) ( rng.NextDouble() * rng.Next() ),
745  s = System.IO.Path.GetRandomFileName().Truncate( max_str_len ),
746  c1 = System.IO.Path.GetRandomFileName().Truncate( 1 ),
747  c2 = System.IO.Path.GetRandomFileName().Truncate( 2 ),
748  c4 = System.IO.Path.GetRandomFileName().Truncate( 4 ),
749  c8 = System.IO.Path.GetRandomFileName().Truncate( 8 ),
750  c16 = System.IO.Path.GetRandomFileName().Truncate( 16 ),
751  c32 = System.IO.Path.GetRandomFileName().Truncate( 32 ),
752  c64 = System.IO.Path.GetRandomFileName().Truncate( 64 ),
753  c128 = System.IO.Path.GetRandomFileName().Truncate( 128 ),
754  c256 = System.IO.Path.GetRandomFileName().Truncate( 256 ),
755  date = Test.generate_date( rng ),
756  datetime = Test.generate_datetime( rng ),
757  decimal_ = Test.generate_decimal( rng ),
758  ipv4 = Test.generate_IPv4( rng ),
759  time = Test.generate_time( rng ),
760  timestamp = (long) rng.Next()
761  };
762 
763  //Console.WriteLine( record.ToString() ); // debug~~~~~~~~
764  records.Add( record );
765  } // end for loop
766 
767  Console.WriteLine( $"Generated {num_records} records." );
768 
769  // Insert the records into the ingestor
770  Console.WriteLine( $"Inserting {num_records} records..." );
771  ingestor.insert( records );
772 
773  // Flush the ingestor (which actually inserts the records)
774  Console.WriteLine( "\nFlushing any remaining records." );
775  ingestor.flush();
776  } // end test_all_types_ip_regex_3shard_0pk()
777 
778 
779 
780 
781  private static void test_all_types_3pk_3shard( string server_url )
782  {
783  // Establish a connection with Kinetica
784  Kinetica kdb = new Kinetica( server_url );
785 
786  Console.WriteLine( "\n\n" );
787  Console.WriteLine( "Test Multihead Ingest: One column per Type; 3 Primary Keys, 3 Shard Keys" );
788  Console.WriteLine( "========================================================================" );
789  Console.WriteLine();
790 
791  // Create a type for our record_type_1 class
792  // Add some interesting properties for some of the data types
793  IDictionary<string, IList<string>> column_properties = new Dictionary<string, IList<string>>();
794 
795  // long shard key, also primary key
796  List<string> l_props = new List<string>();
797  l_props.Add( ColumnProperty.PRIMARY_KEY );
798  l_props.Add( ColumnProperty.SHARD_KEY );
799  column_properties.Add( "l", l_props );
800 
801  // date primary key as well as shard key
802  List<string> date_props = new List<string>();
803  date_props.Add( ColumnProperty.DATE );
804  date_props.Add( ColumnProperty.PRIMARY_KEY );
805  date_props.Add( ColumnProperty.SHARD_KEY );
806  column_properties.Add( "date", date_props );
807 
808  // time primary key as well as shard
809  List<string> time_props = new List<string>();
810  time_props.Add( ColumnProperty.TIME );
811  time_props.Add( ColumnProperty.PRIMARY_KEY );
812  time_props.Add( ColumnProperty.SHARD_KEY );
813  column_properties.Add( "time", time_props );
814 
815  // Create the KineticaType object which facilitates creating types in the database
816  KineticaType type1 = KineticaType.fromClass( typeof( record_type_all ), column_properties );
817 
818  // Create the type in the database
819  string type_id = type1.create( kdb );
820  //Console.WriteLine( "ID of the created type: " + type_id );
821  //Console.WriteLine();
822 
823  string table_name = "csharp_example_table_3s3pk";
824  // Clear any previously made table with the same name
825  Console.WriteLine( "Clearing any existing table named '{0}'", table_name );
826  try { kdb.clearTable( table_name, null ); } catch ( Exception ex ) { /* I don't care if the table doesn't already exists! */ }
827  Console.WriteLine();
828 
829  // Create a table of the given type
830  Console.WriteLine( $"Creating table named '{table_name}'" );
831  kdb.createTable( table_name, type_id );
832  Console.WriteLine();
833 
834  // Create the ingestor
835  int batch_size = 100;
836  KineticaIngestor<record_type_all> ingestor = new KineticaIngestor<record_type_all>( kdb, table_name, batch_size, type1 );
837 
838  // Generate data to be inserted
839  int num_records = batch_size * 50;
840  Random rng = new Random();
841  double null_probability = 0.2;
842  for ( int i = 0; i < num_records; ++i )
843  {
844  // Restricting string length to 256
845  int max_str_len = rng.Next( 0, 256 );
846  record_type_all record = new record_type_all()
847  {
848  i = rng.Next(),
849  i8 = rng.Next(),
850  i16 = rng.Next(),
851  l = (long)rng.Next(),
852  f = (float)(rng.NextDouble() * rng.Next()),
853  d = ( rng.NextDouble() < null_probability ) ? null : ( double? ) ( rng.NextDouble() * rng.Next() ),
854  s = System.IO.Path.GetRandomFileName().Truncate( max_str_len ),
855  c1 = System.IO.Path.GetRandomFileName().Truncate( 1 ),
856  c2 = System.IO.Path.GetRandomFileName().Truncate( 2 ),
857  c4 = System.IO.Path.GetRandomFileName().Truncate( 4 ),
858  c8 = System.IO.Path.GetRandomFileName().Truncate( 8 ),
859  c16 = System.IO.Path.GetRandomFileName().Truncate( 16 ),
860  c32 = System.IO.Path.GetRandomFileName().Truncate( 32 ),
861  c64 = System.IO.Path.GetRandomFileName().Truncate( 64 ),
862  c128 = System.IO.Path.GetRandomFileName().Truncate( 128 ),
863  c256 = System.IO.Path.GetRandomFileName().Truncate( 256 ),
864  date = Test.generate_date( rng ),
865  datetime = Test.generate_datetime( rng ),
866  decimal_ = Test.generate_decimal( rng ),
867  ipv4 = Test.generate_IPv4( rng ),
868  time = Test.generate_time( rng ),
869  timestamp = (long) rng.Next()
870  };
871 
872  //Console.WriteLine( record.ToString() ); // debug~~~~~~~~
873  ingestor.insert( record );
874  } // end for loop
875 
876  Console.WriteLine( $"Generated {num_records} records." );
877 
878  // Flush the ingestor (which actually inserts the records)
879  Console.WriteLine( "\nFlushing any remaining records." );
880  ingestor.flush();
881  } // end test_all_types_3pk_3shard()
882 
883 
884 
885  private static void test_all_types_3pk_0shard( string server_url )
886  {
887  // Establish a connection with Kinetica
888  Kinetica kdb = new Kinetica( server_url );
889 
890  Console.WriteLine( "\n\n" );
891  Console.WriteLine( "Test Multihead Ingest: One column per type; 3 Primary Keys, No Shard Key" );
892  Console.WriteLine( "========================================================================" );
893  Console.WriteLine();
894 
895  // Create a type for our record_type_1 class
896  // Add some interesting properties for some of the data types
897  IDictionary<string, IList<string>> column_properties = new Dictionary<string, IList<string>>();
898 
899  // long primary key
900  List<string> l_props = new List<string>();
901  l_props.Add( ColumnProperty.PRIMARY_KEY );
902  column_properties.Add( "l", l_props );
903 
904  // date primary key
905  List<string> date_props = new List<string>();
906  date_props.Add( ColumnProperty.PRIMARY_KEY );
907  column_properties.Add( "date", date_props );
908 
909  // time primary key as well as shard
910  List<string> time_props = new List<string>();
911  time_props.Add( ColumnProperty.PRIMARY_KEY );
912  column_properties.Add( "time", time_props );
913 
914  // Create the KineticaType object which facilitates creating types in the database
915  KineticaType type1 = KineticaType.fromClass( typeof( record_type_all ), column_properties );
916 
917  // Create the type in the database
918  string type_id = type1.create( kdb );
919  //Console.WriteLine( "ID of the created type: " + type_id );
920  //Console.WriteLine();
921 
922  string table_name = "csharp_example_table_0s3pk";
923  // Clear any previously made table with the same name
924  Console.WriteLine( "Clearing any existing table named '{0}'", table_name );
925  try { kdb.clearTable( table_name, null ); } catch ( Exception ex ) { /* I don't care if the table doesn't already exists! */ }
926  Console.WriteLine();
927 
928  // Create a table of the given type
929  Console.WriteLine( $"Creating table named '{table_name}'" );
930  kdb.createTable( table_name, type_id );
931  Console.WriteLine();
932 
933  // Create the ingestor
934  int batch_size = 100;
935  KineticaIngestor<record_type_all> ingestor = new KineticaIngestor<record_type_all>( kdb, table_name, batch_size, type1 );
936 
937  // Generate data to be inserted
938  int num_records = batch_size * 50;
939  Random rng = new Random();
940  double null_probability = 0.2;
941  for ( int i = 0; i < num_records; ++i )
942  {
943  // Restricting string length to 256
944  int max_str_len = rng.Next( 0, 256 );
945  record_type_all record = new record_type_all()
946  {
947  i = rng.Next(),
948  i8 = rng.Next(),
949  i16 = rng.Next(),
950  l = (long)rng.Next(),
951  f = (float)(rng.NextDouble() * rng.Next()),
952  d = ( rng.NextDouble() < null_probability ) ? null : ( double? ) ( rng.NextDouble() * rng.Next() ),
953  s = System.IO.Path.GetRandomFileName().Truncate( max_str_len ),
954  c1 = System.IO.Path.GetRandomFileName().Truncate( 1 ),
955  c2 = System.IO.Path.GetRandomFileName().Truncate( 2 ),
956  c4 = System.IO.Path.GetRandomFileName().Truncate( 4 ),
957  c8 = System.IO.Path.GetRandomFileName().Truncate( 8 ),
958  c16 = System.IO.Path.GetRandomFileName().Truncate( 16 ),
959  c32 = System.IO.Path.GetRandomFileName().Truncate( 32 ),
960  c64 = System.IO.Path.GetRandomFileName().Truncate( 64 ),
961  c128 = System.IO.Path.GetRandomFileName().Truncate( 128 ),
962  c256 = System.IO.Path.GetRandomFileName().Truncate( 256 ),
963  date = Test.generate_date( rng ),
964  datetime = Test.generate_datetime( rng ),
965  decimal_ = Test.generate_decimal( rng ),
966  ipv4 = Test.generate_IPv4( rng ),
967  time = Test.generate_time( rng ),
968  timestamp = (long) rng.Next()
969  };
970 
971  //Console.WriteLine( record.ToString() ); // debug~~~~~~~~
972  ingestor.insert( record );
973  } // end for loop
974 
975  Console.WriteLine( $"Generated {num_records} records." );
976 
977  // Flush the ingestor (which actually inserts the records)
978  Console.WriteLine( "\nFlushing any remaining records." );
979  ingestor.flush();
980  } // end test_all_types_3pk_0shard()
981 
982 
983 
989  public static string generate_date( Random rng )
990  {
991  int past_range = -90 * 365; //980 years
992  int future_range = 20 * 365; // 20 years
993  int offset = rng.Next( past_range, future_range );
994  DateTime random_date = DateTime.Today.AddDays( offset );
995  return String.Format( "{0:yyyy-MM-dd}", random_date );
996  } // end generate_date
997 
998 
999 
1005  public static string generate_datetime( Random rng )
1006  {
1007  int past_range = -90 * 365; //980 years
1008  int future_range = 20 * 365; // 20 years
1009  int offset = rng.Next( past_range, future_range );
1010  int year = rng.Next(1900, 2500);
1011  int month = rng.Next(1, 12);
1012  int day = rng.Next(1, 28);
1013  int hour = rng.Next(0, 23);
1014  int minute = rng.Next(0, 59);
1015  int second = rng.Next(0, 59);
1016  int msecond = rng.Next(0, 999);
1017 
1018  DateTime random_datetime = new DateTime( year, month, day,
1019  hour, minute, second, msecond );
1020 
1021  // We don't have to have any time component
1022  int time_chance_percent = 90;
1023  if (rng.Next(101) > time_chance_percent)
1024  return String.Format("{0:yyyy-MM-dd}", random_datetime);
1025  else
1026  {
1027  // Don't have to have the millisecond
1028  int num_ms_digits = rng.Next(7);
1029  switch (num_ms_digits)
1030  {
1031  case 0:
1032  return String.Format("{0:yyyy-MM-dd HH:mm:ss}", random_datetime);
1033  case 1:
1034  return String.Format("{0:yyyy-MM-dd HH:mm:ss.F}", random_datetime);
1035  case 2:
1036  return String.Format("{0:yyyy-MM-dd HH:mm:ss.FF}", random_datetime);
1037  case 3:
1038  return String.Format("{0:yyyy-MM-dd HH:mm:ss.FFF}", random_datetime);
1039  case 4:
1040  return String.Format("{0:yyyy-MM-dd HH:mm:ss.FFFF}", random_datetime);
1041  case 5:
1042  return String.Format("{0:yyyy-MM-dd HH:mm:ss.FFFFF}", random_datetime);
1043  case 6:
1044  default: // not necessary, but the stupid compiler complains
1045  return String.Format("{0:yyyy-MM-dd HH:mm:ss.FFFFFF}", random_datetime);
1046  }
1047  }
1048  } // end generate_datetime
1049 
1050 
1051 
1052  private static readonly string numbers = "0123456789";
1053 
1060  public static string generate_decimal( Random rng )
1061  {
1062  string sign = (rng.Next( 2 ) == 0) ? "-" : "";
1063  // Using up to 14 integral digits to keep things simple since the decimal
1064  // range is [-922337203685477.5808, 922337203685477.5807]
1065  string precision = new string( Enumerable.Repeat( '1', rng.Next( 15 ) ).Select( i => Test.numbers[ rng.Next( numbers.Length ) ] ).ToArray() );
1066  string scale = rng.Next( 0, 10000 ).ToString();
1067  return ( sign + precision + "." + scale );
1068  } // end generate_decimal
1069 
1070 
1071 
1077  public static string generate_IPv4( Random rng )
1078  {
1079  string n1 = rng.Next( 256 ).ToString();
1080  string n2 = rng.Next( 256 ).ToString();
1081  string n3 = rng.Next( 256 ).ToString();
1082  string n4 = rng.Next( 256 ).ToString();
1083  string dot = ".";
1084  return ( n1 + dot + n2 + dot + n3 + dot + n4 );
1085  } // end generate_ipv4
1086 
1087 
1088 
1094  public static string generate_time( Random rng )
1095  {
1096  int max_miliseconds = 86400000;
1097  DateTime time = DateTime.Today;
1098  //Console.WriteLine( time.ToLongTimeString() ); // debug~~~~~~~~
1099  time = time.Add( TimeSpan.FromMilliseconds( rng.Next( max_miliseconds ) ) );
1100  //Console.WriteLine( String.Format( "{0:HH}:{0:mm}:{0:ss}.{0:FFF}", time ) ); // debug~~~~~~
1101  string time_str;
1102  if ( (time.Millisecond > 0) && (rng.Next( 1, 6 ) > 3) ) // two in five will get the milliseconds
1103  time_str = String.Format( "{0:HH}:{0:mm}:{0:ss}.{0:FFF}", time );
1104  else
1105  time_str = String.Format( "{0:HH}:{0:mm}:{0:ss}", time );
1106  return time_str;
1107  } // end generate_time
1108 
1109 
1110  } // end class Test
1111 } // end namespace Test
1112 
1113 
1114 
1115 
1116 
1117 
1118 
1119 
1120 
1121 
1122 
1123 
1124 
1125 
1126 
1127 
Runs some tests on multihead ingestion.
Definition: Test.cs:36
A list of worker URLs to use for multi-head ingest.
Definition: WorkerList.cs:11
static string generate_decimal(Random rng)
Generate a random decimal value (up to 15 digits of precision and up to four digits of scale)...
Definition: Test.cs:1060
static string generate_time(Random rng)
Generate a random time of the format HH:MM:SS[.mmm].
Definition: Test.cs:1094
static string generate_date(Random rng)
Generate a random date.
Definition: Test.cs:989
static string generate_IPv4(Random rng)
Generate a random IPv4 address.
Definition: Test.cs:1077
static string generate_datetime(Random rng)
Generate a random datetime.
Definition: Test.cs:1005
Extension to string that has a truncate function.
Definition: Test.cs:19
Connection Options
Definition: Kinetica.cs:50
static string Truncate(this string value, int maxLength)
Definition: Test.cs:21
API to talk to Kinetica Database
Definition: Kinetica.cs:40