OmniSciDB  72180abbfe
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com.mapd.calcite.parser.MapDTable Class Reference
+ Inheritance diagram for com.mapd.calcite.parser.MapDTable:
+ Collaboration diagram for com.mapd.calcite.parser.MapDTable:

Public Member Functions

long getVersion ()
 
 MapDTable (TTableDetails ri)
 
RelDataType getRowType (RelDataTypeFactory rdtf)
 
Statistic getStatistic ()
 
Schema.TableType getJdbcTableType ()
 
boolean isRolledUp (String string)
 
boolean rolledUpColumnValidInsideAgg (String string, SqlCall sc, SqlNode sn, CalciteConnectionConfig ccc)
 
boolean isSystemColumn (final String columnName)
 

Static Package Attributes

static final Logger MAPDLOGGER = LoggerFactory.getLogger(MapDTable.class)
 

Private Member Functions

RelDataType createType (TColumnType value, RelDataTypeFactory typeFactory)
 
RelDataType getRelDataType (TDatumType dType, int precision, int scale, RelDataTypeFactory typeFactory)
 

Private Attributes

final TTableDetails rowInfo
 
final long version = VERSION_PROVIDER.incrementAndGet()
 
final HashSet< String > systemColumnNames
 

Static Private Attributes

static final AtomicLong VERSION_PROVIDER = new AtomicLong()
 

Detailed Description

Author
michael

Definition at line 37 of file MapDTable.java.

Constructor & Destructor Documentation

com.mapd.calcite.parser.MapDTable.MapDTable ( TTableDetails  ri)
inline

Definition at line 49 of file MapDTable.java.

References com.mapd.calcite.parser.MapDTable.rowInfo, and com.mapd.calcite.parser.MapDTable.systemColumnNames.

49  {
50  rowInfo = ri;
51  systemColumnNames = rowInfo.row_desc.stream()
52  .filter(row_desc -> row_desc.is_system)
53  .map(row_desc -> row_desc.col_name)
54  .collect(Collectors.toCollection(HashSet::new));
55  }
final HashSet< String > systemColumnNames
Definition: MapDTable.java:43
final TTableDetails rowInfo
Definition: MapDTable.java:41

Member Function Documentation

RelDataType com.mapd.calcite.parser.MapDTable.createType ( TColumnType  value,
RelDataTypeFactory  typeFactory 
)
inlineprivate

Definition at line 81 of file MapDTable.java.

References com.mapd.calcite.parser.MapDTable.getRelDataType().

Referenced by com.mapd.calcite.parser.MapDTable.getRowType().

81  {
82  RelDataType cType = getRelDataType(value.col_type.type,
83  value.col_type.precision,
84  value.col_type.scale,
85  typeFactory);
86 
87  if (value.col_type.is_array) {
88  cType = typeFactory.createArrayType(
89  typeFactory.createTypeWithNullability(cType, true), -1);
90  }
91 
92  if (value.col_type.isNullable()) {
93  return typeFactory.createTypeWithNullability(cType, true);
94  } else {
95  return cType;
96  }
97  }
RelDataType getRelDataType(TDatumType dType, int precision, int scale, RelDataTypeFactory typeFactory)
Definition: MapDTable.java:102

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Schema.TableType com.mapd.calcite.parser.MapDTable.getJdbcTableType ( )
inline

Definition at line 77 of file MapDTable.java.

77  {
78  return Schema.TableType.TABLE;
79  }
RelDataType com.mapd.calcite.parser.MapDTable.getRelDataType ( TDatumType  dType,
int  precision,
int  scale,
RelDataTypeFactory  typeFactory 
)
inlineprivate

Definition at line 102 of file MapDTable.java.

Referenced by com.mapd.calcite.parser.MapDTable.createType().

103  {
104  switch (dType) {
105  case TINYINT:
106  return typeFactory.createSqlType(SqlTypeName.TINYINT);
107  case SMALLINT:
108  return typeFactory.createSqlType(SqlTypeName.SMALLINT);
109  case INT:
110  return typeFactory.createSqlType(SqlTypeName.INTEGER);
111  case BIGINT:
112  return typeFactory.createSqlType(SqlTypeName.BIGINT);
113  case FLOAT:
114  return typeFactory.createSqlType(SqlTypeName.FLOAT);
115  case DECIMAL:
116  return typeFactory.createSqlType(SqlTypeName.DECIMAL, precision, scale);
117  case DOUBLE:
118  return typeFactory.createSqlType(SqlTypeName.DOUBLE);
119  case STR:
120  return typeFactory.createSqlType(SqlTypeName.VARCHAR, 50);
121  case TIME:
122  return typeFactory.createSqlType(SqlTypeName.TIME);
123  case TIMESTAMP:
124  return typeFactory.createSqlType(SqlTypeName.TIMESTAMP, precision);
125  case DATE:
126  return typeFactory.createSqlType(SqlTypeName.DATE);
127  case BOOL:
128  return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
129  case INTERVAL_DAY_TIME:
130  return typeFactory.createSqlType(SqlTypeName.INTERVAL_DAY);
131  case INTERVAL_YEAR_MONTH:
132  return typeFactory.createSqlType(SqlTypeName.INTERVAL_YEAR_MONTH);
133  case POINT:
134  return typeFactory.createSqlType(SqlTypeName.ANY);
135  // return new PointSqlType();
136  case LINESTRING:
137  return typeFactory.createSqlType(SqlTypeName.ANY);
138  // return new LinestringSqlType();
139  case POLYGON:
140  return typeFactory.createSqlType(SqlTypeName.ANY);
141  // return new PolygonSqlType();
142  case MULTIPOLYGON:
143  return typeFactory.createSqlType(SqlTypeName.ANY);
144  default:
145  throw new AssertionError(dType.name());
146  }
147  }

+ Here is the caller graph for this function:

RelDataType com.mapd.calcite.parser.MapDTable.getRowType ( RelDataTypeFactory  rdtf)
inline

Definition at line 58 of file MapDTable.java.

References com.mapd.calcite.parser.MapDTable.createType(), and com.mapd.calcite.parser.MapDTable.rowInfo.

58  {
59  RelDataTypeFactory.FieldInfoBuilder builder = rdtf.builder();
60  for (TColumnType tct : rowInfo.getRow_desc()) {
61  MAPDLOGGER.debug("'" + tct.col_name + "'"
62  + " \t" + tct.getCol_type().getEncoding() + " \t"
63  + tct.getCol_type().getFieldValue(TTypeInfo._Fields.TYPE) + " \t"
64  + tct.getCol_type().nullable + " \t" + tct.getCol_type().is_array + " \t"
65  + tct.getCol_type().precision + " \t" + tct.getCol_type().scale);
66  builder.add(tct.col_name, createType(tct, rdtf));
67  }
68  return builder.build();
69  }
RelDataType createType(TColumnType value, RelDataTypeFactory typeFactory)
Definition: MapDTable.java:81
final TTableDetails rowInfo
Definition: MapDTable.java:41

+ Here is the call graph for this function:

Statistic com.mapd.calcite.parser.MapDTable.getStatistic ( )
inline

Definition at line 72 of file MapDTable.java.

72  {
73  return Statistics.UNKNOWN;
74  }
long com.mapd.calcite.parser.MapDTable.getVersion ( )
inline

Definition at line 45 of file MapDTable.java.

References com.mapd.calcite.parser.MapDTable.version.

45  {
46  return version;
47  }
boolean com.mapd.calcite.parser.MapDTable.isRolledUp ( String  string)
inline

Definition at line 150 of file MapDTable.java.

150  {
151  // will set to false by default
152  return false;
153  }
boolean com.mapd.calcite.parser.MapDTable.isSystemColumn ( final String  columnName)
inline

Definition at line 162 of file MapDTable.java.

162  {
163  return systemColumnNames.contains(columnName);
164  }
boolean com.mapd.calcite.parser.MapDTable.rolledUpColumnValidInsideAgg ( String  string,
SqlCall  sc,
SqlNode  sn,
CalciteConnectionConfig  ccc 
)
inline

Definition at line 156 of file MapDTable.java.

157  {
158  throw new UnsupportedOperationException(
159  "rolledUpColumnValidInsideAgg Not supported yet.");
160  }

Member Data Documentation

final Logger com.mapd.calcite.parser.MapDTable.MAPDLOGGER = LoggerFactory.getLogger(MapDTable.class)
staticpackage

Definition at line 40 of file MapDTable.java.

final TTableDetails com.mapd.calcite.parser.MapDTable.rowInfo
private
final HashSet<String> com.mapd.calcite.parser.MapDTable.systemColumnNames
private

Definition at line 43 of file MapDTable.java.

Referenced by com.mapd.calcite.parser.MapDTable.MapDTable().

final long com.mapd.calcite.parser.MapDTable.version = VERSION_PROVIDER.incrementAndGet()
private

Definition at line 42 of file MapDTable.java.

Referenced by com.mapd.calcite.parser.MapDTable.getVersion().

final AtomicLong com.mapd.calcite.parser.MapDTable.VERSION_PROVIDER = new AtomicLong()
staticprivate

Definition at line 38 of file MapDTable.java.


The documentation for this class was generated from the following file: