Skip to content

Commit

Permalink
SDK Reader with Default Projection(1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Manish Nalla committed Sep 24, 2018
1 parent 2e5e307 commit c0f64cb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Expand Up @@ -775,6 +775,8 @@ public static boolean getAccessStreamingSegments(Configuration configuration) {
public String[] projectAllColumns(CarbonTable carbonTable) {
List<ColumnSchema> colList = carbonTable.getTableInfo().getFactTable().getListOfColumns();
List<String> projectColumn = new ArrayList<>();
// childCount will recursively count the number of children for any parent
// complex type and add just the parent column name while skipping the child columns.
int childDimCount = 0;
for (ColumnSchema cols : colList) {
if (cols.getSchemaOrdinal() != -1) {
Expand Down
Expand Up @@ -440,9 +440,20 @@ class TestNonTransactionalCarbonTableForMapType extends QueryTest with BeforeAnd
nonTransactionalCarbonTable.WriteFilesWithAvroWriter(2, mySchema, json)

val reader = CarbonReader.builder(writerPath, "_temp").isTransactionalTable(false).build(conf)
reader.close()
val exception1 = intercept[Exception] {
val reader1 = CarbonReader.builder(writerPath, "_temp")
.projection(Array[String] { "arrayRecord.houseDetails" }).isTransactionalTable(false)
.build(conf)
reader1.close()
}
assert(exception1.getMessage
.contains(
"Complex child columns projection NOT supported through CarbonReader"))
println("Done test")
}


test("Read sdk writer Avro output Map Type") {
buildMapSchema(3)
assert(new File(writerPath).exists())
Expand Down
Expand Up @@ -206,8 +206,9 @@ public <T> CarbonReader<T> build(Configuration configuration)
if (projectionColumns != null) {
// set the user projection
int len = projectionColumns.length;
// TODO : Handle projection of complex child columns
for (int i = 0; i < len; i++) {
if (projectionColumns[i].contains("\\.")) {
if (projectionColumns[i].contains(".")) {
throw new UnsupportedOperationException(
"Complex child columns projection NOT supported through CarbonReader");
}
Expand Down

0 comments on commit c0f64cb

Please sign in to comment.