https://delta.io logo
#random
Title
a

Abolfazl karimian

08/02/2023, 10:28 AM
Hi every one I'm using delta-kernel to read from a table using JAVA. I'm able to get table files but i'm not able to read data.
Copy code
Configuration conf = new Configuration(); 

        TableClient myTableClient = DefaultTableClient.create(conf);  

        Table myTable = Table.forPath("Table/Path");  
        Snapshot mySnapshot = myTable.getLatestSnapshot(myTableClient);  


        Scan myScan = mySnapshot.getScanBuilder(myTableClient).build();
        Row state = myScan.getScanState(myTableClient);
        
        CloseableIterator<ColumnarBatch> FilesBatchIter = myScan.getScanFiles(myTableClient);
        Optional<Expression> exp = Optional.empty();
this is the configuration that seems right.(I dont know about Optional<Expression>) Not i want to use them to fetch data from table
Copy code
while (FilesBatchIter.hasNext()) {
            CloseableIterator<Row> files = FilesBatchIter.next().getRows();
            CloseableIterator<DataReadResult> dataResult = Scan.readData(myTableClient, state, files, exp);
            
            // prints the file names
            while (files.hasNext()) {
                Row file = files.next();
                String column1Value = file.getString(0);
                System.out.println(column1Value);

            }

            // Checking if any result is fetched by Scan.readData
            while (dataResult.hasNext()) {
                System.out.println("Data Found!");
            }


        }
It will prints file names but it seems there would be nothing in dataResult. Any Ideas? or any sample code?
v

venki

08/04/2023, 3:48 PM
Hi @Abolfazl karimian, we recently added couple of examples here. Please take a look at them, let us know if you have any questions/issues.
a

Abolfazl karimian

08/05/2023, 8:50 AM
Hi @venki I used your examples and found the problem. Thank You. but there's a problem. Either in my code or yours it throws an exception for timestamp type(One of my columns is timestamp).
Exception in thread "main" java.lang.UnsupportedOperationException: timestamp is not supported
at io.delta.kernel.parquet.ParquetConverters. createConverter(ParquetConverters.java:111)
at io.delta.kernel.parquet.RowConverter.<init>(RowConverter.java:78)
...
Is there a solution for it?
v

venki

08/06/2023, 9:37 PM
We have an in progress PR to support time stamp type. Currently decimal and time stamp types are missing gaps.
@Abolfazl karimian Just an FYI, Timestamp and decimal support are landed in the latest master.