OmniSciDB  b28c0d5765
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HeavyAIData.java
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package ai.heavy.jdbc;
17 
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20 
21 import ai.heavy.thrift.server.TColumn;
22 import ai.heavy.thrift.server.TColumnData;
23 import ai.heavy.thrift.server.TDatumType;
24 
25 class HeavyAIData {
26  final static Logger logger = LoggerFactory.getLogger(HeavyAIData.class);
27  private TDatumType colType;
28 
29  TColumn tcolumn;
30 
31  HeavyAIData(TDatumType col_type) {
32  tcolumn = new TColumn();
33  colType = col_type;
34  tcolumn.data = new TColumnData();
35  }
36 
37  void add(String value) {
38  tcolumn.data.addToStr_col(value);
39  tcolumn.addToNulls(false);
40  }
41 
42  void add(int value) {
43  tcolumn.data.addToInt_col(value);
44  tcolumn.addToNulls(false);
45  }
46 
47  void setNull(boolean b) {
48  if (colType == TDatumType.STR)
49  tcolumn.data.addToStr_col(null);
50  else
51  tcolumn.data.addToInt_col(0);
52  tcolumn.addToNulls(b);
53  }
54 
55  TColumn getTColumn() {
56  return tcolumn;
57  }
58 }
static final Logger logger
HeavyAIData(TDatumType col_type)
void setNull(boolean b)
void add(String value)