@@ -621,6 +621,25 @@ public void Test_BasicTable_addColumn_colName_null() throws Exception {
621
621
assertEquals ("The param 'colName' or 'col' in table cannot be null." ,re );
622
622
}
623
623
@ Test
624
+ public void Test_BasicTable_addColumn_colName_null_1 () throws Exception {
625
+ DBConnection conn = new DBConnection (false , false , false );
626
+ conn .connect (HOST , PORT , "admin" , "123456" );
627
+ BasicTable bt = (BasicTable ) conn .run ("t = table(1 2 3 as int1);select * from t" );
628
+ System .out .println (bt .getString ());
629
+ BasicBooleanVector bbv = new BasicBooleanVector (1 );
630
+ bbv .setNull (0 );
631
+ bbv .add ((byte ) 1 );
632
+ bbv .add ((byte ) 0 );
633
+ System .out .println (bbv .getString ());
634
+ String re = null ;
635
+ try {
636
+ bt .addColumn ("" , bbv );
637
+ }catch (Exception e ){
638
+ re = e .getMessage ();
639
+ }
640
+ assertEquals ("The param 'colName' cannot be empty." ,re );
641
+ }
642
+ @ Test
624
643
public void Test_BasicTable_addColumn_col_null () throws Exception {
625
644
BasicTable bt = createBasicTable ();
626
645
String re = null ;
@@ -644,6 +663,35 @@ public void Test_BasicTable_addColumn_dataLength_not_match() throws Exception {
644
663
assertEquals ("The length of column col1 must be the same as the first column length: 2." ,re );
645
664
}
646
665
@ Test
666
+ public void Test_BasicTable_addColumn_table_null () throws Exception {
667
+ DBConnection conn = new DBConnection (false , false , true );
668
+ conn .connect (HOST , PORT , "admin" , "123456" );
669
+ BasicTable bt = (BasicTable ) conn .run ("t = table(1:0,[`int1] ,[INT]);select * from t" );
670
+ System .out .println (bt .getString ());
671
+ BasicBooleanVector bbv = new BasicBooleanVector (0 );
672
+ System .out .println (bbv .getString ());
673
+ bt .addColumn ("112121212212567881" , bbv );
674
+ bt .addColumn ("中文test_121212123224234SHFSDHDFD `zzz@$%^&*()_+:“-=[]{}" , bbv );
675
+ bt .addColumn ("count" , bbv );
676
+ bt .addColumn ("addColumn" , bbv );
677
+ System .out .println (bt .getString ());
678
+ assertEquals ("112121212212567881" ,bt .getColumnName (1 ));
679
+ assertEquals ("中文test_121212123224234SHFSDHDFD `zzz@$%^&*()_+:“-=[]{}" ,bt .getColumnName (2 ));
680
+ assertEquals ("count" ,bt .getColumnName (3 ));
681
+ assertEquals ("addColumn" ,bt .getColumnName (4 ));
682
+ }
683
+ @ Test
684
+ public void Test_BasicTable_addColumn_bigData () throws Exception {
685
+ DBConnection conn = new DBConnection (false , false , false );
686
+ conn .connect (HOST , PORT , "admin" , "123456" );
687
+ BasicTable bt = (BasicTable ) conn .run ("t = table(1..100000000 as int1);select * from t" );
688
+ System .out .println (bt .getString ());
689
+ BasicIntVector bbv = (BasicIntVector )conn .run ("tt = table(2..100000001 as int1);exec * from tt" );
690
+ bt .addColumn ("col1" , bbv );
691
+ System .out .println (bt .getString ());
692
+ assertEquals ("[2,3,4,5,6,7,8,9,10,11,...]" ,bt .getColumn (1 ).getString ());
693
+ }
694
+ @ Test
647
695
public void Test_BasicTable_addColumn_BOOL () throws Exception {
648
696
DBConnection conn = new DBConnection (false , false , false );
649
697
conn .connect (HOST , PORT , "admin" , "123456" );
@@ -983,6 +1031,25 @@ public void Test_BasicTable_addColumn_BLOB() throws Exception {
983
1031
assertEquals ("[GOOG,MS,]" ,bt .getColumn (1 ).getString ());
984
1032
}
985
1033
@ Test
1034
+ public void Test_BasicTable_addColumn_BLOB_bigData () throws Exception {
1035
+ DBConnection conn = new DBConnection (false , false , false );
1036
+ conn .connect (HOST , PORT , "admin" , "123456" );
1037
+ BasicTable bt = (BasicTable ) conn .run ("t = table(1 as int1);select * from t" );
1038
+ System .out .println (bt .getString ());
1039
+
1040
+ BasicStringVector bbv = (BasicStringVector )conn .run ("blob([concat(take(`abcd中文123,100000))])" );
1041
+ System .out .println (bbv .getString ());
1042
+ bt .addColumn ("col1" , bbv );
1043
+ System .out .println (bt .getString ());
1044
+ String d = "abcd中文123" ;
1045
+ String dd = "" ;
1046
+ for (int i = 0 ; i < 100000 ; i ++) {
1047
+ dd += d ;
1048
+ }
1049
+ BasicString data = new BasicString (dd );
1050
+ assertEquals ("[" +data .getString ()+"]" ,bt .getColumn (1 ).getString ());
1051
+ }
1052
+ @ Test
986
1053
public void Test_BasicTable_addColumn_COMPLEX () throws Exception {
987
1054
DBConnection conn = new DBConnection (false , false , false );
988
1055
conn .connect (HOST , PORT , "admin" , "123456" );
0 commit comments