VenuReddy2103 commented on a change in pull request #3436: [CARBONDATA-3548]Geospatial Support: Modified to create and load the table with a nonschema dimension sort column. And added InPolygon UDF
URL:
https://github.com/apache/carbondata/pull/3436#discussion_r373038264
##########
File path: processing/src/main/java/org/apache/carbondata/processing/loading/converter/impl/RowConverterImpl.java
##########
@@ -161,11 +166,59 @@ public DictionaryClient call() throws Exception {
return null;
}
+ private int getDataFieldIndexByName(String column) {
+ for (int i = 0; i < fields.length; i++) {
+ if (fields[i].getColumn().getColName().equalsIgnoreCase(column)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ private String generateNonSchemaColumnValue(DataField field, CarbonRow row) {
+ Map<String, String> properties = configuration.getTableSpec().getCarbonTable()
+ .getTableInfo().getFactTable().getTableProperties();
+ String handler = properties.get(CarbonCommonConstants.INDEX_HANDLER
+ + "." + field.getColumn().getColName() + ".instance");
+ if (handler != null) {
+ try {
+ // TODO Need to check to how to store the instance. This serialization may be incorrect.
+ ByteArrayInputStream bis = new ByteArrayInputStream(Base64.getDecoder().decode(handler));
+ ObjectInputStream in = new ObjectInputStream(bis);
+ CustomIndex instance = (CustomIndex) in.readObject();
+ String sourceColumns = properties.get(CarbonCommonConstants.INDEX_HANDLER
+ + "." + field.getColumn().getColName() + ".sourcecolumns");
+ assert (sourceColumns != null);
+ String[] sources = sourceColumns.split(",");
+ int srcFieldIndex;
+ List<Object> sourceValues = new ArrayList<Object>();
+ for (String source : sources) {
+ srcFieldIndex = getDataFieldIndexByName(source);
+ assert (srcFieldIndex != -1);
+ sourceValues.add(row.getData()[srcFieldIndex]);
+ }
+ return instance.generate(sourceValues);
+ } catch (Exception e) {
+ LOGGER.error("Failed to generate column value while processing index_handler property."
+ + e);
+ throw new RuntimeException(e);
+ }
+ }
+ return null;
+ }
+
@Override
public CarbonRow convert(CarbonRow row) throws CarbonDataLoadingException {
logHolder.setLogged(false);
logHolder.clear();
+ Boolean bNonSchemaPresent = false;
for (int i = 0; i < fieldConverters.length; i++) {
+ if (fields[i].getColumn().getSchemaOrdinal() == -1) {
Review comment:
Done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[hidden email]
With regards,
Apache Git Services