LAT Reference
LAT Data Types in Loading
data pipelines are now the preferred method for loading data into the ocient system for details, see docid\ xq0tg7yph vn62uwufibu after extracting from source files or topics, data can be transformed and mapped to target columns in {{ocient}} tables lat automatically binds many primitive source data types to ocient column data types and automatically converts some source types to the target column type different source data types automatically bind to target columns using different conventions for example, a string in json such as '123' that loads into an int column properly binds to the corresponding integer value 123 similarly, an integer like 456 can automatically bind to an int column as 456 , a float column as 456 0 , and a varchar column as '456' finally, a string including well known text (wkt) representation of a point automatically binds into an st point column empty string handling when you attempt to load an empty string into a target column with lat, most data types raise an error and the record does not load into the target table the exceptions are varchar , decimal , binary , and array column types in those cases, the data warehouse loads these values varchar an empty string decimal 0 0 (with the appropriate precision) binary an empty binary blob array an empty array when you extract data from text based formats like delimited data, the data warehouse loads empty data as an empty string unless you use the empty as null setting null handling if you do not provide a value for a column in the target table, this table explains what value the data warehouse stores in the column for the purposes of default value handling, these are equivalent pipeline is missing a column pipeline includes a column but the value in the json or the source data evaluates to null pipeline includes a column but the field is missing on the source record (e g , a b does not exist in a json record) to transform a null or missing value into a default in the pipeline, use the transformation functions for example not null(a b, 'my default') ocient column definition database behavior when column is missing or column value evaluates to null not null with default default not null with no default record fails nullable with default default nullable with no default null data type binding refer to the docid\ ogtviwl gtbgv0chhrh 3 for detailed information about each data type these tables describe the automatic binding conventions of each data type bigint valid json bind types number, string note number and string can be either integer or floating point values and are converted to 64 bit signed integers decimals are dropped '+',' ' can be used at the beginning of a string to indicate sign string overflows result in errors, while numeric overflows are silent example { "number bigint" 1 0, "string bigint" "1" } > 1, 1 binary valid json bind types string note converted as utf 8 to binary each character in the string taking its binary representation example { "string binary" "hello" } > binary(01101000 01100101 01101100 01101100 01101111) boolean valid json bind types boolean, string note for a value of true, a string must be one of (case insensitive) true, t, yes, on, y, 1 for a value of false, a string must be one of (case insensitive) false, f, no, off, n, 0 example { "boolean" true, "string 0" "yes", "string 1" "false" } > true, true, false date valid json bind types string, number note if string, must be in format "yyyy mm dd" if number must be an epoch day use the built in to date function to convert a string with a different date format to an epoch day and bind example { "string date" "2021 11 04", "epoch date" 0 } > date(2021 11 04), date(1970 01 01) decimal valid json bind types number, string valid logical types decimal note number and string can be either integer or floating point values precision and scale for the loaded data are defined by the database table definition the target column must support enough digits both before and after the decimal point to accommodate decimal values extracted from fixed width binary or other record formats that support decimal data if insufficient precision or scale exists in the target column, the data will fail to load example { "number decimal" 1 0, "string decimal" "1 1" } > decimal(1 0), decimal(1 1) double , double precision valid json bind types number, string note number and string can be either integer or floating point values example { "number double" 1 0, "string double" "1" } > 1 0, 1 0 hash valid json bind types string note converted as hexadecimal to binary each character in the string must be a valid hexadecimal digit /\[0 9a f]+/i example { "hex string" "0a1b" } > hash(0000 1010 0001 1011) int valid json bind types number, string note number and string can be either integer or floating point values and are converted to 32 bit signed integers decimals are dropped '+',' ' can be used at the beginning of a string to indicate sign string overflows result in errors, while numeric overflows are silent example { "number int" 1 0, "string int" "1" } > 1, 1 ipv4 valid json bind types string note source data must be in the form \[0 255] \[0 255] \[0 255] \[0 255] example { "string ipv4" "192 168 0 1" } > ipv4(192 168 0 1) ip valid json bind types string note source string can be in ipv4 or ipv6 format ipv6 can appear in full form as shown in this example or in condensed form condensed form can use notation (e g , 2001\ cdba 3257 9652) and leading zeros in ipv6 hextets can also be omitted (e g , 2001 0db8 0000 0000 0000 0000 3257 9652 → 2001\ db8 0 0 0 0 3257 9652) ipv6 can also appear as a string of 32 hex characters without colons (e g , 2001cdba000000000000000032579652) example { "string ip ipv4" "192 168 0 1", "string ip ipv6" "2001\ cdba 0000 0000 0000 0000 3257 9652" } > ip(192 168 0 1), ip(2001\ cdba 0000 0000 0000 0000 3257 9652) linestring , st linestring valid json bind types string note must be in the wkt format "linestring(long lat, … )" or "linestring empty" example { "string st linestring" "linestring( 71 064544 42 28787, 90 444444 89 562993)" } > st linestring( 71 064544 42 28787, 90 444444 89 562993) matrix valid json bind types array\[array], string note arrays must be two dimensional with the same rows and columns as specified in the table string must be in json two dimensional array format each element will be cast according the the element type’s rules in this section example { "int matrix" \[\[0, 1, 2],\[3, 4, 5],\[6, 7, 8]], "string matrix" "\[\[0,1],\[2,3]]" } > matrix\[\[0,1,2],\[3,4,5],\[6,7,8]], matrix\[\[0,1],\[2,3]] point , st point valid json bind types string note must be in the format "point(long lat)" example { "string st point" "point( 71 064544 42 28787)" } > st point( 71 064544, 42 28787) polygon , st polygon ensure that polygons are oriented in your intended way when you load them as polygon orientation matters in ocient semantics if you intend all polygons to be oriented counter clockwise, use the docid\ ogtlpyxjm1lxxexmufuxl transform function to enforce counter clockwise semantics valid json bind types string note must be in the wkt format "polygon((long lat, … ))" or "polygon((long lat, … ), (long lat, … ))" or "polygon empty" example { "string st polygon" "polygon(( 87 62 41 87, 89 40 43 07, 87 906 43 04, 87 62 41 87))" } > st polygon(( 87 62 41 87, 89 40 43 07, 87 906 43 04, 87 62 41 87)) real , float , single precision valid json bind types number, string note number and string can be either integer or floating point values precision and scale are inherited from the table definition example { "number float" 1 0, "string float" "1" } > 1 0, 1 0 smallint valid json bind types number, string note number and string can be either integer or floating point values and are converted to 16 bit signed integers decimals are dropped '+',' ' can be used at the beginning of a string to indicate sign string overflows result in errors, while numeric overflows are silent example { "number smallint" 1 0, "string smallint" "1" } > 1, 1 time valid json bind types number, string note string must be in the format hh\ mm\ ss\[ sssssssss] number must represent nanoseconds since midnight use the to time transformation function to convert an arbitrary string format to nanoseconds and bind example { "number time" 1000000000, "string time" "07 33 10 0001" } > time(00 00 01 0000), time(07 33 10 0001) timestamp valid json bind types number, string note string must be in the format yyyy mm dd hh\ mm\ ss\[ sssssssss] number must represent nanoseconds since epoch use the to timestamp transformation function to convert an arbitrary string format to nanoseconds and bind example { "number timestamp" 1000000000, "string timestamp" "2021 11 04 07 33 10 0001" } > timestamp(1970 01 01 00 00 01 0000), timestamp(2021 11 04 07 33 10 0001) tinyint , byte valid json bind types number, string note number and string can be either integer or floating point values and are converted to 8 bit signed integers decimals are dropped '+',' ' can be used at the beginning of a string to indicate sign string overflows result in errors, while numeric overflows are silent example { "number smallint" 1 0, "string smallint" "1" } > 1, 1 tuple valid json bind types array, string note string must be in json array format "\[e0,e1,e2]" each element will be cast to the tuple element type at that element’s index from the ocient table according to the rules for that element type in this section example { "double int" \[1 0, 1], "string array" \["ocient", \[0, 1]], "string tuple" "\[1 0, 1]", "tuple tuple" \[\[1 0, 1],\["ocient", 2]] } > tuple(double, int)(1 0, 1), tuple(string, int\[])("ocient", int\[0, 1]), tuple(double, int)(1 0, 1), tuple(tuple(double, int), tuple(varchar, int)((1 0, 1), ("ocient", 1)) type\[] valid json bind types array, string note string must be in json array format "\[e0,e1,e2]" each element will be cast to the array element type from the ocient table according to the rules for that element type in this section example { "int array" \[0,1,2], "2d array" \[\[0, 1, 2],\[3, 4]], "string array" "\[0,1,2]", "tuple array" \[\[0, 1 0, "ocient"],\[1, 2 0, "rocks"]] } > int\[0,1,2], int\[]\[int\[0,1,2],int\[3,4]], int\[0,1,2] tuple(int, float, varchar)\[(0, 1 0, "ocient"), (1, 2 0 "rocks")] uuid valid json bind types string note source data must be a valid hyphen separated uuid example { "string uuid" "40e6215d b5c6 4896 987c f30f3678f608" } > uuid(40e6215d b5c6 4896 987c f30f3678f608) varchar , char valid json bind types string, number, boolean note number and boolean types are converted to their string representations example { "number string" 1000, "boolean string" true, "string string" "string" } > "1000", "true", "string" load geospatial data geospatial data can be loaded from a variety of formats into ocient the ocient system requires special considerations when you load geospatial data into ocient including coordinate system supported geospatial loading formats geospatial type conversion point normalization polygon normalization coordinate system ocient uses spatial reference system id (srid) 4326 for all internal geospatial data types srid 4326 is defined in the https //csrc nist gov/glossary/term/world geodetic system 1984 before you load the source data, all data should have the srid 4326 data type the loading operation ignores any source data that contains the coordinate system srid information supported geospatial loading formats well known text the primary data format for loading geospatial data in ocient is the well known text (wkt) format this string format is a portable format that can represent points, lines, and polygons string data in wkt format can automatically load into point , linestring , and polygon ocient column types in addition, arrays of strings in wkt format can automatically load into array columns of a suitable geospatial data type the ocient system assumes raw strings are in wkt format when the system loads these strings into geospatial column types each linestring or polygon value can be up to a maximum of 512 mb in size this means a linestring or polygon can contain approximately 32 million point values wkt strings are whitespace insensitive, so point(10 20) is equivalent to point (10 20) wkt strings are case insensitive extended well known text (ewkt) is not supported to load ewkt data, load the substring after the ewkt semicolon as the wkt format well known binary and extended well known binary the other data formats that can load into ocient are well known binary (wkb) and extended well known binary (ewkb) formats the ocient system requires an explicit transformation function for both wkb and ewkb formats when you load data and convert it into the target column type you can use the function st geomfromewkb to transform wkb and ewkb data in both cases, the ocient system represents the wkb or ewkb string data as hexadecimal string data the hexadecimal string can be one of these formats only hexadecimal digits 000000000140000000000000004010000000000000 prefixed with 0x 0x000000000140000000000000004010000000000000 prefixed with \x \x000000000140000000000000004010000000000000 geometry conversion ocient provides the automatic conversion of geometries from simpler types to more complex types the conversion allows the load of a linestring column with a point, or a polygon column with a point or linestring this capability also allows the load of arrays of polygon data from the source arrays of a combination of point, linestring, and polygon data, which represents a geometry collection point normalization during loading, ocient automatically performs normalization of point data into a regular format used within ocient the ocient system performs the following operations on point data during the load constrain longitude to \[ 180, 180) and latitude to \[ 90, 90]; wrap around invalid coordinates using correct geographical handling snap points near the pole to the pole set longitude of points on the pole to 0 remove signed zeros from coordinates, so 0 becomes 0 polygon normalization ocient follows a counterclockwise rotation convention to indicate the outer ring of a polygon the inner ring follows a clockwise rotation if the ocient system loads a polygon with a clockwise outer ring, the system indicates that the polygon is outside of the given ring in some cases, the polygon load can lead to unexpected results when the source data follows a different polygon rotation convention to account for this, the lat provides the st forcepolygonccw function that forces a counterclockwise rotation of the outer polygon ring and a clockwise rotation of the inner polygon ring when applicable geospatial transformation functions the lat has a select set of transformation functions to construct geospatial types and manipulate them during the load you can find the supported geospatial transformation functions in docid\ ogtlpyxjm1lxxexmufuxl related links docid\ tt6tfoulap0mt aycm2ka docid\ yr02hmt2c51a57w1agtc1 docid ncku w2ufneog xx3esf