OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HeavyDBGeoTypeNameSpec.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl.heavydb;
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 HeavyDBGeoTypeNameSpec extends SqlBasicTypeNameSpec {
15  private boolean isGeography;
17 
19  Integer coordinateSystem,
20  boolean isGeography,
21  Pair<HeavyDBEncoding, 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 }
HeavyDBGeoTypeNameSpec(HeavyDBGeo geoType, Integer coordinateSystem, boolean isGeography, Pair< HeavyDBEncoding, Integer > encodingInfo, SqlParserPos pos)
Map< String, Object > toJsonMap(Map< String, Object > map)