[
https://issues.apache.org/jira/browse/SPARK-13753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15244045#comment-15244045
]
Jingwei Lu commented on SPARK-13753:
------------------------------------
This the json definition of the air_events_rt table. The input is kafka data in
json format. We use spark sql json deserializer to read it.
schema: {
"type" : "struct",
"fields" : [ {
"name" : "type",
"type" : "string",
"nullable" : true,
}, {
"name" : "timestamp",
"type" : "long",
"nullable" : true,
}, {
"name" : "data",
"type" : {
"type" : "struct",
"fields" : [ {
"name" : "event_name",
"type" : "string",
"nullable" : true,
}, {
"name" : "req_remote_host",
"type" : "string",
"nullable" : true,
}, {
"name" : "payload",
"type" : {
"type" : "array",
"elementType" : {
"type" : "struct",
"fields" : [ {
"name" : "type",
"type" : "string",
"nullable" : true,
}, {
"name" : "name",
"type" : "string",
"nullable" : true,
}, {
"name" : "duration",
"type" : "string",
"nullable" : true,
}, {
"name" : "count",
"type" : "long",
"nullable" : true,
}]
},
"containsNull" : false
},
"nullable" : true,
}, {
"name" : "backend",
"type" : "long",
"nullable" : true,
}, {
"name" : "frontend",
"type" : "long",
"nullable" : true,
}, {
"name" : "render",
"type" : "long",
"nullable" : true,
}, {
"name" : "page_load_time",
"type" : "long",
"nullable" : true,
}, {
"name" : "starttime_to_dom_interactive",
"type" : "long",
"nullable" : true,
}, {
"name" : "total_load_time",
"type" : "long",
"nullable" : true,
}, {
"name" : "controller",
"type" : "string",
"nullable" : true,
}, {
"name" : "action",
"type" : "string",
"nullable" : true,
} ]
},
"nullable" : true,
} ]
}
> Column nullable is derived incorrectly
> --------------------------------------
>
> Key: SPARK-13753
> URL: https://issues.apache.org/jira/browse/SPARK-13753
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.5.2
> Reporter: Jingwei Lu
> Priority: Critical
>
> There is a problem in spark sql to derive nullable column and used in
> optimization incorrectly. In following query:
> {code}
> select concat("perf.realtime.web", b.tags[1]) as metric, b.value, b.tags[0]
> from (
> select explode(map(a.frontend[0],
> ARRAY(concat("metric:frontend", ",controller:", COALESCE(controller, "null"),
> ",action:", COALESCE(action, "null")), ".p50"),
> a.frontend[1],
> ARRAY(concat("metric:frontend", ",controller:", COALESCE(controller, "null"),
> ",action:", COALESCE(action, "null")), ".p90"),
> a.backend[0], ARRAY(concat("metric:backend",
> ",controller:", COALESCE(controller, "null"), ",action:", COALESCE(action,
> "null")), ".p50"),
> a.backend[1], ARRAY(concat("metric:backend",
> ",controller:", COALESCE(controller, "null"), ",action:", COALESCE(action,
> "null")), ".p90"),
> a.render[0], ARRAY(concat("metric:render",
> ",controller:", COALESCE(controller, "null"), ",action:", COALESCE(action,
> "null")), ".p50"),
> a.render[1], ARRAY(concat("metric:render",
> ",controller:", COALESCE(controller, "null"), ",action:", COALESCE(action,
> "null")), ".p90"),
> a.page_load_time[0],
> ARRAY(concat("metric:page_load_time", ",controller:", COALESCE(controller,
> "null"), ",action:", COALESCE(action, "null")), ".p50"),
> a.page_load_time[1],
> ARRAY(concat("metric:page_load_time", ",controller:", COALESCE(controller,
> "null"), ",action:", COALESCE(action, "null")), ".p90"),
> a.total_load_time[0],
> ARRAY(concat("metric:total_load_time", ",controller:", COALESCE(controller,
> "null"), ",action:", COALESCE(action, "null")), ".p50"),
> a.total_load_time[1],
> ARRAY(concat("metric:total_load_time", ",controller:", COALESCE(controller,
> "null"), ",action:", COALESCE(action, "null")), ".p90"))) as (value, tags)
> from (
> select data.controller as controller, data.action as
> action,
> percentile(data.frontend, array(0.5, 0.9)) as
> frontend,
> percentile(data.backend, array(0.5, 0.9)) as
> backend,
> percentile(data.render, array(0.5, 0.9)) as render,
> percentile(data.page_load_time, array(0.5, 0.9)) as
> page_load_time,
> percentile(data.total_load_time, array(0.5, 0.9))
> as total_load_time
> from air_events_rt
> where type='air_events' and data.event_name='pageload'
> group by data.controller, data.action
> ) a
> ) b
> where b.value is not null
> {code}
> b.value is incorrectly derived as not nullable. "b.value is not null"
> predicate will be ignored by optimizer which cause the query return incorrect
> result.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]