Error on calculing the quartile

I have this query:
` SELECT Cia,

            Licenca,
            Orcamento,
            DataCalculo,
            Origem,
            TempoCalculo_1,
            StatusCotacao_1,
            NTILE(4) OVER (ORDER BY TempoCalculo_1) AS quartil
        FROM "time-calculo"."teste-apresentacao"."colunas-limpas" AS "colunas-limpas"
        WHERE DataCalculo > CURRENT_DATE AND DataCalculo < DATE_ADD(CURRENT_DATE, 1)
        AND Origem <> ''
        ORDER BY TempoCalculo_1 ASC`

… and this return:

When I run another sql command like:
SELECT "quartil" FROM hoje

Node rel#664459:Subset#10.LOGICAL.ANY(]).]] could not be implemented; planner state: Root: rel#664459:Subset#10.LOGICAL.ANY(]).] Original rel: LogicalProject(subset=rel#664459:Subset#10.LOGICAL.ANY(]).]], quartil=$2]): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664457 LogicalSort(subset=rel#664456:Subset#9.NONE.ANY(]).1]], sort0=$1], dir0=ASC]): rowcount = 1.0, cumulative cost = {1.0 rows, 12.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664455 LogicalProject(subset=rel#664454:Subset#8.NONE.ANY(]).0 DESC]], DataCalculo=$1], TempoCalculo_1=$0], quartil=$2]): rowcount = 1.0, cumulative cost = {1.0 rows, 3.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664453 LogicalWindow(subset=rel#664452:Subset#7.NONE.ANY(]).3 DESC]], window#0=window(partition {} order by 0] range between UNBOUNDED PRECEDING and CURRENT ROW aggs NTILE($2)])]): rowcount = 1.0, cumulative cost = {1.0 rows, 2.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664451 LogicalProject(subset=rel#664450:Subset#6.NONE.ANY(]). 1 DESC]], TempoCalculo_1=$1], DataCalculo=$2]): rowcount = 1.0, cumulative cost = {1.0 rows, 2.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664449 LogicalFilter(subset=rel#664448:Subset#5.NONE.ANY(]).2 DESC]], condition=AND(>($2, 2019-10-31 00:00:00), <($2, 2019-11-01 00:00:00), <>($0, ‘’))]): rowcount = 1.0, cumulative cost = {1.0 rows, 3.94921875 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664447 LogicalSort(subset=rel#664446:Subset#4.NONE.ANY(]).2 DESC]], sort0=$2], dir0=DESC]): rowcount = 3.94921875, cumulative cost = {3.94921875 rows, 65.09186578410275 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664445 LogicalProject(subset=rel#664444:Subset#3.NONE.ANY(]).]], Origem=$4], TempoCalculo_1=CLEAN_DATA_TO_FLOAT($5, 1, 0, 0)], DataCalculo=TO_TIMESTAMP($13, ‘YYYY-MM-DD HH24:MI:SS’, 1)]): rowcount = 3.94921875, cumulative cost = {3.94921875 rows, 11.84765625 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664443 LogicalFilter(subset=rel#664442:Subset#2.NONE.ANY(]).]], condition=AND(IS_CLEAN_DATA($5, 1, ‘FLOAT’), IS_CLEAN_DATA($6, 1, ‘FLOAT’), IS_CLEAN_DATA($9, 1, ‘FLOAT’), IS_CLEAN_DATA($10, 1, ‘FLOAT’))]): rowcount = 3.94921875, cumulative cost = {3.94921875 rows, 1011.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664441 SampleCrel(subset=rel#664440:Subset#1.NONE.ANY(]).]]): rowcount = 1011.0, cumulative cost = {1011.0 rows, 1011.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 664439 ScanCrel(subset=rel#664438:Subset#0.NONE.ANY(]).]], table=“mongo-prod”.statistics.TimeCalculo], columns=_id, Cia, Licenca, Orcamento, Origem, TempoCalculo_1, TempoCalculo_2, Franquia_1, Franquia_2, PremioTotal_1, PremioTotal_2, Mensagem_1, Mensagem_2, DataCalculo, StatusCotacao_1, StatusCotacao_2], splits=1]): rowcount = 1011.0, cumulative cost = {1011.0 rows, 404400.0 cpu, 404400.0 io, 404400.0 network, 0.0 memory}, id = 664296 Sets: Set#0, type: RecordType(VARBINARY(65536) _id, VARCHAR(65536) Cia, VARCHAR(65536) Licenca, VARCHAR(65536) Orcamento, VARCHAR(65536) Origem, ANY TempoCalculo_1, ANY TempoCalculo_2, VARCHAR(65536) Franquia_1, VARCHAR(65536) Franquia_2, ANY PremioTotal_1, ANY PremioTotal_2, VARCHAR(65536) Mensagem_1, VARCHAR(65536) Mensagem_2, VARCHAR(65536) DataCalculo, VARCHAR(65536) StatusCotacao_1, VARCHAR(65536) StatusCotacao_2) rel#664438:Subset#0.NONE.ANY(]).], best=null, importance=0.31381059609000006 rel#664296:ScanCrel.NONE.ANY(]).](table=“mongo-prod”.statistics.TimeCalculo,columns=_id, Cia, Licenca, Orcamento, Origem, TempoCalculo_1, TempoCalculo_2, Franquia_1, Franquia_2, PremioTotal_1, PremioTotal_2, Mensagem_1, Mensagem_2, DataCalculo, StatusCotacao_1, StatusCotacao_2,splits=1,tableDigest=-1046753388|mongo-prod|c7bcb97f-c115-41f0-b977-b4cf118d4448), rowcount=1011.0, cumulative cost={inf} rel#664486:Subset#0.LOGICAL.ANY(]).], best=rel#664488, importance=0.21738125040481013 rel#664488:MongoScanDrel.LOGICAL.ANY(]).](table=“mongo-prod”.statistics.TimeCalculo,columns=_id, Cia, Licenca, Orcamento, Origem, TempoCalculo_1, TempoCalculo_2, Franquia_1, Franquia_2, PremioTotal_1, PremioTotal_2, Mensagem_1, Mensagem_2, DataCalculo, StatusCotacao_1, StatusCotacao_2,splits=1,tableDigest=-1046753388|mongo-prod|c7bcb97f-c115-41f0-b977-b4cf118d4448), rowcount=1011.0, cumulative cost={1011.0 rows, 404400.0 cpu, 404400.0 io, 404400.0 network, 0.0 memory} Set#1, type: RecordType(VARBINARY(65536) _id, VARCHAR(65536) Cia, VARCHAR(65536) Licenca, VARCHAR(65536) Orcamento, VARCHAR(65536) Origem, ANY TempoCalculo_1, ANY TempoCalculo_2, VARCHAR(65536) Franquia_1, VARCHAR(65536) Franquia_2, ANY PremioTotal_1, ANY PremioTotal_2, VARCHAR(65536) Mensagem_1, VARCHAR(65536) Mensagem_2, VARCHAR(65536) DataCalculo, VARCHAR(65536) StatusCotacao_1, VARCHAR(65536) StatusCotacao_2) rel#664440:Subset#1.NONE.ANY(]).], best=null, importance=0.3486784401000001 rel#664439:SampleCrel.NONE.ANY(]).](input=RelSubset#664438), rowcount=1011.0, cumulative cost={inf} rel#664484:Subset#1.LOGICAL.ANY(]).], best=rel#664487, importance=0.17433922005000005 rel#664487:SampleRel.LOGICAL.ANY(]).](input=RelSubset#664486), rowcount=1011.0, cumulative cost={2022.0 rows, 405411.0 cpu, 404400.0 io, 404400.0 network, 0.0 memory} Set#2, type: RecordType(VARBINARY(65536) _id, VARCHAR(65536) Cia, VARCHAR(65536) Licenca, VARCHAR(65536) Orcamento, VARCHAR(65536) Origem, ANY TempoCalculo_1, ANY TempoCalculo_2, VARCHAR(65536) Franquia_1, VARCHAR(65536) Franquia_2, ANY PremioTotal_1, ANY PremioTotal_2, VARCHAR(65536) Mensagem_1, VARCHAR(65536) Mensagem_2, VARCHAR(65536) DataCalculo, VARCHAR(65536) StatusCotacao_1, VARCHAR(65536) StatusCotacao_2) rel#664442:Subset#2.NONE.ANY(]).], best=null, importance=0.3874204890000001 rel#664441:LogicalFilter.NONE.ANY(]).](input=RelSubset#664440,condition=AND(IS_CLEAN_DATA($5, 1, ‘FLOAT’), IS_CLEAN_DATA($6, 1, ‘FLOAT’), IS_CLEAN_DATA($9, 1, ‘FLOAT’), IS_CLEAN_DATA($10, 1, ‘FLOAT’))), rowcount=3.94921875, cumulative cost={inf} rel#664482:Subset#2.LOGICAL.ANY(]).], best=rel#664485, importance=0.19371024450000005 rel#664485:FilterRel.LOGICAL.ANY(]).](input=RelSubset#664484,condition=AND(IS_CLEAN_DATA($5, 1, ‘FLOAT’), IS_CLEAN_DATA($6, 1, ‘FLOAT’), IS_CLEAN_DATA($9, 1, ‘FLOAT’), IS_CLEAN_DATA($10, 1, ‘FLOAT’))), rowcount=3.94921875, cumulative cost={3033.0 rows, 426973.734375 cpu, 404400.0 io, 404400.0 network, 0.0 memory} Set#3, type: RecordType(VARCHAR(65536) Origem, ANY TempoCalculo_1, TIMESTAMP(3) DataCalculo) rel#664444:Subset#3.NONE.ANY(]).], best=null, importance=0.4304672100000001 rel#664443:LogicalProject.NONE.ANY(]).](input=RelSubset#664442,Origem=$4,TempoCalculo_1=CLEAN_DATA_TO_FLOAT($5, 1, 0, 0),DataCalculo=TO_TIMESTAMP($13, ‘YYYY-MM-DD HH24:MI:SS’, 1)), rowcount=3.94921875, cumulative cost={inf} rel#664480:Subset#3.LOGICAL.ANY(]).], best=rel#664483, importance=0.21523360500000005 rel#664483:ProjectRel.LOGICAL.ANY(]).](input=RelSubset#664482,Origem=$4,TempoCalculo_1=CLEAN_DATA_TO_FLOAT($5, 1, 0, 0),DataCalculo=TO_TIMESTAMP($13, ‘YYYY-MM-DD HH24:MI:SS’, 1)), rowcount=3.94921875, cumulative cost={3036.94921875 rows, 427005.3281644922 cpu, 404400.0 io, 404400.0 network, 0.0 memory} Set#4, type: RecordType(VARCHAR(65536) Origem, ANY TempoCalculo_1, TIMESTAMP(3) DataCalculo) rel#664446:Subset#4.NONE.ANY(]).2 DESC], best=null, importance=0.4782969000000001 rel#664445:LogicalSort.NONE.ANY(]).2 DESC](input=RelSubset#664444,sort0=$2,dir0=DESC), rowcount=3.94921875, cumulative cost={inf} rel#664478:Subset#4.LOGICAL.ANY(]).2 DESC], best=rel#664481, importance=0.23914845000000004 rel#664481:SortRel.LOGICAL.ANY(]).2 DESC](input=RelSubset#664480,sort0=$2,dir0=DESC), rowcount=3.94921875, cumulative cost={3040.8984375 rows, 427070.4200302763 cpu, 404400.0 io, 404400.0 network, 0.0 memory} Set#5, type: RecordType(VARCHAR(65536) Origem, ANY TempoCalculo_1, TIMESTAMP(3) DataCalculo) rel#664448:Subset#5.NONE.ANY(]).2 DESC], best=null, importance=0.531441 rel#664447:LogicalFilter.NONE.ANY(])…2 DESC]](input=RelSubset#664446,condition=AND(>($2, 2019-10-31 00:00:00), <($2, 2019-11-01 00:00:00), <>($0, ‘’))), rowcount=1.0, cumulative cost={inf} rel#664474:Subset#5.LOGICAL.ANY(]).2 DESC], best=rel#664479, importance=0.2657205 rel#664479:FilterRel.LOGICAL.ANY(]).2 DESC](input=RelSubset#664478,condition=AND(>($2, 2019-10-31 00:00:00), <($2, 2019-11-01 00:00:00), <>($0, ‘’))), rowcount=1.0, cumulative cost={3044.84765625 rows, 427111.8868271513 cpu, 404400.0 io, 404400.0 network, 0.0 memory} Set#6, type: RecordType(ANY TempoCalculo_1, TIMESTAMP(3) DataCalculo) rel#664450:Subset#6.NONE.ANY(]).1 DESC], best=null, importance=0.5904900000000001 rel#664449:LogicalProject.NONE.ANY(]). 1 DESC]](input=RelSubset#664448,TempoCalculo_1=$1,DataCalculo=$2), rowcount=1.0, cumulative cost={inf} rel#664489:LogicalSort.NONE.ANY(]).1 DESC](input=RelSubset#664471,sort0=$1,dir0=DESC), rowcount=1.0, cumulative cost={inf} rel#664471:Subset#6.LOGICAL.ANY(]).3 DESC], best=null, importance=0.531441 rel#664476:Subset#6.LOGICAL.ANY(]).1 DESC], best=rel#664475, importance=0.29524500000000004 rel#664477:AbstractConverter.LOGICAL.ANY(]). 1 DESC](input=RelSubset#664471,convention=LOGICAL,DistributionTraitDef=ANY(]),sort=1 DESC]), rowcount=1.0, cumulative cost={inf} rel#664475:ProjectRel.LOGICAL.ANY(])…1 DESC]](input=RelSubset#664474,TempoCalculo_1=$1,DataCalculo=$2), rowcount=1.0, cumulative cost={3045.84765625 rows, 427111.88684715127 cpu, 404400.0 io, 404400.0 network, 0.0 memory} rel#664491:SortRel.LOGICAL.ANY(]).1 DESC](input=RelSubset#664471,sort0=$1,dir0=DESC), rowcount=1.0, cumulative cost={inf} Set#7, type: RecordType(ANY TempoCalculo_1, TIMESTAMP(3) DataCalculo, BIGINT w0$o0) rel#664452:Subset#7.NONE.ANY(]).3 DESC], best=null, importance=0.6561 rel#664451:LogicalWindow.NONE.ANY(])…3 DESC]](input=RelSubset#664450,window#0=window(partition {} order by 0] range between UNBOUNDED PRECEDING and CURRENT ROW aggs NTILE($2)])), rowcount=1.0, cumulative cost={inf} rel#664465:Subset#7.LOGICAL.ANY(]).3 DESC], best=null, importance=0.5904900000000001 rel#664473:Subset#7.LOGICAL.ANY(]).], best=null, importance=0.32805 rel#664472:WindowRel.LOGICAL.ANY(]).](input=RelSubset#664471,window#0=window(partition {} order by 0] range between UNBOUNDED PRECEDING and CURRENT ROW aggs NTILE($2)])), rowcount=1.0, cumulative cost={inf} Set#8, type: RecordType(TIMESTAMP(3) DataCalculo, ANY TempoCalculo_1, BIGINT quartil) rel#664454:Subset#8.NONE.ANY(]).0 DESC], best=null, importance=0.7290000000000001 rel#664453:LogicalProject.NONE.ANY(])…0 DESC]](input=RelSubset#664452,DataCalculo=$1,TempoCalculo_1=$0,quartil=$2), rowcount=1.0, cumulative cost={inf} rel#664469:LogicalSort.NONE.ANY(]).0 DESC](input=RelSubset#664467,sort0=$0,dir0=DESC), rowcount=1.0, cumulative cost={inf} rel#664463:Subset#8.LOGICAL.ANY(]).0 DESC], best=null, importance=0.81 rel#664468:AbstractConverter.LOGICAL.ANY(]).0 DESC](input=RelSubset#664467,convention=LOGICAL,DistributionTraitDef=ANY(]),sort=0 DESC]), rowcount=1.0, cumulative cost={inf} rel#664470:SortRel.LOGICAL.ANY(]).0 DESC](input=RelSubset#664467,sort0=$0,dir0=DESC), rowcount=1.0, cumulative cost={inf} rel#664467:Subset#8.LOGICAL.ANY(]).], best=null, importance=0.6561 rel#664468:AbstractConverter.LOGICAL.ANY(]).0 DESC](input=RelSubset#664467,convention=LOGICAL,DistributionTraitDef=ANY(]),sort=0 DESC]), rowcount=1.0, cumulative cost={inf} rel#664466:ProjectRel.LOGICAL.ANY(]).](input=RelSubset#664465,DataCalculo=$1,TempoCalculo_1=$0,quartil=$2), rowcount=1.0, cumulative cost={inf} rel#664470:SortRel.LOGICAL.ANY(]).0 DESC](input=RelSubset#664467,sort0=$0,dir0=DESC), rowcount=1.0, cumulative cost={inf} Set#9, type: RecordType(TIMESTAMP(3) DataCalculo, ANY TempoCalculo_1, BIGINT quartil) rel#664456:Subset#9.NONE.ANY(]).1], best=null, importance=0.81 rel#664455:LogicalSort.NONE.ANY(]).1](input=RelSubset#664454,sort0=$1,dir0=ASC), rowcount=1.0, cumulative cost={inf} rel#664461:Subset#9.LOGICAL.ANY(]).1], best=null, importance=0.9 rel#664464:SortRel.LOGICAL.ANY(]).1](input=RelSubset#664463,sort0=$1,dir0=ASC), rowcount=1.0, cumulative cost={inf} Set#10, type: RecordType(BIGINT quartil) rel#664458:Subset#10.NONE.ANY(]).], best=null, importance=0.9 rel#664457:LogicalProject.NONE.ANY(]).](input=RelSubset#664456,quartil=$2), rowcount=1.0, cumulative cost={inf} rel#664459:Subset#10.LOGICAL.ANY(]).], best=null, importance=1.0 rel#664460:AbstractConverter.LOGICAL.ANY(]).](input=RelSubset#664458,convention=LOGICAL,DistributionTraitDef=ANY(]),sort=]), rowcount=1.0, cumulative cost={inf} rel#664462:ProjectRel.LOGICAL.ANY(]).](input=RelSubset#664461,quartil=$2), rowcount=1.0, cumulative cost={inf}

What I need to do?

Hi @oluis

Can you attach the profiles for the jobs

@Venugopal_Menda

2771514f-ac5e-4a94-94f0-4f54cad69ed5.zip (10,2,KB)

I discovered when I remove the “DataCalculo” from “hoje”, this error don’t occurs. But I don’t understand why