private ImmutableList<ColumnIdent> getPrimaryKey() { Map<String, Object> metaMap = getNested(defaultMappingMap, "_meta"); if (metaMap != null) { ImmutableList.Builder<ColumnIdent> builder = ImmutableList.builder(); Object pKeys = metaMap.get("primary_keys"); if (pKeys != null) { if (pKeys instanceof String) { builder.add(ColumnIdent.fromPath((String) pKeys)); return builder.build(); } else if (pKeys instanceof Collection) { Collection keys = (Collection) pKeys; if (!keys.isEmpty()) { for (Object pkey : keys) { builder.add(ColumnIdent.fromPath(pkey.toString())); } return builder.build(); } } } } if (getCustomRoutingCol() == null && partitionedByList.isEmpty()) { hasAutoGeneratedPrimaryKey = true; return ImmutableList.of(ID_IDENT); } return ImmutableList.of(); }
private void prepareCrateMeta() { metaMap = getNested(defaultMappingMap, "_meta"); if (metaMap != null) { indicesMap = getNested(metaMap, "indices"); if (indicesMap == null) { indicesMap = ImmutableMap.of(); } metaColumnsMap = getNested(metaMap, "columns"); if (metaColumnsMap == null) { metaColumnsMap = ImmutableMap.of(); } partitionedByList = getNested(metaMap, "partitioned_by"); if (partitionedByList == null) { partitionedByList = ImmutableList.of(); } } else { metaMap = new HashMap<>(); indicesMap = new HashMap<>(); metaColumnsMap = new HashMap<>(); partitionedByList = ImmutableList.of(); } }