Hi,

> It can be supported actually, the result will be like:
> 
> | Time | Device | column1 |
> | .... | root.sg.d1 | value1 |
> | .... | root.sg.d1 | value... |
> | .... | root.sg.d2 | value1 |
> | .... | root.sg.d2 | value... |

Ha, You remind me.

Thanks,
--
Jialin Qiao
School of Software, Tsinghua University

乔嘉林
清华大学 软件学院

> -----原始邮件-----
> 发件人: "Xiangwei Wei" <[email protected]>
> 发送时间: 2020-08-14 16:31:28 (星期五)
> 收件人: [email protected]
> 抄送: 
> 主题: Re: [New feature] Add the alias and show it as column name when querying
> 
> Hi,
> 
> >【select s1 as column1 from root.sg.d1, root.sg.d2 align by device】 also
> throw exception.
> 
> It can be supported actually, the result will be like:
> 
> | Time | Device | column1 |
> | .... | root.sg.d1 | value1 |
> | .... | root.sg.d1 | value... |
> | .... | root.sg.d2 | value1 |
> | .... | root.sg.d2 | value... |
> 
> But [select * as column1 from root.sg.d1 align by device], while * -> s1,
> s2 will throw an exception.
> 
> > There are some examples that should be supported with alias.
> 
> Thanks for the examples.
> 
> 
> Jialin Qiao <[email protected]> 于2020年8月14日周五 下午2:28写道:
> 
> > Hi,
> >
> > > but it should be supported in raw data query too.
> >
> > +1
> >
> > It seems that the "align by device query" has no advantages when using
> > alias. E.g., 【select s1 as column1 from root.sg.d1, root.sg.d2 align by
> > device】 also throw exception.
> >
> > Therefore, we should restrict that the from clause only has one prefix
> > path.
> >
> > For our query sql, it can be seen as: 【select suffixPath1 as alias1,
> > suffixPath2 as alias2, ... from prefixPath】
> >
> > The raw paths are:
> > prefixPath.suffixPath1 -> alias1
> > prefixPath.suffixPath2 -> alias2
> > ...
> >
> > Then we need to check whether the prefixPath.suffixPath matches one series.
> >
> > There are some examples that should be supported with alias:
> >
> > select d1.s1 as column1 from root.sg
> > select * as column1 from root.sg.d1
> > select count(s1) as column1 from root.sg.d1
> > select count(s1) as column1 from root.sg.d1 group by (xxx) fill(xxx)
> >
> > Thanks,
> > --
> > Jialin Qiao
> > School of Software, Tsinghua University
> >
> > 乔嘉林
> > 清华大学 软件学院
> >
> > > -----原始邮件-----
> > > 发件人: "Xiangwei Wei" <[email protected]>
> > > 发送时间: 2020-08-13 21:21:03 (星期四)
> > > 收件人: [email protected]
> > > 抄送:
> > > 主题: Re: [New feature] Add the alias and show it as column name when
> > querying
> > >
> > > Hi Xiangdong,
> > >
> > > > if only one time series can be matched that starts with "root.sg" and
> > > ends with "s1", it is ok,otherwise throw an exception.
> > >
> > > You are right, thanks for the illustration.
> > >
> > >
> > > > But for queries like "select s1 from root.sg.* align by device", the
> > > cases you mentioned will never happen, which is more graceful.
> > >
> > > I agree with the point you mentioned. This new feature is more suitable
> > for
> > > align by device query, but it should be supported in raw data query too.
> > >
> > > Xiangdong Huang <[email protected]> 于2020年8月13日周四 下午5:29写道:
> > >
> > > > Hi,
> > > >
> > > > > So we have to request that *every alias input by users is matching
> > one
> > > > time
> > > > series exactly.*
> > > >
> > > >  for a query like `select s1 from root.sg.*`,  if only one time series
> > can
> > > > be matched that starts with "root.sg" and ends with "s1", it is ok,
> > > > otherwise throw an exception.
> > > > It is fine...
> > > >
> > > > But for queries like "select s1 from root.sg.* align by device", the
> > cases
> > > > you mentioned will never happen, which is more graceful.
> > > >
> > > > So, maybe this feature is more suitable for such kind of queries.
> > > >
> > > > Best,
> > > > -----------------------------------
> > > > Xiangdong Huang
> > > > School of Software, Tsinghua University
> > > >
> > > >  黄向东
> > > > 清华大学 软件学院
> > > >
> > > >
> > > > Xiangwei Wei <[email protected]> 于2020年8月13日周四 下午2:46写道:
> > > >
> > > > > Hi,
> > > > >
> > > > > I'm prepared to add a new feature in IoTDB as follows:
> > > > >
> > > > > Currently, when doing a query like *`select s1 from root.sg.d1`*, the
> > > > > result shows like:
> > > > >
> > > > > | Time | root.sg.d1.s1|
> > > > > |    ...   |          ...        |
> > > > >
> > > > > The column name *includes all prefix paths which are complex* and
> > seem
> > > > > inflexible and inconvenient in some situations.
> > > > >
> > > > > Therefore, I think we can add a new feature by adding the alias of
> > time
> > > > > series, which is like a relational database. For example, *`select
> > s1 as
> > > > > d1_temperature form root.sg.d1`*
> > > > >
> > > > > The result will be like:
> > > > >
> > > > > | Time | d1_temperature |
> > > > > |   ...    |            ....           |
> > > > >
> > > > >
> > > > > However, the new feature may be *limited* in IoTDB as a time series
> > > > > database.
> > > > > Because it's not matching one time series for one suffix path
> > exactly in
> > > > > SELECT Clause. For example, `select s1 as temperature from root.sg`.
> > If
> > > > > two
> > > > > devices d1 and d2 exist in root.sg, then they can't both be
> > temperature.
> > > > > We
> > > > > have to throw an exception here.
> > > > >
> > > > > So we have to request that *every alias input by users is matching
> > one
> > > > time
> > > > > series exactly.*
> > > > >
> > > > >
> > > > > Any suggestions or questions are welcome! Thank you!
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Best,
> > > > > Xiangwei Wei
> > > > >
> > > >
> > >
> > >
> > > --
> > > Best,
> > > Xiangwei Wei
> >
> 
> 
> -- 
> Best,
> Xiangwei Wei

Reply via email to