OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OmniSciGeoTypeNameSpec.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl.omnisci;
2 
3 import org.apache.calcite.sql.SqlBasicTypeNameSpec;
4 import org.apache.calcite.sql.parser.SqlParserPos;
5 import org.apache.calcite.sql.type.SqlTypeName;
7 import org.apache.calcite.util.Pair;
8 
9 import java.util.Map;
10 
11 public class OmniSciGeoTypeNameSpec extends SqlBasicTypeNameSpec {
13  private Integer encodingSize;
15  private boolean isGeography;
16  private Integer coordinateSystem;
17 
19  Integer coordinateSystem,
20  boolean isGeography,
21  Pair<OmniSciEncoding, Integer> encodingInfo,
22  SqlParserPos pos) {
23  super(SqlTypeName.GEOMETRY, pos);
24  this.geoType = geoType;
25  this.coordinateSystem = coordinateSystem;
26  if (encodingInfo != null) {
27  this.encodingType = encodingInfo.left;
28  this.encodingSize = encodingInfo.right;
29  }
30  }
31 
32  public Map<String, Object> toJsonMap(Map<String, Object> map) {
34  if (isGeography) {
35  jsonBuilder.put(map, "sqltype", "GEOGRAPHY");
36  } else {
37  jsonBuilder.put(map, "sqltype", "GEOMETRY");
38  }
39 
40  if (encodingType != null) {
41  jsonBuilder.put(map, "encodingType", encodingType.name());
42  jsonBuilder.put(map, "encodingSize", encodingSize);
43  }
44 
45  jsonBuilder.put(map, "subtype", geoType.toString());
46  jsonBuilder.put(map, "coordinateSystem", coordinateSystem);
47 
48  return map;
49  }
50 }
OmniSciGeoTypeNameSpec(OmniSciGeo geoType, Integer coordinateSystem, boolean isGeography, Pair< OmniSciEncoding, Integer > encodingInfo, SqlParserPos pos)
Map< String, Object > toJsonMap(Map< String, Object > map)