[ 
https://issues.apache.org/jira/browse/DRILL-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14072143#comment-14072143
 ] 

Chun Chang commented on DRILL-1153:
-----------------------------------

0: jdbc:drill:schema=dfs> explain plan for select time_by_day.the_year as c0, 
sum(sales_fact_1997.unit_sales) as m0, count(distinct 
sales_fact_1997.customer_id) as m1 from time_by_day as time_by_day, 
sales_fact_1997 as sales_fact_1997 where sales_fact_1997.time_id = 
time_by_day.time_id and time_by_day.the_year = 1997 group by 
time_by_day.the_year;
+------------+------------+
|    text    |    json    |
+------------+------------+
| 00-00    Screen
00-01      Project(c0=[$0], m0=[$1], m1=[$2])
00-02        Project(c0=[$0], m0=[CASE(=($2, 0), null, $1)], m1=[$4])
00-03          HashJoin(condition=[IS NOT DISTINCT FROM($0, $3)], 
joinType=[inner])
00-05            HashAgg(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT($1)])
00-07              Project(c0=[$0], unit_sales=[$3], customer_id=[$4])
00-09                HashJoin(condition=[=($2, $1)], joinType=[inner])
00-12                  SelectionVectorRemover
00-15                    Filter(condition=[=(CAST($0):INTEGER, 1997)])
00-19                      Project(the_year=[$1], time_id=[$0])
00-23                        ProducerConsumer
00-26                          Scan(groupscan=[ParquetGroupScan 
[entries=[ReadEntryWithPath [path=maprfs:/user/root/mondrian/time_by_day]], 
selectionRoot=/user/root/mondrian/time_by_day, columns=[SchemaPath 
[`the_year`], SchemaPath [`time_id`]]]])
00-11                  Project(time_id0=[$0], unit_sales=[$1], customer_id=[$2])
00-14                    Project(time_id=[$2], unit_sales=[$0], 
customer_id=[$1])
00-18                      ProducerConsumer
00-22                        Scan(groupscan=[ParquetGroupScan 
[entries=[ReadEntryWithPath [path=maprfs:/user/root/mondrian/sales_fact_1997]], 
selectionRoot=/user/root/mondrian/sales_fact_1997, columns=[SchemaPath 
[`time_id`], SchemaPath [`unit_sales`], SchemaPath [`customer_id`]]]])
00-04            Project(c00=[$0], m1=[$1])
00-06              HashAgg(group=[{0}], m1=[COUNT($1)])
00-08                HashAgg(group=[{0, 1}])
00-10                  Project(c0=[$0], customer_id=[$3])
00-13                    HashJoin(condition=[=($2, $1)], joinType=[inner])
00-17                      SelectionVectorRemover
00-21                        Filter(condition=[=(CAST($0):INTEGER, 1997)])
00-25                          Project(the_year=[$1], time_id=[$0])
00-28                            ProducerConsumer
00-29                              Scan(groupscan=[ParquetGroupScan 
[entries=[ReadEntryWithPath [path=maprfs:/user/root/mondrian/time_by_day]], 
selectionRoot=/user/root/mondrian/time_by_day, columns=[SchemaPath 
[`the_year`], SchemaPath [`time_id`]]]])
00-16                      Project(time_id0=[$0], customer_id=[$1])
00-20                        Project(time_id=[$1], customer_id=[$0])
00-24                          ProducerConsumer
00-27                            Scan(groupscan=[ParquetGroupScan 
[entries=[ReadEntryWithPath [path=maprfs:/user/root/mondrian/sales_fact_1997]], 
selectionRoot=/user/root/mondrian/sales_fact_1997, columns=[SchemaPath 
[`time_id`], SchemaPath [`customer_id`]]]])
 | {
  "head" : {
    "version" : 1,
    "generator" : {
      "type" : "ExplainHandler",
      "info" : ""
    },
    "type" : "APACHE_DRILL_PHYSICAL",
    "options" : [ ],
    "queue" : 0,
    "resultMode" : "EXEC"
  },
  "graph" : [ {
    "pop" : "parquet-scan",
    "@id" : 26,
    "entries" : [ {
      "path" : "maprfs:/user/root/mondrian/time_by_day"
    } ],
    "storage" : {
      "type" : "file",
      "enabled" : true,
      "connection" : "maprfs:///",
      "workspaces" : {
        "default" : {
          "location" : "/user/root/mondrian/",
          "writable" : false,
          "storageformat" : null
        },
        "home" : {
          "location" : "/",
          "writable" : false,
          "storageformat" : null
        },
        "root" : {
          "location" : "/",
          "writable" : false,
          "storageformat" : null
        },
        "tmp" : {
          "location" : "/tmp",
          "writable" : true,
          "storageformat" : "csv"
        }
      },
      "formats" : {
        "psv" : {
          "type" : "text",
          "extensions" : [ "tbl" ],
          "delimiter" : "|"
        },
        "csv" : {
          "type" : "text",
          "extensions" : [ "csv" ],
          "delimiter" : ","
        },
        "tsv" : {
          "type" : "text",
          "extensions" : [ "tsv" ],
          "delimiter" : "\t"
        },
        "parquet" : {
          "type" : "parquet"
        },
        "json" : {
          "type" : "json"
        }
      }
    },
    "format" : {
      "type" : "parquet"
    },
    "columns" : [ "`the_year`", "`time_id`" ],
    "selectionRoot" : "/user/root/mondrian/time_by_day",
    "cost" : 730.0
  }, {
    "pop" : "producer-consumer",
    "@id" : 23,
    "child" : 26,
    "size" : 10,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 730.0
  }, {
    "pop" : "project",
    "@id" : 19,
    "exprs" : [ {
      "ref" : "`the_year`",
      "expr" : "`the_year`"
    }, {
      "ref" : "`time_id`",
      "expr" : "`time_id`"
    } ],
    "child" : 23,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 730.0
  }, {
    "pop" : "filter",
    "@id" : 15,
    "child" : 19,
    "expr" : "equal(cast( (`the_year` ) as INT ), 1997) ",
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 109.5
  }, {
    "pop" : "selection-vector-remover",
    "@id" : 12,
    "child" : 15,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 109.5
  }, {
    "pop" : "parquet-scan",
    "@id" : 22,
    "entries" : [ {
      "path" : "maprfs:/user/root/mondrian/sales_fact_1997"
    } ],
    "storage" : {
      "type" : "file",
      "enabled" : true,
      "connection" : "maprfs:///",
      "workspaces" : {
        "default" : {
          "location" : "/user/root/mondrian/",
          "writable" : false,
          "storageformat" : null
        },
        "home" : {
          "location" : "/",
          "writable" : false,
          "storageformat" : null
        },
        "root" : {
          "location" : "/",
          "writable" : false,
          "storageformat" : null
        },
        "tmp" : {
          "location" : "/tmp",
          "writable" : true,
          "storageformat" : "csv"
        }
      },
      "formats" : {
        "psv" : {
          "type" : "text",
          "extensions" : [ "tbl" ],
          "delimiter" : "|"
        },
        "csv" : {
          "type" : "text",
          "extensions" : [ "csv" ],
          "delimiter" : ","
        },
        "tsv" : {
          "type" : "text",
          "extensions" : [ "tsv" ],
          "delimiter" : "\t"
        },
        "parquet" : {
          "type" : "parquet"
        },
        "json" : {
          "type" : "json"
        }
      }
    },
    "format" : {
      "type" : "parquet"
    },
    "columns" : [ "`time_id`", "`unit_sales`", "`customer_id`" ],
    "selectionRoot" : "/user/root/mondrian/sales_fact_1997",
    "cost" : 86837.0
  }, {
    "pop" : "producer-consumer",
    "@id" : 18,
    "child" : 22,
    "size" : 10,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 86837.0
  }, {
    "pop" : "project",
    "@id" : 14,
    "exprs" : [ {
      "ref" : "`time_id`",
      "expr" : "`time_id`"
    }, {
      "ref" : "`unit_sales`",
      "expr" : "`unit_sales`"
    }, {
      "ref" : "`customer_id`",
      "expr" : "`customer_id`"
    } ],
    "child" : 18,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 86837.0
  }, {
    "pop" : "project",
    "@id" : 11,
    "exprs" : [ {
      "ref" : "`time_id0`",
      "expr" : "`time_id`"
    }, {
      "ref" : "`unit_sales`",
      "expr" : "`unit_sales`"
    }, {
      "ref" : "`customer_id`",
      "expr" : "`customer_id`"
    } ],
    "child" : 14,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 86837.0
  }, {
    "pop" : "hash-join",
    "@id" : 9,
    "left" : 12,
    "right" : 11,
    "conditions" : [ {
      "relationship" : "==",
      "left" : "`time_id`",
      "right" : "`time_id0`"
    } ],
    "joinType" : "INNER",
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 0.0
  }, {
    "pop" : "project",
    "@id" : 7,
    "exprs" : [ {
      "ref" : "`c0`",
      "expr" : "`the_year`"
    }, {
      "ref" : "`unit_sales`",
      "expr" : "`unit_sales`"
    }, {
      "ref" : "`customer_id`",
      "expr" : "`customer_id`"
    } ],
    "child" : 9,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 1.0
  }, {
    "pop" : "hash-aggregate",
    "@id" : 5,
    "child" : 7,
    "cardinality" : 1.0,
    "initialAllocation" : 1000000,
    "maxAllocation" : 10000000000,
    "cost" : 0.5,
    "groupByExprs" : [ {
      "ref" : "`c0`",
      "expr" : "`c0`"
    } ],
    "aggrExprs" : [ {
      "ref" : "`$f1`",
      "expr" : "$sum0(`unit_sales`) "
    }, {
      "ref" : "`$f2`",
      "expr" : "count(`unit_sales`) "
    } ]
  }, {
    "pop" : "parquet-scan",
    "@id" : 27,
    "entries" : [ {
      "path" : "maprfs:/user/root/mondrian/sales_fact_1997"
    } ],
    "storage" : {
      "type" : "file",
      "enabled" : true,
      "connection" : "maprfs:///",
      "workspaces" : {
        "default" : {
          "location" : "/user/root/mondrian/",
          "writable" : false,
          "storageformat" : null
        },
        "home" : {
          "location" : "/",
          "writable" : false,
          "storageformat" : null
        },
        "root" : {
          "location" : "/",
          "writable" : false,
          "storageformat" : null
        },
        "tmp" : {
          "location" : "/tmp",
          "writable" : true,
          "storageformat" : "csv"
        }
      },
      "formats" : {
        "psv" : {
          "type" : "text",
          "extensions" : [ "tbl" ],
          "delimiter" : "|"
        },
        "csv" : {
          "type" : "text",
          "extensions" : [ "csv" ],
          "delimiter" : ","
        },
        "tsv" : {
          "type" : "text",
          "extensions" : [ "tsv" ],
          "delimiter" : "\t"
        },
        "parquet" : {
          "type" : "parquet"
        },
        "json" : {
          "type" : "json"
        }
      }
    },
    "forma |
+------------+------------+
1 row selected (6.62 seconds)

> Missing Function: $sum0(FLOAT8-OPTIONAL)
> ----------------------------------------
>
>                 Key: DRILL-1153
>                 URL: https://issues.apache.org/jira/browse/DRILL-1153
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>            Reporter: Chun Chang
>            Assignee: Chun Chang
>             Fix For: 1.0.0-BETA1
>
>
> #Mon Jul 14 10:10:52 PDT 2014
> git.commit.id.abbrev=699851b
> The following mondrian query (query106.q) failed due to schema change 
> exception:
> 0: jdbc:drill:schema=dfs> select time_by_day.the_year as c0, 
> sum(sales_fact_1997.unit_sales) as m0, count(distinct 
> sales_fact_1997.customer_id) as m1 from time_by_day as time_by_day, 
> sales_fact_1997 as sales_fact_1997 where sales_fact_1997.time_id = 
> time_by_day.time_id and time_by_day.the_year = 1997 group by 
> time_by_day.the_year;
> Query failed: org.apache.drill.exec.rpc.RpcException: Remote failure while 
> running query.[error_id: "d7d30240-1688-4db2-a703-e9a0a52a19e2"
> endpoint {
>   address: "qa-node117.qa.lab"
>   user_port: 31010
>   control_port: 31011
>   data_port: 31012
> }
> error_type: 0
> message: "Failure while running fragment. < IllegalStateException:[ You tried 
> to do a batch data read operation when you were in a state of STOP.  You can 
> only do this type of operation when you are in a state of OK or 
> OK_NEW_SCHEMA. ]"
> ]
> Error: exception while executing query (state=,code=0)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to