S02004

Error Code

S02004

Error Message

No partition returned by the sql object. RefId:S02004

Probable Causes

The data source generated by the parameter sql in the loadTableBySQL function is empty. For example:

n = 1000
t = table(rand('A'..'Z', n) as sym, 2000.01.01+rand(365, n) as date)

if (existsDatabase("dfs://tradeDB")) {
    dropDatabase("dfs://tradeDB")
}

db = database("dfs://tradeDB", VALUE, 'A'..'Z')
trades = db.createPartitionedTable(t,`trades,`sym).append!(t)

sample = select * from loadTableBySQL(<select * from trades where sym > 'Z'>)

Solutions

Ensure that the data source returned by the sql parameter in the loadTableBySQL function has at least one partition.