liuyehcf opened a new issue, #5105:
URL: https://github.com/apache/paimon/issues/5105

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   
   ### Paimon version
   
   0.9.0
   
   ### Compute Engine
   
   SDK itselft, 0.9.0
   
   ### Minimal reproduce step
   
   Code:
   
   ```java
   package org.example;
   
   import org.apache.commons.io.FileUtils;
   import org.apache.paimon.catalog.Catalog;
   import org.apache.paimon.catalog.CatalogContext;
   import org.apache.paimon.catalog.CatalogFactory;
   import org.apache.paimon.catalog.Identifier;
   import org.apache.paimon.data.GenericRow;
   import org.apache.paimon.data.InternalRow;
   import org.apache.paimon.fs.Path;
   import org.apache.paimon.options.CatalogOptions;
   import org.apache.paimon.options.Options;
   import org.apache.paimon.predicate.Predicate;
   import org.apache.paimon.predicate.PredicateBuilder;
   import org.apache.paimon.reader.RecordReader;
   import org.apache.paimon.schema.Schema;
   import org.apache.paimon.table.Table;
   import org.apache.paimon.table.sink.BatchTableCommit;
   import org.apache.paimon.table.sink.BatchTableWrite;
   import org.apache.paimon.table.sink.BatchWriteBuilder;
   import org.apache.paimon.table.sink.CommitMessage;
   import org.apache.paimon.table.source.ReadBuilder;
   import org.apache.paimon.table.source.Split;
   import org.apache.paimon.table.source.TableRead;
   import org.apache.paimon.types.DataTypes;
   
   import java.io.File;
   import java.util.List;
   
   public class ParquetShortPredicateDemo {
       private static void testShortPredicate(String localPath) throws 
Exception {
           Options options = new Options();
           options.set(CatalogOptions.METASTORE, "filesystem");
           options.set(CatalogOptions.WAREHOUSE, new 
Path(localPath).toUri().toString());
           CatalogContext context = CatalogContext.create(options);
           Catalog catalog = CatalogFactory.createCatalog(context);
           String dbName = "testDb";
           String tblName = "testTbl";
           catalog.createDatabase(dbName, false);
           Schema.Builder schemaBuilder = Schema.newBuilder();
           schemaBuilder.column("col_smallint", DataTypes.SMALLINT());
           schemaBuilder.option("file.format", "parquet");
           Schema schema = schemaBuilder.build();
           Identifier tableId = Identifier.create(dbName, tblName);
           catalog.createTable(tableId, schema, false);
           Table table = catalog.getTable(tableId);
           BatchWriteBuilder writeBuilder = 
table.newBatchWriteBuilder().withOverwrite();
           try (BatchTableWrite write = writeBuilder.newWrite()) {
               GenericRow record = GenericRow.of(Short.parseShort("1"));
               write.write(record);
               List<CommitMessage> messages = write.prepareCommit();
               try (BatchTableCommit commit = writeBuilder.newCommit()) {
                   commit.commit(messages);
               }
           }
   
           ReadBuilder readBuilder = table.newReadBuilder();
           PredicateBuilder predicateBuilder = new 
PredicateBuilder(table.rowType());
           Predicate predicate = predicateBuilder.greaterOrEqual(0, 
Short.parseShort("1"));
           List<Split> splits = 
readBuilder.withFilter(predicate).newScan().plan().splits();
           TableRead read = readBuilder.newRead();
   
           try (RecordReader<InternalRow> reader = read.createReader(splits)) {
               RecordReader.RecordIterator<InternalRow> batch;
               while ((batch = reader.readBatch()) != null) {
                   InternalRow row;
                   while ((row = batch.next()) != null) {
                       Short v = row.getShort(0);
                       System.out.println(v);
                   }
                   batch.releaseBatch();
               }
           }
       }
   
       public static void main(String[] args) throws Exception {
           String localPath = "/tmp/paimon_warehouse";
           FileUtils.deleteDirectory(new File(localPath));
           testShortPredicate(localPath);
       }
   }
   ```
   
   ### What doesn't meet your expectations?
   
   for version 0.8.2, this demo can work without faliure.
   but for version 0.9.0, this demo cannot work.
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to