use of io.questdb.griffin.engine.functions.cast.CastStrToGeoHashFunctionFactory in project questdb by bluestreak01.
the class FunctionParserTest method testGeoHashFunction.
@Test
public void testGeoHashFunction() throws SqlException {
functions.add(new CastStrToGeoHashFunctionFactory());
final GenericRecordMetadata metadata = new GenericRecordMetadata();
metadata.add(new TableColumnMetadata("gh", 1, ColumnType.getGeoHashTypeWithBits(25)));
FunctionParser functionParser = createFunctionParser();
Record record = new Record() {
@Override
public long getLong(int col) {
return 847187636514L;
}
@Override
public int getGeoInt(int col) {
return (int) getLong(col);
}
};
Function function = parseFunction("cast('sp052w92' as geohash(5c))", metadata, functionParser);
Assert.assertEquals(ColumnType.getGeoHashTypeWithBits(25), function.getType());
Assert.assertEquals(25854114, function.getGeoInt(record));
}
Aggregations