@Override
    public List<RemoteFileInfo> getRemoteFiles(Table table, GetRemoteFilesParams params) {
        RemoteFileInfo remoteFileInfo = new RemoteFileInfo();
        KuduTable kuduTable = (KuduTable) table;
        String kuduTableName = getKuduFullTableName(kuduTable);
        org.apache.kudu.client.KuduTable nativeTable;
        try {
            nativeTable = kuduClient.openTable(kuduTableName);
        } catch (KuduException e) {
            throw new RuntimeException(e);
        }
        KuduScanToken.KuduScanTokenBuilder builder = kuduClient.newScanTokenBuilder(nativeTable);
        builder.setProjectedColumnNames(params.getFieldNames());
        if (params.getLimit() > 0) {
            builder.limit(params.getLimit());
        }
        addConstraintPredicates(nativeTable, builder, params.getPredicate());
        List<KuduScanToken> tokens = builder.build();
        List<RemoteFileDesc> remoteFileDescs = ImmutableList.of(
                KuduRemoteFileDesc.createKuduRemoteFileDesc(tokens));
        remoteFileInfo.setFiles(remoteFileDescs);
        return Lists.newArrayList(remoteFileInfo);
    }
@Test
    public void testGetRemoteFiles(@Mocked org.apache.kudu.client.KuduTable mockedTable) throws KuduException {
        KuduMetadata metadata = new KuduMetadata(KUDU_CATALOG, new HdfsEnvironment(), KUDU_MASTER, true,
                SCHEMA_EMULATION_PREFIX, Optional.empty());
        List<String> requiredNames = Lists.newArrayList("f2", "dt");
        new Expectations() {
            {
                client.tableExists(anyString);
                result = true;
                client.openTable(anyString);
                result = mockedTable;
                client.newScanTokenBuilder((org.apache.kudu.client.KuduTable) any)
                        .setProjectedColumnNames(requiredNames)
                        .build();
                result = tokens;
            }
        };
        Table table = metadata.getTable("db1", "tbl1");
        KuduTable kuduTable = (KuduTable) table;
        GetRemoteFilesParams params = GetRemoteFilesParams.newBuilder().setFieldNames(requiredNames).build();
        List<RemoteFileInfo> remoteFileInfos = metadata.getRemoteFiles(kuduTable, params);
        Assert.assertEquals(1, remoteFileInfos.size());
        Assert.assertEquals(1, remoteFileInfos.get(0).getFiles().size());
        KuduRemoteFileDesc desc = (KuduRemoteFileDesc) remoteFileInfos.get(0).getFiles().get(0);
        Assert.assertEquals(1, desc.getKuduScanTokens().size());
    }