nested

Hadoop MapReduce provide nested directories as job input

六月ゝ 毕业季﹏ 提交于 2019-12-03 11:53:40
问题 I'm working on a job that processes a nested directory structure, containing files on multiple levels: one/ ├── three/ │ └── four/ │ ├── baz.txt │ ├── bleh.txt │ └── foo.txt └── two/ ├── bar.txt └── gaa.txt When I add one/ as an input path, no files are processed, since none are immediately available at the root level. I read about job.addInputPathRecursively(..) , but this seems to have been deprecated in the more recent releases (I'm using hadoop 1.0.2). I've written some code to walk the

“Embedded” data.frame in R. What is it, what is it called, why does it behave the way it does?

柔情痞子 提交于 2019-12-03 11:19:16
I have the following data structure in R: df <- structure( list( ID = c(1L, 2L, 3L, 4L, 5L), var1 = c('a', 'b', 'c', 'd', 'e'), var2 = structure( list( var2a = c('v', 'w', 'x', 'y', 'z'), var2b = c('vv', 'ww', 'xx', 'yy', 'zz')), .Names = c('var2a', 'var2b'), row.names = c(NA, 5L), class = 'data.frame'), var3 = c('aa', 'bb', 'cc', 'dd', 'ee')), .Names = c('ID', 'var1', 'var2', 'var3'), row.names = c(NA, 5L), class = 'data.frame') # Looks like this: # ID var1 var2.var2a var2.var2b var3 # 1 1 a v vv aa # 2 2 b w ww bb # 3 3 c x xx cc # 4 4 d y yy dd # 5 5 e z zz ee This looks like a normal data

create a spark dataframe from a nested json file in scala [duplicate]

你。 提交于 2019-12-03 10:19:33
问题 This question already has an answer here : How to access sub-entities in JSON file? (1 answer) Closed 2 years ago . I have a json file that looks like this { "group" : {}, "lang" : [ [ 1, "scala", "functional" ], [ 2, "java","object" ], [ 3, "py","interpreted" ] ] } I tried to create a dataframe using val path = "some/path/to/jsonFile.json" val df = sqlContext.read.json(path) df.show() when I run this I get df: org.apache.spark.sql.DataFrame = [_corrupt_record: string] How do we create a df

Why is it forbidden to open multiple namespaces at a stretch?

让人想犯罪 __ 提交于 2019-12-03 10:17:16
It's possible to do using namespace foo::bar; (i.e., using the inner namespace without using the outer namespace first / at all), why does the standard forbid to do the following? namespace foo::bar { // open nested namespace bar in foo and extend it... } I'm not looking for a workaround, just a possible rational on why this isn't allowed. I'm not sure "forbidden" is the right word - maybe it was just an oversight. It's a fairly small nice-to-have which isn't really a big deal. You could also take the point of view that the namespace foo isn't created yet when you write foo::bar , so allowing

nested associate arrays in bash

我们两清 提交于 2019-12-03 09:32:55
问题 Can one construct an associative array whose elements contain arrays in bash? For instance, suppose one has the following arrays: a=(a aa) b=(b bb bbb) c=(c cc ccc cccc) Can one create an associate array to access these variables? For instance, declare -A letters letters[a]=$a letters[b]=$b letters[c]=$c and then access individual elements by a command such as letter=${letters[a]} echo ${letter[1]} This mock syntax for creating and accessing elements of the associate array does not work. Do

How to turn a list into nested dict in Python

痴心易碎 提交于 2019-12-03 09:20:51
问题 Need to turn x: X = [['A', 'B', 'C'], ['A', 'B', 'D']] Into Y: Y = {'A': {'B': {'C','D'}}} More specifically, I need to create a tree of folders and files from a list of absolute paths, which looks like this: paths = ['xyz/123/file.txt', 'abc/456/otherfile.txt'] where, each path is split("/") , as per ['A', 'B', 'C'] in the pseudo example. As this represents files and folders, obviously, on the same level (index of the array) same name strings can't repeat. 回答1: X = [['A', 'B', 'C'], ['A', 'B

SQL “For XML Path” - nested results

拟墨画扇 提交于 2019-12-03 09:14:40
问题 I have this table structure. YearPart, MonthPart and DatePart contain what they describe... EX: 2011, 1, 19 (respectively) DECLARE @agenda AS TABLE ( PID INT IDENTITY(1,1) PRIMARY KEY, YearPart int, MonthPart int, DayPart int, lib_title nvarchar(200), [filename] nvarchar(255), meta_value nvarchar(2000) ) Using this sample data: INSERT INTO @agenda VALUES (2010, 12, 4, 'Test Record', '', '') INSERT INTO @agenda VALUES (2011, 1, 3, 'Another Record', '', '') INSERT INTO @agenda VALUES (2011, 1,

How to get FormArrayName when the FormArray is nested in another FormArray?

一曲冷凌霜 提交于 2019-12-03 08:47:31
Refering to : https://angular.io/docs/ts/latest/api/forms/index/FormArrayName-directive.html , it is easy to get a FormArrayName : HTML: <form [formGroup]="form" (ngSubmit)="onSubmit()"> <div formArrayName="cities"> <div *ngFor="let city of cities.controls; index as i"> <input [formControlName]="i" placeholder="City"> </div> </div> <button>Submit</button> </form> TS : form = new FormGroup({ cities: new FormArray([ new FormControl('SF'), new FormControl('NY'), ]), }); get cities(): FormArray { return this.form.get('cities') as FormArray; } // This does the magic! The DOM <div formArrayName=

Understanding View Controller Nesting in iOS

独自空忆成欢 提交于 2019-12-03 08:46:28
问题 Ive been tearing my hair out over the last couple of days trying to understand this one seemingly basic concept of iOS development: If I want to have two or more View Controllers displayed and usable in the same "screenful", is this: Not advisable as per Apple's "One VC per screenful of content" Completely possible by adding the VC's via code Just not done. Instead, use one VC and simply add code that mimics the functionality of the view controllers you want. Let me rephrase a bit: If I

Python - Dynamic Nested List

一个人想着一个人 提交于 2019-12-03 08:42:26
So I'm trying to generate a nested list in Python based on a width and a height. This is what I have so far: width = 4 height = 5 row = [None]*width map = [row]*height Now, this obviously isn't quite right. When printed it looks fine: [[None, None, None, None], [None, None, None, None], [None, None, None, None], [None, None, None, None], [None, None, None, None]] But attempting to assign a value to a position like so: map[2][3] = 'foo' I get: [[None, None, None, 'foo'], [None, None, None, 'foo'], [None, None, None, 'foo'], [None, None, None, 'foo'], [None, None, None, 'foo']] Clearly this