You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "niuhu3 (via GitHub)" <gi...@apache.org> on 2023/11/03 03:35:15 UTC

[I] [Bug] java api can not read data [incubator-paimon]

niuhu3 opened a new issue, #2252:
URL: https://github.com/apache/incubator-paimon/issues/2252

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/incubator-paimon/issues) and found nothing similar.
   
   
   ### Paimon version
   
   paimon-bundle-0.6
   
   ### Compute Engine
   
   java api
   
   ### Minimal reproduce step
   
   Here is th official website example:
   
   Identifier identifier = Identifier.create("default", "test");
           Options options = new Options();
           options.set("warehouse", "hdfs://hadoop100:8020/paimon/hive");
           options.set("metastore", "hive");
           options.set("uri", "thrift://hadoop100:9083");
           options.set("hive-conf-dir", "E:\\tmp\\debzium_test\\src\\main\\resources");
   
           CatalogContext context = CatalogContext.create(options);
           Catalog catalog = CatalogFactory.createCatalog(context);
   
           int[] projection = new int[] {0, 1};
   
           Table table = catalog.getTable(identifier);
   
           ReadBuilder readBuilder = table.newReadBuilder();
           //.withFilter(Lists.newArrayList(notNull, predicate));
   
           List<Split> splits = readBuilder.newScan().plan().splits();
   
           TableRead read = readBuilder.newRead();
   
   
   
           RecordReader<InternalRow> reader = read.createReader(splits);
   
           reader.forEachRemaining(System.out::println);
   
   ### What doesn't meet your expectations?
   
   Here is my example code:
   
    Options options = new Options();
           options.set("warehouse", "hdfs://hadoop100:8020/paimon/hive");
           options.set("metastore", "hive");
           options.set("uri", "thrift://hadoop100:9083");
           options.set("hive-conf-dir", "E:\\tmp\\debzium_test\\src\\main\\resources");
   
           CatalogContext context = CatalogContext.create(options);
           Catalog catalog = CatalogFactory.createCatalog(context);
   
   
           Identifier identifier = Identifier.create("default", "test");
   
           Table table = catalog.getTable(identifier);
   
           ReadBuilder readBuilder = table.newReadBuilder();
                   //.withFilter(Lists.newArrayList(notNull, predicate));
           List<Split> splits = readBuilder.newScan().plan().splits();
   
           TableRead read = readBuilder.newRead();
   
           RecordReader<InternalRow> reader = read.createReader(splits);
   
           //reader.forEachRemaining(row -> System.out.println(row));
   
           RecordReader.RecordIterator<InternalRow> iterator = reader.readBatch();
   
           InternalRow next = iterator.next();
           long userId = next.getLong(0);
           long itemId = next.getLong(1);
           BinaryString behavior = next.getString(2);
           BinaryString dt = next.getString(3);
           BinaryString hh = next.getString(4);
           System.out.println("user_id:" + userId + " item_id:" + itemId + " behavior:" + behavior + " dt:" + dt + " hh:" + hh);
   
   ### Anything else?
   
   no
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] java api can not read data [incubator-paimon]

Posted by "zhangjun0x01 (via GitHub)" <gi...@apache.org>.
zhangjun0x01 commented on issue #2252:
URL: https://github.com/apache/incubator-paimon/issues/2252#issuecomment-1791989792

   What exception did you encounter?


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org