蜂巢中的分区(Partitions in hive)
我有CDH集群的数据集,它由yyyymm分区。
当我在hive上运行以下查询时:
select actvydt, cast((concat(trim(substr(ActvyDt, 1, 4)), trim(substr(ActvyDt, 6, 2)))) as int) from pos where yyyymm=201601 and actvydt>='2016-01-01' and actvydt<='2016-01-09' limit 10;
它从数据集中击中了201601的正确分区。
以下是结果:
actvydt yyyymm 2016-01-02 201601 2016-01-02 201601 2016-01-02 201601
但是当我运行以下查询:(只是通过subst和concat函数传递yyyymm的参数)
select actvydt,cast((concat(trim(substr(ActvyDt, 1, 4)), trim(substr(ActvyDt, 6, 2)))) as int) from pos.pos_sales_weekly where yyyymm=cast(trim((concat(trim(substr(ActvyDt, 1, 4)), trim(substr(ActvyDt, 6, 2))))) as int) and actvydt>='2016-01-01' and actvydt<='2016-01-09' limit 10;
它正在击中整个数据集。 所以yyyymm的值没有正确传递。 这个功能有一些问题:
cast((concat(trim(substr(ActvyDt, 1, 4)), trim(substr(ActvyDt, 6, 2)))) as int)
但是函数的值作为列传递,可以在上面的结果中看到。 它显示正确的参数201601.任何帮助都会非常值得注意。
下面是表模式:
CREATE EXTERNAL TABLE IF NOT EXISTS pos (nid bigint, actvydt date, upc string, tchid string, posfileid string, yssk bigint) PARTITIONED BY (yyyymm int) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe' STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat' LOCATION '/data/' TBLPROPERTIES ( 'avro.output.codec'='snappy' );
I have dataset on CDH cluster and it is partitioned by by yyyymm.
When I run the below query on hive:
select actvydt, cast((concat(trim(substr(ActvyDt, 1, 4)), trim(substr(ActvyDt, 6, 2)))) as int) from pos where yyyymm=201601 and actvydt>='2016-01-01' and actvydt<='2016-01-09' limit 10;
It is hitting the right partition of 201601 from the dataset.
Below are the results:
actvydt yyyymm 2016-01-02 201601 2016-01-02 201601 2016-01-02 201601
But when I run the below query: (just passing the parameter for yyyymm through subst and concat function)
select actvydt,cast((concat(trim(substr(ActvyDt, 1, 4)), trim(substr(ActvyDt, 6, 2)))) as int) from pos.pos_sales_weekly where yyyymm=cast(trim((concat(trim(substr(ActvyDt, 1, 4)), trim(substr(ActvyDt, 6, 2))))) as int) and actvydt>='2016-01-01' and actvydt<='2016-01-09' limit 10;
It is hitting the entire dataset. So the value for yyyymm is not getting passed correctly. There is some problem with this function:
cast((concat(trim(substr(ActvyDt, 1, 4)), trim(substr(ActvyDt, 6, 2)))) as int)
But the value of the function is passed as a column and can be seen in the results above. It is showing the correct parameter 201601. Any help would be highly appreciable.
Below is the table schema:
CREATE EXTERNAL TABLE IF NOT EXISTS pos (nid bigint, actvydt date, upc string, tchid string, posfileid string, yssk bigint) PARTITIONED BY (yyyymm int) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe' STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat' LOCATION '/data/' TBLPROPERTIES ( 'avro.output.codec'='snappy' );
原文:https://stackoverflow.com/questions/38801873
最满意答案
For Each selecteditem As [Object] In Listbx.SelectedItems //Your code on each item Next
For Each selecteditem As [Object] In Listbx.SelectedItems //Your code on each item Next
相关问答
更多-
在vb.net中如何实现ListBox控件的多选?[2022-06-29]
把ListBox的SelectionMode 属性设置为MultiExtended就可以了 如果是代码控制就是 ListBox1.SelectionMode=SelectionMode.MultiExtended -
vb.net 如何遍历所有listbox并向每个listbox添加item[2022-04-02]
因为它是网银的驱动,当网银没插入时,自然不会有任何提示,因为网银的驱动让我装在了。外置优盘里。外置的u盘,要想运行,系统,不依靠别的介质是不行的。 -
请问如何改变vb.net listbox的选中项高度[2022-05-25]
重绘事件可以通过反复改变DrawMode 的值来实现! ListBox1.DrawMode = DrawMode.OwnerDrawFixed ListBox1.DrawMode = DrawMode.OwnerDrawVariable 我对你用MeasureItem事件搞定某项高度很迷茫,那个事件是得不到list的当前项的啊? 如下,这个判断时Me.ListBox1.SelectedIndex在MeasureItem事件里一直是-1啊! If e.Index = Me.ListBox1.SelectedI ... -
mySQLCmd.CommandText = "SELECT studentname, studentid FROM studentstable WHERE Year(DOB) = " + selectedYear Dim dt As New DataTable myReader = myCmd.ExecuteReader() dt.Load(myReader) Listbox2.DataValueField = "studentid" 'it was ListBox1 now ListBox2 Li ...
-
无法从1个Listbox VB.net中的多个选择中检索值(Cannot retrieve the values from multiple selection in 1 Listbox VB.net)[2023-04-14]
如果需要总和,则需要循环到每个选定的索引以计算总和。 Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged sum = 0 'reset sum to 0 For Each I As Integer In ListBox1.GetSelectedIndices Dim CurrentItem As Lis ... -
您可能知道,此功能称为“提前输入”,并且它未内置到Winform ListBox中(因此您不会错过任何属性)。 如果将View属性设置为List则可以在ListView控件上获得预先输入功能。 As you probably know, this feature is called 'type ahead,' and it's not built into the Winform ListBox (so you're not missing a property). You can get the type ...
-
For Each selecteditem As [Object] In Listbx.SelectedItems //Your code on each item Next For Each selecteditem As [Object] In Listbx.SelectedItems //Your code on each item Next
-
ListBox的选定项目编号(ListBox's selected item number)[2022-09-02]
我认为您正在寻找SelectedItem属性,或者可能是SelectedIndex属性和Items属性。 或者也许是SelectedItems属性。 你的问题不是很清楚你想要什么。 I think you are looking for the SelectedItem property, or possibly the SelectedIndex property and the Items property. Or maybe the SelectedItems property. Your quest ... -
列表框类在MSDN中为此提供了一种方法。 您将需要使用IndexFromPoint(Point)方法。 调用此方法时,它将返回在指定Point的坐标处找到的列表框中的项目的索引。 您将希望通过在ListBox的MouseDown事件中实现此操作来捕获右键单击事件的坐标。 在最基本的形式中,代码如下。 Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Ha ...
-
使用ListBox的FindString()方法,您可以找到以指定字符串开头的第一个项目的索引。 然后,您可以使用它来设置SelectedIndex属性,该属性将选择指定索引处的项目。 要获得当前所选项目之下的项目,您只需从Items集合中获取SelectedIndex + 1 。 Public Sub DoSomething() Dim Index As Integer = ListBox1.FindString(TextBox1.Text) 'Find the index of the item ...