"Herschel imaging surveys of Galactic interstellar clouds support a paradigm for low-mass star formation in which dense molecular filaments play a crucial role. The detailed fragmentation properties of star-forming filaments remain poorly understood, however, and the validity of the filament paradigm in the high-mass regime is still unclear. Here, we investigate the detailed density and velocity structure of the main filament in the high-mass star-forming region NGC6334. We conducted ALMA observations in the 3mm continuum and the N2H+(1-0), HC5N(36-35), HNC(1-0), HC3N(10-9), CH3CCH(6-5), H2CS(3-2) lines at an angular resolution of ∼3”(~0.025 pc at d=1.7kpc). The NGC 6334 filament was detected in both the 3mm continuum and the N2H+, HC3N, HC5N, CH3CCH, and H2CS lines with ALMA. With the help of the getsources and getfilaments algorithms, we identified 21 compact (~0.03 pc) dense cores at 3mm and 5 velocity-coherent fiber-like sub-structures in N2H+, within the main filament. The 3mm continuum sources have a median mass of ∼9 Msun and can be divided into 7 groups of cores, closely associated with dense clumps seen in the ArTeMiS 350um data. The projected separation between ALMA dense cores (0.03–0.1pc) and the projected spacing between ArTeMiS clumps (0.2–0.3pc) are roughly consistent with the effective Jeans length (0.08pc) in the filament and a physical scale −0.03pc of about four times the filament width, respectively, if the inclination angle of the filament to line of sight is ∼30deg.